mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Supporting multiple show with the same name but a different start year
This commit is contained in:
		
							parent
							
								
									fb907509cb
								
							
						
					
					
						commit
						3cf74bc988
					
				@ -224,24 +224,28 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
			bool isMovie, 
 | 
								bool isMovie, 
 | 
				
			||||||
			Library library)
 | 
								Library library)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Show show = await libraryManager.GetShow(x => x.Path == showPath);
 | 
								Show old = await libraryManager.GetShow(x => x.Path == showPath);
 | 
				
			||||||
			if (show != null)
 | 
								if (old != null)
 | 
				
			||||||
				return show;
 | 
									return old;
 | 
				
			||||||
			show = await _metadataProvider.SearchShow(showTitle, isMovie, library);
 | 
								Show show = await _metadataProvider.SearchShow(showTitle, isMovie, library);
 | 
				
			||||||
			show.Path = showPath;
 | 
								show.Path = showPath;
 | 
				
			||||||
			show.People = await _metadataProvider.GetPeople(show, library);
 | 
								show.People = await _metadataProvider.GetPeople(show, library);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			try
 | 
								try
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				await libraryManager.RegisterShow(show);
 | 
									await libraryManager.RegisterShow(show);
 | 
				
			||||||
				await _thumbnailsManager.Validate(show.People);
 | 
					 | 
				
			||||||
				await _thumbnailsManager.Validate(show);
 | 
					 | 
				
			||||||
				return show;
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			catch (DuplicatedItemException)
 | 
								catch (DuplicatedItemException)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				return await libraryManager.GetShow(show.Slug);
 | 
									old = await libraryManager.GetShow(show.Slug);
 | 
				
			||||||
 | 
									if (old.Path == showPath)
 | 
				
			||||||
 | 
										return old;
 | 
				
			||||||
 | 
									show.Slug += $"-{show.StartYear}";
 | 
				
			||||||
 | 
									await libraryManager.RegisterShow(show);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								await _thumbnailsManager.Validate(show.People);
 | 
				
			||||||
 | 
								await _thumbnailsManager.Validate(show);
 | 
				
			||||||
 | 
								return show;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private async Task<Season> GetSeason(ILibraryManager libraryManager, 
 | 
							private async Task<Season> GetSeason(ILibraryManager libraryManager, 
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user