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);
|
Library GetLibrary(string librarySlug);
|
||||||
IEnumerable<Library> GetLibraries();
|
IEnumerable<Library> GetLibraries();
|
||||||
Show GetShowBySlug(string slug);
|
Show GetShowBySlug(string slug);
|
||||||
|
Show GetShow(string path);
|
||||||
Season GetSeason(string showSlug, long seasonNumber);
|
Season GetSeason(string showSlug, long seasonNumber);
|
||||||
IEnumerable<Episode> GetEpisodes(string showSlug);
|
IEnumerable<Episode> GetEpisodes(string showSlug);
|
||||||
IEnumerable<Episode> GetEpisodes(string showSlug, long seasonNumber);
|
IEnumerable<Episode> GetEpisodes(string showSlug, long seasonNumber);
|
||||||
|
@ -132,25 +132,25 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(collectionName))
|
if (string.IsNullOrEmpty(collectionName))
|
||||||
return await Task.FromResult<Collection>(null);
|
return await Task.FromResult<Collection>(null);
|
||||||
if (_libraryManager.IsCollectionRegistered(Utility.ToSlug(collectionName), out long collectionID))
|
return _libraryManager.GetCollection(Utility.ToSlug(collectionName)) ?? await _metadataProvider.GetCollectionFromName(collectionName, library);
|
||||||
return new Collection {ID = collectionID};
|
|
||||||
return await _metadataProvider.GetCollectionFromName(collectionName, library);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Show> GetShow(string showTitle, string showPath, Library library)
|
private async Task<Show> GetShow(string showTitle, string showPath, Library library)
|
||||||
{
|
{
|
||||||
if (_libraryManager.IsShowRegistered(showPath, out long showID))
|
Show show = _libraryManager.GetShow(showPath);
|
||||||
return new Show { ID = showID, Title = showTitle, ExternalIDs = _libraryManager.GetShowExternalIDs(showID) };
|
if (show != null)
|
||||||
Show show = await _metadataProvider.GetShowFromName(showTitle, showPath, library);
|
return show;
|
||||||
|
show = await _metadataProvider.GetShowFromName(showTitle, showPath, library);
|
||||||
show.People = from people in await _metadataProvider.GetPeople(show, library) select people.ToLink(show);
|
show.People = from people in await _metadataProvider.GetPeople(show, library) select people.ToLink(show);
|
||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Season> GetSeason(Show show, long seasonNumber, Library library)
|
private async Task<Season> GetSeason(Show show, long seasonNumber, Library library)
|
||||||
{
|
{
|
||||||
if (_libraryManager.IsSeasonRegistered(show.ID, seasonNumber, out long seasonID))
|
Season season = _libraryManager.GetSeason(show.Slug, seasonNumber);
|
||||||
return await Task.FromResult(new Season {ID = seasonID, ShowID = show.ID, Show = show});
|
if (season != null)
|
||||||
Season season = await _metadataProvider.GetSeason(show, seasonNumber, library);
|
return await Task.FromResult(season);
|
||||||
|
season = await _metadataProvider.GetSeason(show, seasonNumber, library);
|
||||||
season.Show = show;
|
season.Show = show;
|
||||||
return season;
|
return season;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,11 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
return (from show in _database.Shows where show.Slug == slug select show).FirstOrDefault();
|
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)
|
public IEnumerable<Season> GetSeasons(long showID)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user