mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Solving a small bug with reuse of objects
This commit is contained in:
parent
ef7b2bb61b
commit
d307308fb4
@ -28,6 +28,7 @@ namespace Kyoo.Controllers
|
||||
Library GetLibrary(string librarySlug);
|
||||
IEnumerable<Library> GetLibraries();
|
||||
Show GetShowBySlug(string slug);
|
||||
Show GetShow(string path);
|
||||
Season GetSeason(string showSlug, long seasonNumber);
|
||||
IEnumerable<Episode> GetEpisodes(string showSlug);
|
||||
IEnumerable<Episode> GetEpisodes(string showSlug, long seasonNumber);
|
||||
|
@ -132,25 +132,25 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
if (string.IsNullOrEmpty(collectionName))
|
||||
return await Task.FromResult<Collection>(null);
|
||||
if (_libraryManager.IsCollectionRegistered(Utility.ToSlug(collectionName), out long collectionID))
|
||||
return new Collection {ID = collectionID};
|
||||
return await _metadataProvider.GetCollectionFromName(collectionName, library);
|
||||
return _libraryManager.GetCollection(Utility.ToSlug(collectionName)) ?? await _metadataProvider.GetCollectionFromName(collectionName, library);
|
||||
}
|
||||
|
||||
private async Task<Show> GetShow(string showTitle, string showPath, Library library)
|
||||
{
|
||||
if (_libraryManager.IsShowRegistered(showPath, out long showID))
|
||||
return new Show { ID = showID, Title = showTitle, ExternalIDs = _libraryManager.GetShowExternalIDs(showID) };
|
||||
Show show = await _metadataProvider.GetShowFromName(showTitle, showPath, library);
|
||||
Show show = _libraryManager.GetShow(showPath);
|
||||
if (show != null)
|
||||
return show;
|
||||
show = await _metadataProvider.GetShowFromName(showTitle, showPath, library);
|
||||
show.People = from people in await _metadataProvider.GetPeople(show, library) select people.ToLink(show);
|
||||
return show;
|
||||
}
|
||||
|
||||
private async Task<Season> GetSeason(Show show, long seasonNumber, Library library)
|
||||
{
|
||||
if (_libraryManager.IsSeasonRegistered(show.ID, seasonNumber, out long seasonID))
|
||||
return await Task.FromResult(new Season {ID = seasonID, ShowID = show.ID, Show = show});
|
||||
Season season = await _metadataProvider.GetSeason(show, seasonNumber, library);
|
||||
Season season = _libraryManager.GetSeason(show.Slug, seasonNumber);
|
||||
if (season != null)
|
||||
return await Task.FromResult(season);
|
||||
season = await _metadataProvider.GetSeason(show, seasonNumber, library);
|
||||
season.Show = show;
|
||||
return season;
|
||||
}
|
||||
|
@ -78,6 +78,11 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
return (from show in _database.Shows where show.Slug == slug select show).FirstOrDefault();
|
||||
}
|
||||
|
||||
public Show GetShow(string path)
|
||||
{
|
||||
return (from show in _database.Shows where show.Path == path select show).FirstOrDefault();
|
||||
}
|
||||
|
||||
public IEnumerable<Season> GetSeasons(long showID)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user