mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Replacing IEnumearble with ICollections inside resources
This commit is contained in:
parent
5f6c663f18
commit
bc7a314409
@ -241,9 +241,8 @@ namespace Kyoo.Controllers
|
|||||||
Task<Studio> EditStudio(Studio studio, bool resetOld);
|
Task<Studio> EditStudio(Studio studio, bool resetOld);
|
||||||
Task<People> EditPeople(People people, bool resetOld);
|
Task<People> EditPeople(People people, bool resetOld);
|
||||||
|
|
||||||
|
|
||||||
// Delete values
|
// Delete values
|
||||||
Task DelteLibrary(Library library);
|
Task DeleteLibrary(Library library);
|
||||||
Task DeleteCollection(Collection collection);
|
Task DeleteCollection(Collection collection);
|
||||||
Task DeleteShow(Show show);
|
Task DeleteShow(Show show);
|
||||||
Task DeleteSeason(Season season);
|
Task DeleteSeason(Season season);
|
||||||
@ -254,7 +253,7 @@ namespace Kyoo.Controllers
|
|||||||
Task DeletePeople(People people);
|
Task DeletePeople(People people);
|
||||||
|
|
||||||
//Delete by slug
|
//Delete by slug
|
||||||
Task DelteLibrary(string slug);
|
Task DeleteLibrary(string slug);
|
||||||
Task DeleteCollection(string slug);
|
Task DeleteCollection(string slug);
|
||||||
Task DeleteShow(string slug);
|
Task DeleteShow(string slug);
|
||||||
Task DeleteSeason(string slug);
|
Task DeleteSeason(string slug);
|
||||||
@ -265,7 +264,7 @@ namespace Kyoo.Controllers
|
|||||||
Task DeletePeople(string slug);
|
Task DeletePeople(string slug);
|
||||||
|
|
||||||
//Delete by id
|
//Delete by id
|
||||||
Task DelteLibrary(int id);
|
Task DeleteLibrary(int id);
|
||||||
Task DeleteCollection(int id);
|
Task DeleteCollection(int id);
|
||||||
Task DeleteShow(int id);
|
Task DeleteShow(int id);
|
||||||
Task DeleteSeason(int id);
|
Task DeleteSeason(int id);
|
||||||
|
@ -11,8 +11,8 @@ namespace Kyoo.Controllers
|
|||||||
Task<Collection> GetCollectionFromName(string name);
|
Task<Collection> GetCollectionFromName(string name);
|
||||||
|
|
||||||
Task<Show> GetShowByID(Show show);
|
Task<Show> GetShowByID(Show show);
|
||||||
Task<IEnumerable<Show>> SearchShows(string showName, bool isMovie);
|
Task<ICollection<Show>> SearchShows(string showName, bool isMovie);
|
||||||
Task<IEnumerable<PeopleRole>> GetPeople(Show show);
|
Task<ICollection<PeopleRole>> GetPeople(Show show);
|
||||||
|
|
||||||
Task<Season> GetSeason(Show show, int seasonNumber);
|
Task<Season> GetSeason(Show show, int seasonNumber);
|
||||||
|
|
||||||
|
@ -12,6 +12,6 @@ namespace Kyoo.Controllers
|
|||||||
Task<IEnumerable<Show>> SearchShows(string showName, bool isMovie, Library library);
|
Task<IEnumerable<Show>> SearchShows(string showName, bool isMovie, Library library);
|
||||||
Task<Season> GetSeason(Show show, int seasonNumber, Library library);
|
Task<Season> GetSeason(Show show, int seasonNumber, Library library);
|
||||||
Task<Episode> GetEpisode(Show show, string episodePath, int seasonNumber, int episodeNumber, int absoluteNumber, Library library);
|
Task<Episode> GetEpisode(Show show, string episodePath, int seasonNumber, int episodeNumber, int absoluteNumber, Library library);
|
||||||
Task<IEnumerable<PeopleRole>> GetPeople(Show show, Library library);
|
Task<ICollection<PeopleRole>> GetPeople(Show show, Library library);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
<Company>SDG</Company>
|
<Company>SDG</Company>
|
||||||
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
<PackageVersion>1.0.22</PackageVersion>
|
<PackageVersion>1.0.23</PackageVersion>
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
<LangVersion>default</LangVersion>
|
<LangVersion>default</LangVersion>
|
||||||
@ -23,4 +23,8 @@
|
|||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Controllers\Implementations" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Kyoo.Models.Attributes;
|
using Kyoo.Models.Attributes;
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ namespace Kyoo.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ExpressionRewrite(nameof(People) + "."+ nameof(Models.People.ExternalIDs))]
|
[ExpressionRewrite(nameof(People) + "."+ nameof(Models.People.ExternalIDs))]
|
||||||
public IEnumerable<MetadataID> ExternalIDs
|
public ICollection<MetadataID> ExternalIDs
|
||||||
{
|
{
|
||||||
get => People.ExternalIDs;
|
get => People.ExternalIDs;
|
||||||
set => People.ExternalIDs = value;
|
set => People.ExternalIDs = value;
|
||||||
@ -75,7 +76,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public IEnumerable<string> Aliases { get; set; }
|
public ICollection<string> Aliases { get; set; }
|
||||||
[JsonIgnore] public string Path { get; set; }
|
[JsonIgnore] public string Path { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public Status? Status { get; set; }
|
public Status? Status { get; set; }
|
||||||
@ -96,7 +97,7 @@ namespace Kyoo.Models
|
|||||||
Type = x.Type;
|
Type = x.Type;
|
||||||
Slug = x.Show.Slug;
|
Slug = x.Show.Slug;
|
||||||
Title = x.Show.Title;
|
Title = x.Show.Title;
|
||||||
Aliases = x.Show.Aliases;
|
Aliases = x.Show.Aliases?.ToArray();
|
||||||
Path = x.Show.Path;
|
Path = x.Show.Path;
|
||||||
Overview = x.Show.Overview;
|
Overview = x.Show.Overview;
|
||||||
Status = x.Show.Status;
|
Status = x.Show.Status;
|
||||||
@ -116,7 +117,7 @@ namespace Kyoo.Models
|
|||||||
Type = x.Type,
|
Type = x.Type,
|
||||||
Slug = x.Show.Slug,
|
Slug = x.Show.Slug,
|
||||||
Title = x.Show.Title,
|
Title = x.Show.Title,
|
||||||
Aliases = x.Show.Aliases,
|
Aliases = x.Show.Aliases != null ? x.Show.Aliases.ToArray() : null,
|
||||||
Path = x.Show.Path,
|
Path = x.Show.Path,
|
||||||
Overview = x.Show.Overview,
|
Overview = x.Show.Overview,
|
||||||
Status = x.Show.Status,
|
Status = x.Show.Status,
|
||||||
|
@ -5,6 +5,6 @@ namespace Kyoo.Models
|
|||||||
public interface IPlugin
|
public interface IPlugin
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public IEnumerable<ITask> Tasks { get; }
|
public ICollection<ITask> Tasks { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,8 +10,8 @@ namespace Kyoo.Models
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Poster { get; set; }
|
public string Poster { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Show> Shows { get; set; }
|
[JsonIgnore] public virtual ICollection<Show> Shows { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Library> Libraries { get; set; }
|
[JsonIgnore] public virtual ICollection<Library> Libraries { get; set; }
|
||||||
|
|
||||||
public Collection() { }
|
public Collection() { }
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Kyoo.Models.Attributes;
|
using Kyoo.Models.Attributes;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
@ -24,9 +25,9 @@ namespace Kyoo.Models
|
|||||||
public int Runtime { get; set; } //This runtime variable should be in minutes
|
public int Runtime { get; set; } //This runtime variable should be in minutes
|
||||||
|
|
||||||
[JsonIgnore] public string Poster { get; set; }
|
[JsonIgnore] public string Poster { get; set; }
|
||||||
[EditableRelation] public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
[EditableRelation] public virtual ICollection<MetadataID> ExternalIDs { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public virtual IEnumerable<Track> Tracks { get; set; }
|
[JsonIgnore] public virtual ICollection<Track> Tracks { get; set; }
|
||||||
|
|
||||||
public string ShowTitle => Show.Title;
|
public string ShowTitle => Show.Title;
|
||||||
public string Slug => Show != null ? GetSlug(Show.Slug, SeasonNumber, EpisodeNumber) : ID.ToString();
|
public string Slug => Show != null ? GetSlug(Show.Slug, SeasonNumber, EpisodeNumber) : ID.ToString();
|
||||||
@ -61,7 +62,7 @@ namespace Kyoo.Models
|
|||||||
ReleaseDate = releaseDate;
|
ReleaseDate = releaseDate;
|
||||||
Runtime = runtime;
|
Runtime = runtime;
|
||||||
Poster = poster;
|
Poster = poster;
|
||||||
ExternalIDs = externalIDs;
|
ExternalIDs = externalIDs?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Episode(int showID,
|
public Episode(int showID,
|
||||||
@ -76,19 +77,11 @@ namespace Kyoo.Models
|
|||||||
int runtime,
|
int runtime,
|
||||||
string poster,
|
string poster,
|
||||||
IEnumerable<MetadataID> externalIDs)
|
IEnumerable<MetadataID> externalIDs)
|
||||||
|
: this(seasonNumber, episodeNumber, absoluteNumber, title, overview, releaseDate, runtime, poster, externalIDs)
|
||||||
{
|
{
|
||||||
ShowID = showID;
|
ShowID = showID;
|
||||||
SeasonID = seasonID;
|
SeasonID = seasonID;
|
||||||
SeasonNumber = seasonNumber;
|
|
||||||
EpisodeNumber = episodeNumber;
|
|
||||||
AbsoluteNumber = absoluteNumber;
|
|
||||||
Path = path;
|
Path = path;
|
||||||
Title = title;
|
|
||||||
Overview = overview;
|
|
||||||
ReleaseDate = releaseDate;
|
|
||||||
Runtime = runtime;
|
|
||||||
Poster = poster;
|
|
||||||
ExternalIDs = externalIDs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetSlug(string showSlug, int seasonNumber, int episodeNumber)
|
public static string GetSlug(string showSlug, int seasonNumber, int episodeNumber)
|
||||||
|
@ -9,7 +9,7 @@ namespace Kyoo.Models
|
|||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public virtual IEnumerable<Show> Shows { get; set; }
|
[JsonIgnore] public virtual ICollection<Show> Shows { get; set; }
|
||||||
|
|
||||||
public Genre() {}
|
public Genre() {}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Kyoo.Models.Attributes;
|
using Kyoo.Models.Attributes;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
@ -8,12 +9,12 @@ namespace Kyoo.Models
|
|||||||
[JsonIgnore] public int ID { get; set; }
|
[JsonIgnore] public int ID { get; set; }
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IEnumerable<string> Paths { get; set; }
|
public ICollection<string> Paths { get; set; }
|
||||||
|
|
||||||
[EditableRelation] public virtual IEnumerable<ProviderID> Providers { get; set; }
|
[EditableRelation] public virtual ICollection<ProviderID> Providers { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public virtual IEnumerable<Show> Shows { get; set; }
|
[JsonIgnore] public virtual ICollection<Show> Shows { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Collection> Collections { get; set; }
|
[JsonIgnore] public virtual ICollection<Collection> Collections { get; set; }
|
||||||
|
|
||||||
public Library() { }
|
public Library() { }
|
||||||
|
|
||||||
@ -21,8 +22,8 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Name = name;
|
Name = name;
|
||||||
Paths = paths;
|
Paths = paths?.ToArray();
|
||||||
Providers = providers;
|
Providers = providers?.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Kyoo.Models.Attributes;
|
using Kyoo.Models.Attributes;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
@ -9,9 +10,9 @@ namespace Kyoo.Models
|
|||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Poster { get; set; }
|
public string Poster { get; set; }
|
||||||
[EditableRelation] public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
[EditableRelation] public virtual ICollection<MetadataID> ExternalIDs { get; set; }
|
||||||
|
|
||||||
[EditableRelation] [JsonReadOnly] public virtual IEnumerable<PeopleRole> Roles { get; set; }
|
[EditableRelation] [JsonReadOnly] public virtual ICollection<PeopleRole> Roles { get; set; }
|
||||||
|
|
||||||
public People() {}
|
public People() {}
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ namespace Kyoo.Models
|
|||||||
Slug = slug;
|
Slug = slug;
|
||||||
Name = name;
|
Name = name;
|
||||||
Poster = poster;
|
Poster = poster;
|
||||||
ExternalIDs = externalIDs;
|
ExternalIDs = externalIDs?.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Kyoo.Models.Attributes;
|
using Kyoo.Models.Attributes;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
@ -17,10 +18,10 @@ namespace Kyoo.Models
|
|||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public string Poster { get; set; }
|
[JsonIgnore] public string Poster { get; set; }
|
||||||
[EditableRelation] public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
[EditableRelation] public virtual ICollection<MetadataID> ExternalIDs { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public virtual Show Show { get; set; }
|
[JsonIgnore] public virtual Show Show { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Episode> Episodes { get; set; }
|
[JsonIgnore] public virtual ICollection<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
public Season() { }
|
public Season() { }
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ namespace Kyoo.Models
|
|||||||
Overview = overview;
|
Overview = overview;
|
||||||
Year = year;
|
Year = year;
|
||||||
Poster = poster;
|
Poster = poster;
|
||||||
ExternalIDs = externalIDs;
|
ExternalIDs = externalIDs?.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace Kyoo.Models
|
|||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
[EditableRelation] public IEnumerable<string> Aliases { get; set; }
|
[EditableRelation] public ICollection<string> Aliases { get; set; }
|
||||||
[JsonIgnore] public string Path { get; set; }
|
[JsonIgnore] public string Path { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public Status? Status { get; set; }
|
public Status? Status { get; set; }
|
||||||
@ -24,17 +24,17 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public bool IsMovie { get; set; }
|
public bool IsMovie { get; set; }
|
||||||
|
|
||||||
[EditableRelation] public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
[EditableRelation] public virtual ICollection<MetadataID> ExternalIDs { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonIgnore] public int? StudioID { get; set; }
|
[JsonIgnore] public int? StudioID { get; set; }
|
||||||
[EditableRelation] [JsonReadOnly] public virtual Studio Studio { get; set; }
|
[EditableRelation] [JsonReadOnly] public virtual Studio Studio { get; set; }
|
||||||
[EditableRelation] [JsonReadOnly] public virtual IEnumerable<Genre> Genres { get; set; }
|
[EditableRelation] [JsonReadOnly] public virtual ICollection<Genre> Genres { get; set; }
|
||||||
[EditableRelation] [JsonReadOnly] public virtual IEnumerable<PeopleRole> People { get; set; }
|
[EditableRelation] [JsonReadOnly] public virtual ICollection<PeopleRole> People { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Season> Seasons { get; set; }
|
[JsonIgnore] public virtual ICollection<Season> Seasons { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Episode> Episodes { get; set; }
|
[JsonIgnore] public virtual ICollection<Episode> Episodes { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Library> Libraries { get; set; }
|
[JsonIgnore] public virtual ICollection<Library> Libraries { get; set; }
|
||||||
[JsonIgnore] public virtual IEnumerable<Collection> Collections { get; set; }
|
[JsonIgnore] public virtual ICollection<Collection> Collections { get; set; }
|
||||||
|
|
||||||
public Show() { }
|
public Show() { }
|
||||||
|
|
||||||
@ -51,15 +51,15 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Title = title;
|
Title = title;
|
||||||
Aliases = aliases;
|
Aliases = aliases?.ToArray();
|
||||||
Path = path;
|
Path = path;
|
||||||
Overview = overview;
|
Overview = overview;
|
||||||
TrailerUrl = trailerUrl;
|
TrailerUrl = trailerUrl;
|
||||||
Genres = genres;
|
Genres = genres?.ToArray();
|
||||||
Status = status;
|
Status = status;
|
||||||
StartYear = startYear;
|
StartYear = startYear;
|
||||||
EndYear = endYear;
|
EndYear = endYear;
|
||||||
ExternalIDs = externalIDs;
|
ExternalIDs = externalIDs?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Show(string slug,
|
public Show(string slug,
|
||||||
@ -78,7 +78,7 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Title = title;
|
Title = title;
|
||||||
Aliases = aliases;
|
Aliases = aliases?.ToArray();
|
||||||
Path = path;
|
Path = path;
|
||||||
Overview = overview;
|
Overview = overview;
|
||||||
TrailerUrl = trailerUrl;
|
TrailerUrl = trailerUrl;
|
||||||
@ -88,7 +88,7 @@ namespace Kyoo.Models
|
|||||||
Poster = poster;
|
Poster = poster;
|
||||||
Logo = logo;
|
Logo = logo;
|
||||||
Backdrop = backdrop;
|
Backdrop = backdrop;
|
||||||
ExternalIDs = externalIDs;
|
ExternalIDs = externalIDs?.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetID(string provider)
|
public string GetID(string provider)
|
||||||
|
@ -9,7 +9,7 @@ namespace Kyoo.Models
|
|||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public virtual IEnumerable<Show> Shows { get; set; }
|
[JsonIgnore] public virtual ICollection<Show> Shows { get; set; }
|
||||||
|
|
||||||
public Studio() { }
|
public Studio() { }
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using Kyoo.Models;
|
|||||||
|
|
||||||
namespace Kyoo.Controllers
|
namespace Kyoo.Controllers
|
||||||
{
|
{
|
||||||
public abstract class ALibraryManager : ILibraryManager
|
public class LibraryManager : ILibraryManager
|
||||||
{
|
{
|
||||||
public ILibraryRepository LibraryRepository { get; }
|
public ILibraryRepository LibraryRepository { get; }
|
||||||
public ILibraryItemRepository LibraryItemRepository { get; }
|
public ILibraryItemRepository LibraryItemRepository { get; }
|
||||||
@ -20,7 +20,7 @@ namespace Kyoo.Controllers
|
|||||||
public IPeopleRepository PeopleRepository { get; }
|
public IPeopleRepository PeopleRepository { get; }
|
||||||
public IProviderRepository ProviderRepository { get; }
|
public IProviderRepository ProviderRepository { get; }
|
||||||
|
|
||||||
public ALibraryManager(ILibraryRepository libraryRepository,
|
protected LibraryManager(ILibraryRepository libraryRepository,
|
||||||
ILibraryItemRepository libraryItemRepository,
|
ILibraryItemRepository libraryItemRepository,
|
||||||
ICollectionRepository collectionRepository,
|
ICollectionRepository collectionRepository,
|
||||||
IShowRepository showRepository,
|
IShowRepository showRepository,
|
||||||
@ -235,9 +235,12 @@ namespace Kyoo.Controllers
|
|||||||
return PeopleRepository.Get(where);
|
return PeopleRepository.Get(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Task Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
public virtual Task Load<T, T2>(T obj, Expression<Func<T, T2>> member)
|
||||||
where T : class, IResource
|
where T : class, IResource
|
||||||
where T2 : class;
|
where T2 : class
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
public Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null,
|
public Task<ICollection<Library>> GetLibraries(Expression<Func<Library, bool>> where = null,
|
||||||
Sort<Library> sort = default,
|
Sort<Library> sort = default,
|
||||||
@ -544,7 +547,7 @@ namespace Kyoo.Controllers
|
|||||||
return PeopleRepository.Edit(people, resetOld);
|
return PeopleRepository.Edit(people, resetOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DelteLibrary(Library library)
|
public Task DeleteLibrary(Library library)
|
||||||
{
|
{
|
||||||
return LibraryRepository.Delete(library);
|
return LibraryRepository.Delete(library);
|
||||||
}
|
}
|
||||||
@ -589,7 +592,7 @@ namespace Kyoo.Controllers
|
|||||||
return PeopleRepository.Delete(people);
|
return PeopleRepository.Delete(people);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DelteLibrary(string library)
|
public Task DeleteLibrary(string library)
|
||||||
{
|
{
|
||||||
return LibraryRepository.Delete(library);
|
return LibraryRepository.Delete(library);
|
||||||
}
|
}
|
||||||
@ -634,7 +637,7 @@ namespace Kyoo.Controllers
|
|||||||
return PeopleRepository.Delete(people);
|
return PeopleRepository.Delete(people);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DelteLibrary(int library)
|
public Task DeleteLibrary(int library)
|
||||||
{
|
{
|
||||||
return LibraryRepository.Delete(library);
|
return LibraryRepository.Delete(library);
|
||||||
}
|
}
|
@ -3,15 +3,16 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
|
|
||||||
namespace Kyoo.Controllers
|
namespace Kyoo.Controllers
|
||||||
{
|
{
|
||||||
public class LibraryManager : ALibraryManager
|
public class TLibraryManager : LibraryManager
|
||||||
{
|
{
|
||||||
private readonly DatabaseContext _database;
|
private readonly DbContext _database;
|
||||||
|
|
||||||
public LibraryManager(ILibraryRepository libraryRepository,
|
public TLibraryManager(ILibraryRepository libraryRepository,
|
||||||
ILibraryItemRepository libraryItemRepository,
|
ILibraryItemRepository libraryItemRepository,
|
||||||
ICollectionRepository collectionRepository,
|
ICollectionRepository collectionRepository,
|
||||||
IShowRepository showRepository,
|
IShowRepository showRepository,
|
||||||
@ -22,7 +23,7 @@ namespace Kyoo.Controllers
|
|||||||
IStudioRepository studioRepository,
|
IStudioRepository studioRepository,
|
||||||
IProviderRepository providerRepository,
|
IProviderRepository providerRepository,
|
||||||
IPeopleRepository peopleRepository,
|
IPeopleRepository peopleRepository,
|
||||||
DatabaseContext database)
|
DbContext database)
|
||||||
: base(libraryRepository,
|
: base(libraryRepository,
|
||||||
libraryItemRepository,
|
libraryItemRepository,
|
||||||
collectionRepository,
|
collectionRepository,
|
@ -40,7 +40,7 @@ namespace Kyoo.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<T>> GetMetadata<T>(
|
private async Task<List<T>> GetMetadata<T>(
|
||||||
Func<IMetadataProvider, Task<IEnumerable<T>>> providerCall,
|
Func<IMetadataProvider, Task<ICollection<T>>> providerCall,
|
||||||
Library library,
|
Library library,
|
||||||
string what)
|
string what)
|
||||||
{
|
{
|
||||||
@ -146,7 +146,7 @@ namespace Kyoo.Controllers
|
|||||||
return episode;
|
return episode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<PeopleRole>> GetPeople(Show show, Library library)
|
public async Task<ICollection<PeopleRole>> GetPeople(Show show, Library library)
|
||||||
{
|
{
|
||||||
List<PeopleRole> people = await GetMetadata(
|
List<PeopleRole> people = await GetMetadata(
|
||||||
provider => provider.GetPeople(show),
|
provider => provider.GetPeople(show),
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
|
||||||
|
<ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" />
|
||||||
<PackageReference Include="IdentityServer4" Version="4.1.1" />
|
<PackageReference Include="IdentityServer4" Version="4.1.1" />
|
||||||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.1" />
|
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.1" />
|
||||||
<PackageReference Include="IdentityServer4.EntityFramework" Version="4.1.1" />
|
<PackageReference Include="IdentityServer4.EntityFramework" Version="4.1.1" />
|
||||||
@ -28,7 +30,6 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.3" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.3" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
||||||
<PackageReference Include="Portable.BouncyCastle" Version="1.8.9" />
|
<PackageReference Include="Portable.BouncyCastle" Version="1.8.9" />
|
||||||
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
|
|
||||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
|
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.3" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.3" />
|
||||||
@ -45,7 +46,6 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -44,7 +44,7 @@ namespace Kyoo
|
|||||||
NpgsqlConnection.GlobalTypeMapper.MapEnum<StreamType>();
|
NpgsqlConnection.GlobalTypeMapper.MapEnum<StreamType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ValueComparer<IEnumerable<string>> _stringArrayComparer = new(
|
private readonly ValueComparer<ICollection<string>> _stringArrayComparer = new(
|
||||||
(l1, l2) => l1.SequenceEqual(l2),
|
(l1, l2) => l1.SequenceEqual(l2),
|
||||||
arr => arr.Aggregate(0, (i, s) => s.GetHashCode())
|
arr => arr.Aggregate(0, (i, s) => s.GetHashCode())
|
||||||
);
|
);
|
||||||
|
@ -8,18 +8,18 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
[JsonIgnore] [NotMergable] public virtual ICollection<CollectionLink> Links { get; set; }
|
[JsonIgnore] [NotMergable] public virtual ICollection<CollectionLink> Links { get; set; }
|
||||||
[ExpressionRewrite(nameof(Links), nameof(CollectionLink.Child))]
|
[ExpressionRewrite(nameof(Links), nameof(CollectionLink.Child))]
|
||||||
public override IEnumerable<Show> Shows
|
public override ICollection<Show> Shows
|
||||||
{
|
{
|
||||||
get => Links?.Select(x => x.Child);
|
get => Links?.Select(x => x.Child).ToList();
|
||||||
set => Links = value?.Select(x => new CollectionLink(this, x)).ToList();
|
set => Links = value?.Select(x => new CollectionLink(this, x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
||||||
|
|
||||||
[ExpressionRewrite(nameof(LibraryLinks), nameof(GenreLink.Child))]
|
[ExpressionRewrite(nameof(LibraryLinks), nameof(GenreLink.Child))]
|
||||||
public override IEnumerable<Library> Libraries
|
public override ICollection<Library> Libraries
|
||||||
{
|
{
|
||||||
get => LibraryLinks?.Select(x => x.Library);
|
get => LibraryLinks?.Select(x => x.Library).ToList();
|
||||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ namespace Kyoo.Models
|
|||||||
[JsonIgnore] [NotMergable] public virtual ICollection<GenreLink> Links { get; set; }
|
[JsonIgnore] [NotMergable] public virtual ICollection<GenreLink> Links { get; set; }
|
||||||
|
|
||||||
[ExpressionRewrite(nameof(Links), nameof(GenreLink.Child))]
|
[ExpressionRewrite(nameof(Links), nameof(GenreLink.Child))]
|
||||||
[JsonIgnore] [NotMergable] public override IEnumerable<Show> Shows
|
[JsonIgnore] [NotMergable] public override ICollection<Show> Shows
|
||||||
{
|
{
|
||||||
get => Links?.Select(x => x.Parent);
|
get => Links?.Select(x => x.Parent).ToList();
|
||||||
set => Links = value?.Select(x => new GenreLink(x, this)).ToList();
|
set => Links = value?.Select(x => new GenreLink(x, this)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,25 +8,25 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
[EditableRelation] [JsonIgnore] [NotMergable] public virtual ICollection<ProviderLink> ProviderLinks { get; set; }
|
[EditableRelation] [JsonIgnore] [NotMergable] public virtual ICollection<ProviderLink> ProviderLinks { get; set; }
|
||||||
[ExpressionRewrite(nameof(ProviderLinks), nameof(ProviderLink.Child))]
|
[ExpressionRewrite(nameof(ProviderLinks), nameof(ProviderLink.Child))]
|
||||||
public override IEnumerable<ProviderID> Providers
|
public override ICollection<ProviderID> Providers
|
||||||
{
|
{
|
||||||
get => ProviderLinks?.Select(x => x.Child);
|
get => ProviderLinks?.Select(x => x.Child).ToList();
|
||||||
set => ProviderLinks = value?.Select(x => new ProviderLink(x, this)).ToList();
|
set => ProviderLinks = value?.Select(x => new ProviderLink(x, this)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> Links { get; set; }
|
[JsonIgnore] [NotMergable] public virtual ICollection<LibraryLink> Links { get; set; }
|
||||||
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Show))]
|
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Show))]
|
||||||
public override IEnumerable<Show> Shows
|
public override ICollection<Show> Shows
|
||||||
{
|
{
|
||||||
get => Links?.Where(x => x.Show != null).Select(x => x.Show);
|
get => Links?.Where(x => x.Show != null).Select(x => x.Show).ToList();
|
||||||
set => Links = Utility.MergeLists(
|
set => Links = Utility.MergeLists(
|
||||||
value?.Select(x => new LibraryLink(this, x)),
|
value?.Select(x => new LibraryLink(this, x)),
|
||||||
Links?.Where(x => x.Show == null))?.ToList();
|
Links?.Where(x => x.Show == null))?.ToList();
|
||||||
}
|
}
|
||||||
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Collection))]
|
[ExpressionRewrite(nameof(Links), nameof(LibraryLink.Collection))]
|
||||||
public override IEnumerable<Collection> Collections
|
public override ICollection<Collection> Collections
|
||||||
{
|
{
|
||||||
get => Links?.Where(x => x.Collection != null).Select(x => x.Collection);
|
get => Links?.Where(x => x.Collection != null).Select(x => x.Collection).ToList();
|
||||||
set => Links = Utility.MergeLists(
|
set => Links = Utility.MergeLists(
|
||||||
value?.Select(x => new LibraryLink(this, x)),
|
value?.Select(x => new LibraryLink(this, x)),
|
||||||
Links?.Where(x => x.Collection == null))?.ToList();
|
Links?.Where(x => x.Collection == null))?.ToList();
|
||||||
|
@ -8,25 +8,25 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
[EditableRelation] [JsonReadOnly] [NotMergable] public virtual ICollection<GenreLink> GenreLinks { get; set; }
|
[EditableRelation] [JsonReadOnly] [NotMergable] public virtual ICollection<GenreLink> GenreLinks { get; set; }
|
||||||
[ExpressionRewrite(nameof(GenreLinks), nameof(GenreLink.Child))]
|
[ExpressionRewrite(nameof(GenreLinks), nameof(GenreLink.Child))]
|
||||||
public override IEnumerable<Genre> Genres
|
public override ICollection<Genre> Genres
|
||||||
{
|
{
|
||||||
get => GenreLinks?.Select(x => x.Child);
|
get => GenreLinks?.Select(x => x.Child).ToList();
|
||||||
set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList();
|
set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonReadOnly] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
[JsonReadOnly] [NotMergable] public virtual ICollection<LibraryLink> LibraryLinks { get; set; }
|
||||||
[ExpressionRewrite(nameof(LibraryLinks), nameof(LibraryLink.Library))]
|
[ExpressionRewrite(nameof(LibraryLinks), nameof(LibraryLink.Library))]
|
||||||
public override IEnumerable<Library> Libraries
|
public override ICollection<Library> Libraries
|
||||||
{
|
{
|
||||||
get => LibraryLinks?.Select(x => x.Library);
|
get => LibraryLinks?.Select(x => x.Library).ToList();
|
||||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonReadOnly] [NotMergable] public virtual ICollection<CollectionLink> CollectionLinks { get; set; }
|
[JsonReadOnly] [NotMergable] public virtual ICollection<CollectionLink> CollectionLinks { get; set; }
|
||||||
[ExpressionRewrite(nameof(CollectionLinks), nameof(CollectionLink.Parent))]
|
[ExpressionRewrite(nameof(CollectionLinks), nameof(CollectionLink.Parent))]
|
||||||
public override IEnumerable<Collection> Collections
|
public override ICollection<Collection> Collections
|
||||||
{
|
{
|
||||||
get => CollectionLinks?.Select(x => x.Parent);
|
get => CollectionLinks?.Select(x => x.Parent).ToList();
|
||||||
set => CollectionLinks = value?.Select(x => new CollectionLink(x, this)).ToList();
|
set => CollectionLinks = value?.Select(x => new CollectionLink(x, this)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace Kyoo
|
|||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
|
|
||||||
if (debug == null)
|
if (debug == null && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ENVIRONEMENT")))
|
||||||
Console.WriteLine($"Invalid ENVIRONEMENT variable. Supported values are \"debug\" and \"prod\". Ignoring...");
|
Console.WriteLine($"Invalid ENVIRONEMENT variable. Supported values are \"debug\" and \"prod\". Ignoring...");
|
||||||
|
|
||||||
Console.WriteLine($"Running as {Environment.UserName}.");
|
Console.WriteLine($"Running as {Environment.UserName}.");
|
||||||
|
@ -147,7 +147,7 @@ namespace Kyoo
|
|||||||
services.AddScoped<IGenreRepository, GenreRepository>();
|
services.AddScoped<IGenreRepository, GenreRepository>();
|
||||||
services.AddScoped<IProviderRepository, ProviderRepository>();
|
services.AddScoped<IProviderRepository, ProviderRepository>();
|
||||||
|
|
||||||
services.AddScoped<ILibraryManager, LibraryManager>();
|
// services.AddScoped<ILibraryManager, LibraryManager>();
|
||||||
services.AddSingleton<ITranscoder, Transcoder>();
|
services.AddSingleton<ITranscoder, Transcoder>();
|
||||||
services.AddSingleton<IThumbnailsManager, ThumbnailsManager>();
|
services.AddSingleton<IThumbnailsManager, ThumbnailsManager>();
|
||||||
services.AddSingleton<IProviderManager, ProviderManager>();
|
services.AddSingleton<IProviderManager, ProviderManager>();
|
||||||
|
@ -75,9 +75,8 @@ namespace Kyoo.Controllers
|
|||||||
ICollection<Library> libraries = argument == null
|
ICollection<Library> libraries = argument == null
|
||||||
? await libraryManager.GetLibraries()
|
? await libraryManager.GetLibraries()
|
||||||
: new [] { await libraryManager.GetLibrary(argument)};
|
: new [] { await libraryManager.GetLibrary(argument)};
|
||||||
// TODO replace this grotesque way to load the providers.
|
|
||||||
foreach (Library library in libraries)
|
foreach (Library library in libraries)
|
||||||
library.Providers = library.Providers;
|
await libraryManager.Load(library, x => x.Providers);
|
||||||
|
|
||||||
foreach (Library library in libraries)
|
foreach (Library library in libraries)
|
||||||
await Scan(library, episodes, tracks, cancellationToken);
|
await Scan(library, episodes, tracks, cancellationToken);
|
||||||
@ -353,7 +352,7 @@ namespace Kyoo.Controllers
|
|||||||
return episode;
|
return episode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<Track>> GetTracks(Episode episode)
|
private async Task<ICollection<Track>> GetTracks(Episode episode)
|
||||||
{
|
{
|
||||||
episode.Tracks = (await _transcoder.ExtractInfos(episode.Path))
|
episode.Tracks = (await _transcoder.ExtractInfos(episode.Path))
|
||||||
.Where(x => x.Type != StreamType.Font)
|
.Where(x => x.Type != StreamType.Font)
|
||||||
|
@ -100,7 +100,7 @@ namespace Kyoo.Tasks
|
|||||||
{
|
{
|
||||||
// TODO handle external subtites.
|
// TODO handle external subtites.
|
||||||
episode.Tracks = (await _transcoder!.ExtractInfos(episode.Path))
|
episode.Tracks = (await _transcoder!.ExtractInfos(episode.Path))
|
||||||
.Where(x => x.Type != StreamType.Font);
|
.Where(x => x.Type != StreamType.Font).ToArray();
|
||||||
await _library.EditEpisode(episode, false);
|
await _library.EditEpisode(episode, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user