Implementing the movies for the providers

This commit is contained in:
Zoe Roux 2020-02-13 23:19:24 +01:00
parent e5bb71084b
commit fe3407b334
4 changed files with 10 additions and 11 deletions

View File

@ -13,7 +13,7 @@ namespace Kyoo.Controllers
//For the show
Task<Show> GetShowByID(string id);
Task<Show> GetShowFromName(string showName);
Task<Show> GetShowFromName(string showName, bool isMovie);
Task<IEnumerable<PeopleLink>> GetPeople(Show show);
//For the seasons

View File

@ -7,7 +7,7 @@ namespace Kyoo.Controllers
public interface IProviderManager
{
Task<Collection> GetCollectionFromName(string name, Library library);
Task<Show> GetShowFromName(string showName, string showPath, Library library);
Task<Show> GetShowFromName(string showName, string showPath, bool isMovie, Library library);
Task<Season> GetSeason(Show show, long seasonNumber, Library library);
Task<Episode> GetEpisode(Show show, string episodePath, long seasonNumber, long episodeNumber, long absoluteNumber, Library library);
Task<IEnumerable<PeopleLink>> GetPeople(Show show, Library library);

View File

@ -81,12 +81,10 @@ namespace Kyoo.Controllers
long absoluteNumber = long.TryParse(match.Groups["Absolute"].Value, out tmp) ? tmp : -1;
Collection collection = await GetCollection(collectionName, library);
Show show = await GetShow(showName, showPath, library);
if (seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1)
{
show.IsMovie = true;
bool isMovie = seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1;
Show show = await GetShow(showName, showPath, isMovie, library);
if (isMovie)
_libraryManager.RegisterShow(show);
}
else
{
Season season = await GetSeason(show, seasonNumber, library);
@ -103,12 +101,12 @@ namespace Kyoo.Controllers
return _libraryManager.GetCollection(Utility.ToSlug(collectionName)) ?? 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, bool isMovie, Library library)
{
Show show = _libraryManager.GetShow(showPath);
if (show != null)
return show;
show = await _metadataProvider.GetShowFromName(showTitle, showPath, library);
show = await _metadataProvider.GetShowFromName(showTitle, showPath, isMovie, library);
show.People = (await _metadataProvider.GetPeople(show, library)).GroupBy(x => x.Slug).Select(x => x.First())
.Select(x =>
{

View File

@ -59,12 +59,13 @@ namespace Kyoo.Controllers
return collection;
}
public async Task<Show> GetShowFromName(string showName, string showPath, Library library)
public async Task<Show> GetShowFromName(string showName, string showPath, bool isMovie, Library library)
{
Show show = await GetMetadata(provider => provider.GetShowFromName(showName), library, $"the show {showName}");
Show show = await GetMetadata(provider => provider.GetShowFromName(showName, isMovie), library, $"the show {showName}");
show.Path = showPath;
show.Slug = Utility.ToSlug(showName);
show.Title ??= showName;
show.IsMovie = isMovie;
await _thumbnailsManager.Validate(show);
return show;
}