mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-30 19:54:16 -04:00
Implementing the movies for the providers
This commit is contained in:
parent
e5bb71084b
commit
fe3407b334
@ -13,7 +13,7 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
//For the show
|
//For the show
|
||||||
Task<Show> GetShowByID(string id);
|
Task<Show> GetShowByID(string id);
|
||||||
Task<Show> GetShowFromName(string showName);
|
Task<Show> GetShowFromName(string showName, bool isMovie);
|
||||||
Task<IEnumerable<PeopleLink>> GetPeople(Show show);
|
Task<IEnumerable<PeopleLink>> GetPeople(Show show);
|
||||||
|
|
||||||
//For the seasons
|
//For the seasons
|
||||||
|
@ -7,7 +7,7 @@ namespace Kyoo.Controllers
|
|||||||
public interface IProviderManager
|
public interface IProviderManager
|
||||||
{
|
{
|
||||||
Task<Collection> GetCollectionFromName(string name, Library library);
|
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<Season> GetSeason(Show show, long seasonNumber, Library library);
|
||||||
Task<Episode> GetEpisode(Show show, string episodePath, long seasonNumber, long episodeNumber, long absoluteNumber, 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);
|
Task<IEnumerable<PeopleLink>> GetPeople(Show show, Library library);
|
||||||
|
@ -81,12 +81,10 @@ namespace Kyoo.Controllers
|
|||||||
long absoluteNumber = long.TryParse(match.Groups["Absolute"].Value, out tmp) ? tmp : -1;
|
long absoluteNumber = long.TryParse(match.Groups["Absolute"].Value, out tmp) ? tmp : -1;
|
||||||
|
|
||||||
Collection collection = await GetCollection(collectionName, library);
|
Collection collection = await GetCollection(collectionName, library);
|
||||||
Show show = await GetShow(showName, showPath, library);
|
bool isMovie = seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1;
|
||||||
if (seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1)
|
Show show = await GetShow(showName, showPath, isMovie, library);
|
||||||
{
|
if (isMovie)
|
||||||
show.IsMovie = true;
|
|
||||||
_libraryManager.RegisterShow(show);
|
_libraryManager.RegisterShow(show);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Season season = await GetSeason(show, seasonNumber, library);
|
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);
|
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);
|
Show show = _libraryManager.GetShow(showPath);
|
||||||
if (show != null)
|
if (show != null)
|
||||||
return show;
|
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())
|
show.People = (await _metadataProvider.GetPeople(show, library)).GroupBy(x => x.Slug).Select(x => x.First())
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
|
@ -59,12 +59,13 @@ namespace Kyoo.Controllers
|
|||||||
return collection;
|
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.Path = showPath;
|
||||||
show.Slug = Utility.ToSlug(showName);
|
show.Slug = Utility.ToSlug(showName);
|
||||||
show.Title ??= showName;
|
show.Title ??= showName;
|
||||||
|
show.IsMovie = isMovie;
|
||||||
await _thumbnailsManager.Validate(show);
|
await _thumbnailsManager.Validate(show);
|
||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user