mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-10-31 02:27:11 -04:00 
			
		
		
		
	Basic crawler working
This commit is contained in:
		
							parent
							
								
									5d96452309
								
							
						
					
					
						commit
						2d77ca992b
					
				| @ -11,27 +11,27 @@ namespace Kyoo.Controllers | |||||||
| 		Task<Library> GetLibrary(string slug); | 		Task<Library> GetLibrary(string slug); | ||||||
| 		Task<Collection> GetCollection(string slug); | 		Task<Collection> GetCollection(string slug); | ||||||
| 		Task<Show> GetShow(string slug); | 		Task<Show> GetShow(string slug); | ||||||
| 		Task<Season> GetSeason(string showSlug, long seasonNumber); | 		Task<Season> GetSeason(string showSlug, int seasonNumber); | ||||||
| 		Task<Episode> GetEpisode(string showSlug, long seasonNumber, long episodeNumber); | 		Task<Episode> GetEpisode(string showSlug, int seasonNumber, int episodeNumber); | ||||||
| 		Task<Episode> GetMovieEpisode(string movieSlug); | 		Task<Episode> GetMovieEpisode(string movieSlug); | ||||||
| 		Task<Track> GetTrack(long id); | 		Task<Track> GetTrack(int id); | ||||||
| 		Task<Track> GetTrack(long episodeID, string language, bool isForced); | 		Task<Track> GetTrack(int episodeID, string language, bool isForced); | ||||||
| 		Task<Genre> GetGenre(string slug); | 		Task<Genre> GetGenre(string slug); | ||||||
| 		Task<Studio> GetStudio(string slug); | 		Task<Studio> GetStudio(string slug); | ||||||
| 		Task<People> GetPeople(string slug); | 		Task<People> GetPeople(string slug); | ||||||
| 
 | 
 | ||||||
| 		// Get by relations | 		// Get by relations | ||||||
| 		Task<ICollection<Season>> GetSeasons(long showID); | 		Task<ICollection<Season>> GetSeasons(int showID); | ||||||
| 		Task<ICollection<Season>> GetSeasons(string showSlug); | 		Task<ICollection<Season>> GetSeasons(string showSlug); | ||||||
| 		 | 		 | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(long showID, long seasonNumber); | 		Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber); | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(string showSlug, long seasonNumber); | 		Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber); | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(long seasonID); | 		Task<ICollection<Episode>> GetEpisodes(int seasonID); | ||||||
| 		 | 		 | ||||||
| 		 | 		 | ||||||
| 		// Helpers | 		// Helpers | ||||||
| 		Task<Show> GetShowByPath(string path); | 		Task<Show> GetShowByPath(string path); | ||||||
| 		Task AddShowLink(long showID, long? libraryID, long? collectionID); | 		Task AddShowLink(int showID, int? libraryID, int? collectionID); | ||||||
| 		Task AddShowLink([NotNull] Show show, Library library, Collection collection); | 		Task AddShowLink([NotNull] Show show, Library library, Collection collection); | ||||||
| 		 | 		 | ||||||
| 		// Get all | 		// Get all | ||||||
|  | |||||||
| @ -14,8 +14,8 @@ namespace Kyoo.Controllers | |||||||
| 		Task<IEnumerable<Show>> SearchShows(string showName, bool isMovie); | 		Task<IEnumerable<Show>> SearchShows(string showName, bool isMovie); | ||||||
| 		Task<IEnumerable<PeopleLink>> GetPeople(Show show); | 		Task<IEnumerable<PeopleLink>> GetPeople(Show show); | ||||||
| 
 | 
 | ||||||
| 		Task<Season> GetSeason(Show show, long seasonNumber); | 		Task<Season> GetSeason(Show show, int seasonNumber); | ||||||
| 
 | 
 | ||||||
| 		Task<Episode> GetEpisode(Show show, long seasonNumber, long episodeNumber, long absoluteNumber); | 		Task<Episode> GetEpisode(Show show, int seasonNumber, int episodeNumber, int absoluteNumber); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -10,8 +10,8 @@ namespace Kyoo.Controllers | |||||||
| 		Task<Show> CompleteShow(Show show, Library library); | 		Task<Show> CompleteShow(Show show, Library library); | ||||||
| 		Task<Show> SearchShow(string showName, bool isMovie, Library library); | 		Task<Show> SearchShow(string showName, bool isMovie, Library library); | ||||||
| 		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, long seasonNumber, Library library); | 		Task<Season> GetSeason(Show show, int 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, int seasonNumber, int episodeNumber, int absoluteNumber, Library library); | ||||||
| 		Task<IEnumerable<PeopleLink>> GetPeople(Show show, Library library); | 		Task<IEnumerable<PeopleLink>> GetPeople(Show show, Library library); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -7,12 +7,12 @@ namespace Kyoo.Controllers | |||||||
| { | { | ||||||
| 	public interface IRepository<T> | 	public interface IRepository<T> | ||||||
| 	{ | 	{ | ||||||
| 		Task<T> Get(long id); | 		Task<T> Get(int id); | ||||||
| 		Task<T> Get(string slug); | 		Task<T> Get(string slug); | ||||||
| 		Task<ICollection<T>> Search(string query); | 		Task<ICollection<T>> Search(string query); | ||||||
| 		Task<ICollection<T>> GetAll(); | 		Task<ICollection<T>> GetAll(); | ||||||
| 		Task<long> Create([NotNull] T obj); | 		Task<int> Create([NotNull] T obj); | ||||||
| 		Task<long> CreateIfNotExists([NotNull] T obj); | 		Task<int> CreateIfNotExists([NotNull] T obj); | ||||||
| 		Task Edit([NotNull] T edited, bool resetOld); | 		Task Edit([NotNull] T edited, bool resetOld); | ||||||
| 		Task Delete(T obj); | 		Task Delete(T obj); | ||||||
| 	} | 	} | ||||||
| @ -20,29 +20,29 @@ namespace Kyoo.Controllers | |||||||
| 	public interface IShowRepository : IRepository<Show> | 	public interface IShowRepository : IRepository<Show> | ||||||
| 	{ | 	{ | ||||||
| 		Task<Show> GetByPath(string path); | 		Task<Show> GetByPath(string path); | ||||||
| 		Task AddShowLink(long showID, long? libraryID, long? collectionID); | 		Task AddShowLink(int showID, int? libraryID, int? collectionID); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public interface ISeasonRepository : IRepository<Season> | 	public interface ISeasonRepository : IRepository<Season> | ||||||
| 	{ | 	{ | ||||||
| 		Task<Season> Get(string showSlug, long seasonNumber); | 		Task<Season> Get(string showSlug, int seasonNumber); | ||||||
| 		 | 		 | ||||||
| 		Task<ICollection<Season>> GetSeasons(long showID); | 		Task<ICollection<Season>> GetSeasons(int showID); | ||||||
| 		Task<ICollection<Season>> GetSeasons(string showSlug); | 		Task<ICollection<Season>> GetSeasons(string showSlug); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public interface IEpisodeRepository : IRepository<Episode> | 	public interface IEpisodeRepository : IRepository<Episode> | ||||||
| 	{ | 	{ | ||||||
| 		Task<Episode> Get(string showSlug, long seasonNumber, long episodeNumber); | 		Task<Episode> Get(string showSlug, int seasonNumber, int episodeNumber); | ||||||
| 		 | 		 | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(long showID, long seasonNumber); | 		Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber); | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(string showSlug, long seasonNumber); | 		Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber); | ||||||
| 		Task<ICollection<Episode>> GetEpisodes(long seasonID); | 		Task<ICollection<Episode>> GetEpisodes(int seasonID); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public interface ITrackRepository : IRepository<Track> | 	public interface ITrackRepository : IRepository<Track> | ||||||
| 	{ | 	{ | ||||||
| 		Task<Track> Get(long episodeID, string languageTag, bool isForced); | 		Task<Track> Get(int episodeID, string languageTag, bool isForced); | ||||||
| 	} | 	} | ||||||
| 	public interface ILibraryRepository : IRepository<Library> {} | 	public interface ILibraryRepository : IRepository<Library> {} | ||||||
| 	public interface ICollectionRepository : IRepository<Collection> {} | 	public interface ICollectionRepository : IRepository<Collection> {} | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Collection | 	public class Collection | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long 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 string Poster { get; set; } | 		public string Poster { get; set; } | ||||||
|  | |||||||
| @ -2,10 +2,10 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class CollectionLink | 	public class CollectionLink | ||||||
| 	{ | 	{ | ||||||
| 		public long ID { get; set; } | 		public int ID { get; set; } | ||||||
| 		public long? CollectionID { get; set; } | 		public int? CollectionID { get; set; } | ||||||
| 		public virtual Collection Collection { get; set; } | 		public virtual Collection Collection { get; set; } | ||||||
| 		public long ShowID { get; set; } | 		public int ShowID { get; set; } | ||||||
| 		public virtual Show Show { get; set; } | 		public virtual Show Show { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public CollectionLink() { } | 		public CollectionLink() { } | ||||||
|  | |||||||
| @ -6,21 +6,21 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Episode | 	public class Episode | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		[JsonIgnore] public long ShowID { get; set; } | 		[JsonIgnore] public int ShowID { get; set; } | ||||||
| 		[JsonIgnore] public virtual Show Show { get; set; } | 		[JsonIgnore] public virtual Show Show { get; set; } | ||||||
| 		[JsonIgnore] public long? SeasonID { get; set; } | 		[JsonIgnore] public int? SeasonID { get; set; } | ||||||
| 		[JsonIgnore] public virtual Season Season { get; set; } | 		[JsonIgnore] public virtual Season Season { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public long SeasonNumber { get; set; } | 		public int SeasonNumber { get; set; } | ||||||
| 		public long EpisodeNumber { get; set; } | 		public int EpisodeNumber { get; set; } | ||||||
| 		public long AbsoluteNumber { get; set; } | 		public int AbsoluteNumber { get; set; } | ||||||
| 		[JsonIgnore] public string Path { get; set; } | 		[JsonIgnore] public string Path { get; set; } | ||||||
| 		public string Title { get; set; } | 		public string Title { get; set; } | ||||||
| 		public string Overview { get; set; } | 		public string Overview { get; set; } | ||||||
| 		public DateTime? ReleaseDate { get; set; } | 		public DateTime? ReleaseDate { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public long 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 ImgPrimary { get; set; } | 		[JsonIgnore] public string ImgPrimary { get; set; } | ||||||
| 		public virtual IEnumerable<MetadataID> ExternalIDs { get; set; } | 		public virtual IEnumerable<MetadataID> ExternalIDs { get; set; } | ||||||
| @ -42,13 +42,13 @@ namespace Kyoo.Models | |||||||
| 
 | 
 | ||||||
| 		public Episode() { } | 		public Episode() { } | ||||||
| 
 | 
 | ||||||
| 		public Episode(long seasonNumber,  | 		public Episode(int seasonNumber,  | ||||||
| 			long episodeNumber, | 			int episodeNumber, | ||||||
| 			long absoluteNumber, | 			int absoluteNumber, | ||||||
| 			string title, | 			string title, | ||||||
| 			string overview, | 			string overview, | ||||||
| 			DateTime? releaseDate, | 			DateTime? releaseDate, | ||||||
| 			long runtime, | 			int runtime, | ||||||
| 			string imgPrimary, | 			string imgPrimary, | ||||||
| 			IEnumerable<MetadataID> externalIDs) | 			IEnumerable<MetadataID> externalIDs) | ||||||
| 		{ | 		{ | ||||||
| @ -63,16 +63,16 @@ namespace Kyoo.Models | |||||||
| 			ExternalIDs = externalIDs; | 			ExternalIDs = externalIDs; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Episode(long showID,  | 		public Episode(int showID,  | ||||||
| 			long seasonID, | 			int seasonID, | ||||||
| 			long seasonNumber,  | 			int seasonNumber,  | ||||||
| 			long episodeNumber,  | 			int episodeNumber,  | ||||||
| 			long absoluteNumber,  | 			int absoluteNumber,  | ||||||
| 			string path, | 			string path, | ||||||
| 			string title,  | 			string title,  | ||||||
| 			string overview,  | 			string overview,  | ||||||
| 			DateTime? releaseDate,  | 			DateTime? releaseDate,  | ||||||
| 			long runtime,  | 			int runtime,  | ||||||
| 			string imgPrimary, | 			string imgPrimary, | ||||||
| 			IEnumerable<MetadataID> externalIDs) | 			IEnumerable<MetadataID> externalIDs) | ||||||
| 		{ | 		{ | ||||||
| @ -90,7 +90,7 @@ namespace Kyoo.Models | |||||||
| 			ExternalIDs = externalIDs; | 			ExternalIDs = externalIDs; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public static string GetSlug(string showSlug, long seasonNumber, long episodeNumber) | 		public static string GetSlug(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return showSlug + "-s" + seasonNumber + "e" + episodeNumber; | 			return showSlug + "-s" + seasonNumber + "e" + episodeNumber; | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Genre | 	public class Genre | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long 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; } | ||||||
| 		 | 		 | ||||||
| @ -24,7 +24,7 @@ namespace Kyoo.Models | |||||||
| 			Name = name; | 			Name = name; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Genre(long id, string slug, string name) | 		public Genre(int id, string slug, string name) | ||||||
| 		{ | 		{ | ||||||
| 			ID = id; | 			ID = id; | ||||||
| 			Slug = slug; | 			Slug = slug; | ||||||
|  | |||||||
| @ -2,9 +2,9 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class GenreLink | 	public class GenreLink | ||||||
| 	{ | 	{ | ||||||
| 		public long ShowID { get; set; } | 		public int ShowID { get; set; } | ||||||
| 		public virtual Show Show { get; set; } | 		public virtual Show Show { get; set; } | ||||||
| 		public long GenreID { get; set; } | 		public int GenreID { get; set; } | ||||||
| 		public virtual Genre Genre { get; set; } | 		public virtual Genre Genre { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public GenreLink() {} | 		public GenreLink() {} | ||||||
|  | |||||||
| @ -1,5 +1,4 @@ | |||||||
| using System.Collections; | using System.Collections.Generic; | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; | using System.Linq; | ||||||
| using Kyoo.Models.Attributes; | using Kyoo.Models.Attributes; | ||||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||||
| @ -8,7 +7,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Library | 	public class Library | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long 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 IEnumerable<string> Paths { get; set; } | ||||||
|  | |||||||
| @ -2,12 +2,12 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class LibraryLink | 	public class LibraryLink | ||||||
| 	{ | 	{ | ||||||
| 		public long ID { get; set; } | 		public int ID { get; set; } | ||||||
| 		public long LibraryID { get; set; } | 		public int LibraryID { get; set; } | ||||||
| 		public virtual Library Library { get; set; } | 		public virtual Library Library { get; set; } | ||||||
| 		public long? ShowID { get; set; } | 		public int? ShowID { get; set; } | ||||||
| 		public virtual Show Show { get; set; } | 		public virtual Show Show { get; set; } | ||||||
| 		public long? CollectionID { get; set; } | 		public int? CollectionID { get; set; } | ||||||
| 		public virtual Collection Collection { get; set; } | 		public virtual Collection Collection { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public LibraryLink() { } | 		public LibraryLink() { } | ||||||
|  | |||||||
| @ -4,20 +4,20 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class MetadataID | 	public class MetadataID | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		[JsonIgnore] public long ProviderID { get; set; } | 		[JsonIgnore] public int ProviderID { get; set; } | ||||||
| 		public virtual ProviderID Provider {get; set; } | 		public virtual ProviderID Provider {get; set; } | ||||||
| 		 | 		 | ||||||
| 		[JsonIgnore] public long? ShowID { get; set; }  | 		[JsonIgnore] public int? ShowID { get; set; }  | ||||||
| 		[JsonIgnore] public virtual Show Show { get; set; } | 		[JsonIgnore] public virtual Show Show { get; set; } | ||||||
| 		 | 		 | ||||||
| 		[JsonIgnore] public long? EpisodeID { get; set; }  | 		[JsonIgnore] public int? EpisodeID { get; set; }  | ||||||
| 		[JsonIgnore] public virtual Episode Episode { get; set; } | 		[JsonIgnore] public virtual Episode Episode { get; set; } | ||||||
| 		 | 		 | ||||||
| 		[JsonIgnore] public long? SeasonID { get; set; }  | 		[JsonIgnore] public int? SeasonID { get; set; }  | ||||||
| 		[JsonIgnore] public virtual Season Season { get; set; } | 		[JsonIgnore] public virtual Season Season { get; set; } | ||||||
| 		 | 		 | ||||||
| 		[JsonIgnore] public long? PeopleID { get; set; }  | 		[JsonIgnore] public int? PeopleID { get; set; }  | ||||||
| 		[JsonIgnore] public virtual People People { get; set; } | 		[JsonIgnore] public virtual People People { get; set; } | ||||||
| 		 | 		 | ||||||
| 		public string DataID { get; set; } | 		public string DataID { get; set; } | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class People | 	public class People | ||||||
| 	{ | 	{ | ||||||
| 		public long ID { get; set; } | 		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; } | ||||||
| 		[JsonIgnore] public string ImgPrimary { get; set; } | 		[JsonIgnore] public string ImgPrimary { get; set; } | ||||||
|  | |||||||
| @ -5,8 +5,8 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class PeopleLink | 	public class PeopleLink | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		[JsonIgnore] public long PeopleID { get; set; } | 		[JsonIgnore] public int PeopleID { get; set; } | ||||||
| 		[JsonIgnore] public virtual People People { get; set; } | 		[JsonIgnore] public virtual People People { get; set; } | ||||||
| 		 | 		 | ||||||
| 		public string Slug | 		public string Slug | ||||||
| @ -27,7 +27,7 @@ namespace Kyoo.Models | |||||||
| 			set => People.ExternalIDs = value; | 			set => People.ExternalIDs = value; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		[JsonIgnore] public long ShowID { get; set; } | 		[JsonIgnore] public int ShowID { get; set; } | ||||||
| 		[JsonIgnore] public virtual Show Show { get; set; } | 		[JsonIgnore] public virtual Show Show { get; set; } | ||||||
| 		public string Role { get; set; } | 		public string Role { get; set; } | ||||||
| 		public string Type { get; set; } | 		public string Type { get; set; } | ||||||
|  | |||||||
| @ -4,13 +4,13 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class ProviderID | 	public class ProviderID | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		public string Name { get; set; } | 		public string Name { get; set; } | ||||||
| 		public string Logo { get; set; } | 		public string Logo { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public ProviderID() { } | 		public ProviderID() { } | ||||||
| 
 | 
 | ||||||
| 		public ProviderID(long id, string name, string logo) | 		public ProviderID(int id, string name, string logo) | ||||||
| 		{ | 		{ | ||||||
| 			ID = id; | 			ID = id; | ||||||
| 			Name = name; | 			Name = name; | ||||||
|  | |||||||
| @ -4,10 +4,10 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class ProviderLink | 	public class ProviderLink | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		[JsonIgnore] public long ProviderID { get; set; } | 		[JsonIgnore] public int ProviderID { get; set; } | ||||||
| 		[JsonIgnore] public virtual ProviderID Provider { get; set; } | 		[JsonIgnore] public virtual ProviderID Provider { get; set; } | ||||||
| 		[JsonIgnore] public long? LibraryID { get; set; } | 		[JsonIgnore] public int? LibraryID { get; set; } | ||||||
| 		[JsonIgnore] public virtual Library Library { get; set; } | 		[JsonIgnore] public virtual Library Library { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public ProviderLink() { } | 		public ProviderLink() { } | ||||||
|  | |||||||
| @ -5,15 +5,15 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Season | 	public class Season | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID  { get; set; } | 		[JsonIgnore] public int ID  { get; set; } | ||||||
| 		[JsonIgnore] public long ShowID { get; set; } | 		[JsonIgnore] public int ShowID { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public long SeasonNumber { get; set; } = -1; | 		public int SeasonNumber { get; set; } = -1; | ||||||
| 
 | 
 | ||||||
| 		public string Slug => $"{Show.Slug}-s{SeasonNumber}"; | 		public string Slug => $"{Show.Slug}-s{SeasonNumber}"; | ||||||
| 		public string Title { get; set; } | 		public string Title { get; set; } | ||||||
| 		public string Overview { get; set; } | 		public string Overview { get; set; } | ||||||
| 		public long? Year { get; set; } | 		public int? Year { get; set; } | ||||||
| 
 | 
 | ||||||
| 		[JsonIgnore] public string ImgPrimary { get; set; } | 		[JsonIgnore] public string ImgPrimary { get; set; } | ||||||
| 		public virtual IEnumerable<MetadataID> ExternalIDs { get; set; } | 		public virtual IEnumerable<MetadataID> ExternalIDs { get; set; } | ||||||
| @ -23,11 +23,11 @@ namespace Kyoo.Models | |||||||
| 
 | 
 | ||||||
| 		public Season() { } | 		public Season() { } | ||||||
| 
 | 
 | ||||||
| 		public Season(long showID,  | 		public Season(int showID,  | ||||||
| 			long seasonNumber, | 			int seasonNumber, | ||||||
| 			string title,  | 			string title,  | ||||||
| 			string overview, | 			string overview, | ||||||
| 			long? year, | 			int? year, | ||||||
| 			string imgPrimary, | 			string imgPrimary, | ||||||
| 			IEnumerable<MetadataID> externalIDs) | 			IEnumerable<MetadataID> externalIDs) | ||||||
| 		{ | 		{ | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Show : IOnMerge | 	public class Show : IOnMerge | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] 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; } | ||||||
| @ -17,8 +17,8 @@ namespace Kyoo.Models | |||||||
| 		public Status? Status { get; set; } | 		public Status? Status { get; set; } | ||||||
| 		public string TrailerUrl { get; set; } | 		public string TrailerUrl { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public long? StartYear { get; set; } | 		public int? StartYear { get; set; } | ||||||
| 		public long? EndYear { get; set; } | 		public int? EndYear { get; set; } | ||||||
| 
 | 
 | ||||||
| 		public string Poster { get; set; } | 		public string Poster { get; set; } | ||||||
| 		public string Logo { get; set; } | 		public string Logo { get; set; } | ||||||
| @ -36,7 +36,7 @@ namespace Kyoo.Models | |||||||
| 			set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList(); | 			set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList(); | ||||||
| 		} | 		} | ||||||
| 		[NotMergable] [JsonIgnore] public virtual IEnumerable<GenreLink> GenreLinks { get; set; } | 		[NotMergable] [JsonIgnore] public virtual IEnumerable<GenreLink> GenreLinks { get; set; } | ||||||
| 		[JsonIgnore] public long StudioID { get; set; } | 		[JsonIgnore] public int? StudioID { get; set; } | ||||||
| 		public virtual Studio Studio { get; set; } | 		public virtual Studio Studio { get; set; } | ||||||
| 		[JsonIgnore] public virtual IEnumerable<PeopleLink> People { get; set; } | 		[JsonIgnore] public virtual IEnumerable<PeopleLink> People { get; set; } | ||||||
| 		[JsonIgnore] public virtual IEnumerable<Season> Seasons { get; set; } | 		[JsonIgnore] public virtual IEnumerable<Season> Seasons { get; set; } | ||||||
| @ -51,8 +51,8 @@ namespace Kyoo.Models | |||||||
| 			string trailerUrl, | 			string trailerUrl, | ||||||
| 			IEnumerable<Genre> genres, | 			IEnumerable<Genre> genres, | ||||||
| 			Status? status, | 			Status? status, | ||||||
| 			long? startYear, | 			int? startYear, | ||||||
| 			long? endYear, | 			int? endYear, | ||||||
| 			IEnumerable<MetadataID> externalIDs) | 			IEnumerable<MetadataID> externalIDs) | ||||||
| 		{ | 		{ | ||||||
| 			Slug = slug; | 			Slug = slug; | ||||||
| @ -76,8 +76,8 @@ namespace Kyoo.Models | |||||||
| 			string overview,  | 			string overview,  | ||||||
| 			string trailerUrl, | 			string trailerUrl, | ||||||
| 			Status? status,  | 			Status? status,  | ||||||
| 			long? startYear, | 			int? startYear, | ||||||
| 			long? endYear, | 			int? endYear, | ||||||
| 			string poster, | 			string poster, | ||||||
| 			string logo,  | 			string logo,  | ||||||
| 			string backdrop, | 			string backdrop, | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class Studio | 	public class Studio | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long 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; } | ||||||
| 		 | 		 | ||||||
|  | |||||||
| @ -55,8 +55,8 @@ namespace Kyoo.Models | |||||||
| 
 | 
 | ||||||
| 	public class Track : Stream | 	public class Track : Stream | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public long ID { get; set; } | 		[JsonIgnore] public int ID { get; set; } | ||||||
| 		[JsonIgnore] public long EpisodeID { get; set; } | 		[JsonIgnore] public int EpisodeID { get; set; } | ||||||
| 		public bool IsDefault | 		public bool IsDefault | ||||||
| 		{ | 		{ | ||||||
| 			get => isDefault; | 			get => isDefault; | ||||||
|  | |||||||
| @ -7,12 +7,12 @@ namespace Kyoo.Models | |||||||
| { | { | ||||||
| 	public class WatchItem | 	public class WatchItem | ||||||
| 	{ | 	{ | ||||||
| 		[JsonIgnore] public readonly long EpisodeID = -1; | 		[JsonIgnore] public readonly int EpisodeID = -1; | ||||||
| 
 | 
 | ||||||
| 		public string ShowTitle; | 		public string ShowTitle; | ||||||
| 		public string ShowSlug; | 		public string ShowSlug; | ||||||
| 		public long SeasonNumber; | 		public int SeasonNumber; | ||||||
| 		public long EpisodeNumber; | 		public int EpisodeNumber; | ||||||
| 		public string Title; | 		public string Title; | ||||||
| 		public string Link; | 		public string Link; | ||||||
| 		public DateTime? ReleaseDate; | 		public DateTime? ReleaseDate; | ||||||
| @ -28,11 +28,11 @@ namespace Kyoo.Models | |||||||
| 
 | 
 | ||||||
| 		public WatchItem() { } | 		public WatchItem() { } | ||||||
| 
 | 
 | ||||||
| 		public WatchItem(long episodeID,  | 		public WatchItem(int episodeID,  | ||||||
| 			string showTitle, | 			string showTitle, | ||||||
| 			string showSlug, | 			string showSlug, | ||||||
| 			long seasonNumber, | 			int seasonNumber, | ||||||
| 			long episodeNumber, | 			int episodeNumber, | ||||||
| 			string title,  | 			string title,  | ||||||
| 			DateTime? releaseDate, | 			DateTime? releaseDate, | ||||||
| 			string path) | 			string path) | ||||||
| @ -50,11 +50,11 @@ namespace Kyoo.Models | |||||||
| 			Link = Episode.GetSlug(ShowSlug, seasonNumber, episodeNumber); | 			Link = Episode.GetSlug(ShowSlug, seasonNumber, episodeNumber); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public WatchItem(long episodeID, | 		public WatchItem(int episodeID, | ||||||
| 			string showTitle, | 			string showTitle, | ||||||
| 			string showSlug,  | 			string showSlug,  | ||||||
| 			long seasonNumber,  | 			int seasonNumber,  | ||||||
| 			long episodeNumber,  | 			int episodeNumber,  | ||||||
| 			string title,  | 			string title,  | ||||||
| 			DateTime? releaseDate,  | 			DateTime? releaseDate,  | ||||||
| 			string path,  | 			string path,  | ||||||
|  | |||||||
| @ -18,18 +18,27 @@ namespace Kyoo.Controllers | |||||||
| 		private readonly IPeopleRepository _people; | 		private readonly IPeopleRepository _people; | ||||||
| 		private readonly IProviderRepository _providers; | 		private readonly IProviderRepository _providers; | ||||||
| 		 | 		 | ||||||
| 		public LibraryManager(DatabaseContext database) | 		public LibraryManager(ILibraryRepository libraries,  | ||||||
|  | 			ICollectionRepository collections,  | ||||||
|  | 			IShowRepository shows,  | ||||||
|  | 			ISeasonRepository seasons,  | ||||||
|  | 			IEpisodeRepository episodes, | ||||||
|  | 			ITrackRepository tracks,  | ||||||
|  | 			IGenreRepository genres,  | ||||||
|  | 			IStudioRepository studios, | ||||||
|  | 			IProviderRepository providers,  | ||||||
|  | 			IPeopleRepository people) | ||||||
| 		{ | 		{ | ||||||
| 			_providers = new ProviderRepository(database); | 			_libraries = libraries; | ||||||
| 			_libraries = new LibraryRepository(database, _providers); | 			_collections = collections; | ||||||
| 			_collections = new CollectionRepository(database); | 			_shows = shows; | ||||||
| 			_genres = new GenreRepository(database); | 			_seasons = seasons; | ||||||
| 			_people = new PeopleRepository(database, _providers); | 			_episodes = episodes; | ||||||
| 			_studios = new StudioRepository(database); | 			_tracks = tracks; | ||||||
| 			_shows = new ShowRepository(database, _genres, _people, _studios, _providers); | 			_genres = genres; | ||||||
| 			_seasons = new SeasonRepository(database, _providers); | 			_studios = studios; | ||||||
| 			_episodes = new EpisodeRepository(database, _providers); | 			_providers = providers; | ||||||
| 			_tracks = new TrackRepository(database); | 			_people = people; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<Library> GetLibrary(string slug) | 		public Task<Library> GetLibrary(string slug) | ||||||
| @ -47,12 +56,12 @@ namespace Kyoo.Controllers | |||||||
| 			return _shows.Get(slug); | 			return _shows.Get(slug); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<Season> GetSeason(string showSlug, long seasonNumber) | 		public Task<Season> GetSeason(string showSlug, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return _seasons.Get(showSlug, seasonNumber); | 			return _seasons.Get(showSlug, seasonNumber); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<Episode> GetEpisode(string showSlug, long seasonNumber, long episodeNumber) | 		public Task<Episode> GetEpisode(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return _episodes.Get(showSlug, seasonNumber, episodeNumber); | 			return _episodes.Get(showSlug, seasonNumber, episodeNumber); | ||||||
| 		} | 		} | ||||||
| @ -62,12 +71,12 @@ namespace Kyoo.Controllers | |||||||
| 			return _episodes.Get(movieSlug); | 			return _episodes.Get(movieSlug); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<Track> GetTrack(long id) | 		public Task<Track> GetTrack(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return _tracks.Get(id); | 			return _tracks.Get(id); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task<Track> GetTrack(long episodeID, string language, bool isForced) | 		public Task<Track> GetTrack(int episodeID, string language, bool isForced) | ||||||
| 		{ | 		{ | ||||||
| 			return _tracks.Get(episodeID, language, isForced); | 			return _tracks.Get(episodeID, language, isForced); | ||||||
| 		} | 		} | ||||||
| @ -137,7 +146,7 @@ namespace Kyoo.Controllers | |||||||
| 			return _providers.GetAll(); | 			return _providers.GetAll(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<ICollection<Season>> GetSeasons(long showID) | 		public Task<ICollection<Season>> GetSeasons(int showID) | ||||||
| 		{ | 		{ | ||||||
| 			return _seasons.GetSeasons(showID); | 			return _seasons.GetSeasons(showID); | ||||||
| 		} | 		} | ||||||
| @ -147,17 +156,17 @@ namespace Kyoo.Controllers | |||||||
| 			return _seasons.GetSeasons(showSlug); | 			return _seasons.GetSeasons(showSlug); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<ICollection<Episode>> GetEpisodes(long showID, long seasonNumber) | 		public Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return _episodes.GetEpisodes(showID, seasonNumber); | 			return _episodes.GetEpisodes(showID, seasonNumber); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<ICollection<Episode>> GetEpisodes(string showSlug, long seasonNumber) | 		public Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return _episodes.GetEpisodes(showSlug, seasonNumber); | 			return _episodes.GetEpisodes(showSlug, seasonNumber); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<ICollection<Episode>> GetEpisodes(long seasonID) | 		public Task<ICollection<Episode>> GetEpisodes(int seasonID) | ||||||
| 		{ | 		{ | ||||||
| 			return _episodes.GetEpisodes(seasonID); | 			return _episodes.GetEpisodes(seasonID); | ||||||
| 		} | 		} | ||||||
| @ -167,7 +176,7 @@ namespace Kyoo.Controllers | |||||||
| 			return _shows.GetByPath(path); | 			return _shows.GetByPath(path); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task AddShowLink(long showID, long? libraryID, long? collectionID) | 		public Task AddShowLink(int showID, int? libraryID, int? collectionID) | ||||||
| 		{ | 		{ | ||||||
| 			return _shows.AddShowLink(showID, libraryID, collectionID); | 			return _shows.AddShowLink(showID, libraryID, collectionID); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -113,13 +113,14 @@ namespace Kyoo.Controllers | |||||||
| 			}); | 			}); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<Season> GetSeason(Show show, long seasonNumber, Library library) | 		public async Task<Season> GetSeason(Show show, int seasonNumber, Library library) | ||||||
| 		{ | 		{ | ||||||
| 			Season season = await GetMetadata( | 			Season season = await GetMetadata( | ||||||
| 				provider => provider.GetSeason(show, seasonNumber),  | 				provider => provider.GetSeason(show, seasonNumber),  | ||||||
| 				library,  | 				library,  | ||||||
| 				$"the season {seasonNumber} of {show.Title}"); | 				$"the season {seasonNumber} of {show.Title}"); | ||||||
| 			season.Show = show; | 			season.Show = show; | ||||||
|  | 			season.ShowID = show.ID; | ||||||
| 			season.SeasonNumber = season.SeasonNumber == -1 ? seasonNumber : season.SeasonNumber; | 			season.SeasonNumber = season.SeasonNumber == -1 ? seasonNumber : season.SeasonNumber; | ||||||
| 			season.Title ??= $"Season {season.SeasonNumber}"; | 			season.Title ??= $"Season {season.SeasonNumber}"; | ||||||
| 			return season; | 			return season; | ||||||
| @ -127,9 +128,9 @@ namespace Kyoo.Controllers | |||||||
| 
 | 
 | ||||||
| 		public async Task<Episode> GetEpisode(Show show,  | 		public async Task<Episode> GetEpisode(Show show,  | ||||||
| 			string episodePath, | 			string episodePath, | ||||||
| 			long seasonNumber,  | 			int seasonNumber,  | ||||||
| 			long episodeNumber, | 			int episodeNumber, | ||||||
| 			long absoluteNumber, | 			int absoluteNumber, | ||||||
| 			Library library) | 			Library library) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = await GetMetadata( | 			Episode episode = await GetMetadata( | ||||||
| @ -137,6 +138,7 @@ namespace Kyoo.Controllers | |||||||
| 				library,  | 				library,  | ||||||
| 				"an episode"); | 				"an episode"); | ||||||
| 			episode.Show = show; | 			episode.Show = show; | ||||||
|  | 			episode.ShowID = show.ID; | ||||||
| 			episode.Path = episodePath; | 			episode.Path = episodePath; | ||||||
| 			episode.SeasonNumber = episode.SeasonNumber != -1 ? episode.SeasonNumber : seasonNumber; | 			episode.SeasonNumber = episode.SeasonNumber != -1 ? episode.SeasonNumber : seasonNumber; | ||||||
| 			episode.EpisodeNumber = episode.EpisodeNumber != -1 ? episode.EpisodeNumber : episodeNumber; | 			episode.EpisodeNumber = episode.EpisodeNumber != -1 ? episode.EpisodeNumber : episodeNumber; | ||||||
| @ -155,6 +157,7 @@ namespace Kyoo.Controllers | |||||||
| 				.Select(x => | 				.Select(x => | ||||||
| 				{ | 				{ | ||||||
| 					x.Show = show; | 					x.Show = show; | ||||||
|  | 					x.ShowID = show.ID; | ||||||
| 					return x; | 					return x; | ||||||
| 				}).ToList(); | 				}).ToList(); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ namespace Kyoo.Controllers | |||||||
| 			_database = database; | 			_database = database; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task<Collection> Get(long id) | 		public Task<Collection> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return _database.Collections.FirstOrDefaultAsync(x => x.ID == id); | 			return _database.Collections.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -41,7 +41,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Collections.ToListAsync(); | 			return await _database.Collections.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Collection obj) | 		public async Task<int> Create(Collection obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -51,7 +51,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Collection obj) | 		public async Task<int> CreateIfNotExists(Collection obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
|  | |||||||
| @ -5,22 +5,23 @@ using System.Threading.Tasks; | |||||||
| using Kyoo.Models; | using Kyoo.Models; | ||||||
| using Kyoo.Models.Exceptions; | using Kyoo.Models.Exceptions; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
| 
 | 
 | ||||||
| namespace Kyoo.Controllers | namespace Kyoo.Controllers | ||||||
| { | { | ||||||
| 	public class EpisodeRepository : IEpisodeRepository | 	public class EpisodeRepository : IEpisodeRepository | ||||||
| 	{ | 	{ | ||||||
| 		private readonly DatabaseContext _database; | 		private readonly DatabaseContext _database; | ||||||
| 		private readonly IProviderRepository _providers; | 		private readonly IServiceProvider _serviceProvider; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		public EpisodeRepository(DatabaseContext database, IProviderRepository providers) | 		public EpisodeRepository(DatabaseContext database, IServiceProvider serviceProvider) | ||||||
| 		{ | 		{ | ||||||
| 			_database = database; | 			_database = database; | ||||||
| 			_providers = providers; | 			_serviceProvider = serviceProvider; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Episode> Get(long id) | 		public async Task<Episode> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Episodes.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Episodes.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -32,14 +33,14 @@ namespace Kyoo.Controllers | |||||||
| 			if (sIndex == -1 || eIndex == -1 || eIndex < sIndex) | 			if (sIndex == -1 || eIndex == -1 || eIndex < sIndex) | ||||||
| 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | ||||||
| 			string showSlug = slug.Substring(0, sIndex); | 			string showSlug = slug.Substring(0, sIndex); | ||||||
| 			if (!long.TryParse(slug.Substring(sIndex + 2), out long seasonNumber)) | 			if (!int.TryParse(slug.Substring(sIndex + 2), out int seasonNumber)) | ||||||
| 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | ||||||
| 			if (!long.TryParse(slug.Substring(eIndex + 2), out long episodeNumber)) | 			if (!int.TryParse(slug.Substring(eIndex + 2), out int episodeNumber)) | ||||||
| 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | 				throw new InvalidOperationException("Invalid episode slug. Format: {showSlug}-s{seasonNumber}-e{episodeNumber}"); | ||||||
| 			return Get(showSlug, seasonNumber, episodeNumber); | 			return Get(showSlug, seasonNumber, episodeNumber); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Episode> Get(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<Episode> Get(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Episodes.FirstOrDefaultAsync(x => x.Show.Slug == showSlug  | 			return await _database.Episodes.FirstOrDefaultAsync(x => x.Show.Slug == showSlug  | ||||||
| 			                                                         && x.SeasonNumber == seasonNumber | 			                                                         && x.SeasonNumber == seasonNumber | ||||||
| @ -59,7 +60,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Episodes.ToListAsync(); | 			return await _database.Episodes.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Episode obj) | 		public async Task<int> Create(Episode obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -70,7 +71,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Episode obj) | 		public async Task<int> CreateIfNotExists(Episode obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -104,11 +105,17 @@ namespace Kyoo.Controllers | |||||||
| 			if (obj.ShowID <= 0) | 			if (obj.ShowID <= 0) | ||||||
| 				throw new InvalidOperationException($"Can't store an episode not related to any show (showID: {obj.ShowID})."); | 				throw new InvalidOperationException($"Can't store an episode not related to any show (showID: {obj.ShowID})."); | ||||||
| 
 | 
 | ||||||
| 			obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | 			if (obj.ExternalIDs != null) | ||||||
| 			{ | 			{ | ||||||
| 				x.ProviderID = await _providers.CreateIfNotExists(x.Provider); | 				obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | ||||||
| 				return x; | 				{ | ||||||
| 			}))).ToList(); | 					using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
|  | 					IProviderRepository providers = serviceScope.ServiceProvider.GetService<IProviderRepository>(); | ||||||
|  | 
 | ||||||
|  | 					x.ProviderID = await providers.CreateIfNotExists(x.Provider); | ||||||
|  | 					return x; | ||||||
|  | 				}))).ToList(); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task Delete(Episode obj) | 		public async Task Delete(Episode obj) | ||||||
| @ -117,19 +124,19 @@ namespace Kyoo.Controllers | |||||||
| 			await _database.SaveChangesAsync(); | 			await _database.SaveChangesAsync(); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<ICollection<Episode>> GetEpisodes(long showID, long seasonNumber) | 		public async Task<ICollection<Episode>> GetEpisodes(int showID, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Episodes.Where(x => x.ShowID == showID | 			return await _database.Episodes.Where(x => x.ShowID == showID | ||||||
| 			                                     && x.SeasonNumber == seasonNumber).ToListAsync(); | 			                                     && x.SeasonNumber == seasonNumber).ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<ICollection<Episode>> GetEpisodes(string showSlug, long seasonNumber) | 		public async Task<ICollection<Episode>> GetEpisodes(string showSlug, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Episodes.Where(x => x.Show.Slug == showSlug | 			return await _database.Episodes.Where(x => x.Show.Slug == showSlug | ||||||
| 			                                           && x.SeasonNumber == seasonNumber).ToListAsync(); | 			                                           && x.SeasonNumber == seasonNumber).ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<ICollection<Episode>> GetEpisodes(long seasonID) | 		public async Task<ICollection<Episode>> GetEpisodes(int seasonID) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Episodes.Where(x => x.SeasonID == seasonID).ToListAsync(); | 			return await _database.Episodes.Where(x => x.SeasonID == seasonID).ToListAsync(); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ namespace Kyoo.Controllers | |||||||
| 			_database = database; | 			_database = database; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<Genre> Get(long id) | 		public async Task<Genre> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Genres.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Genres.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -41,7 +41,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Genres.ToListAsync(); | 			return await _database.Genres.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Genre obj) | 		public async Task<int> Create(Genre obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -51,7 +51,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> CreateIfNotExists(Genre obj) | 		public async Task<int> CreateIfNotExists(Genre obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
|  | |||||||
| @ -5,29 +5,30 @@ using System.Threading.Tasks; | |||||||
| using Kyoo.Models; | using Kyoo.Models; | ||||||
| using Kyoo.Models.Exceptions; | using Kyoo.Models.Exceptions; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
| 
 | 
 | ||||||
| namespace Kyoo.Controllers | namespace Kyoo.Controllers | ||||||
| { | { | ||||||
| 	public class LibraryRepository : ILibraryRepository | 	public class LibraryRepository : ILibraryRepository | ||||||
| 	{ | 	{ | ||||||
| 		private readonly DatabaseContext _database; | 		private readonly DatabaseContext _database; | ||||||
| 		private readonly IProviderRepository _providers; | 		private readonly IServiceProvider _serviceProvider; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		public LibraryRepository(DatabaseContext database, IProviderRepository providers) | 		public LibraryRepository(DatabaseContext database, IServiceProvider serviceProvider) | ||||||
| 		{ | 		{ | ||||||
| 			_database = database; | 			_database = database; | ||||||
| 			_providers = providers; | 			_serviceProvider = serviceProvider; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task<Library> Get(long id) | 		public Task<Library> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return _database.Libraries.FirstOrDefaultAsync(x => x.ID == id); | 			return _database.Libraries.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task<Library> Get(string slug) | 		public Task<Library> Get(string slug) | ||||||
| 		{ | 		{ | ||||||
| 			return _database.Libraries.FirstOrDefaultAsync(x => x.Name == slug); | 			return _database.Libraries.FirstOrDefaultAsync(x => x.Slug == slug); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<ICollection<Library>> Search(string query) | 		public async Task<ICollection<Library>> Search(string query) | ||||||
| @ -43,19 +44,19 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Libraries.ToListAsync(); | 			return await _database.Libraries.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Library obj) | 		public async Task<int> Create(Library obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| 
 | 
 | ||||||
| 			obj.Links = null; | 			obj.Links = null; | ||||||
| 			await Validate(obj); | 			await Validate(obj); | ||||||
| 			await _database.Libraries.AddAsync(obj); | 			_database.Entry(obj).State = EntityState.Added; | ||||||
| 			await _database.SaveChangesAsync(); | 			await _database.SaveChangesAsync(); | ||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Library obj) | 		public async Task<int> CreateIfNotExists(Library obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -87,7 +88,10 @@ namespace Kyoo.Controllers | |||||||
| 		{ | 		{ | ||||||
| 			obj.ProviderLinks = (await Task.WhenAll(obj.ProviderLinks.Select(async x => | 			obj.ProviderLinks = (await Task.WhenAll(obj.ProviderLinks.Select(async x => | ||||||
| 			{ | 			{ | ||||||
| 				x.ProviderID = await _providers.CreateIfNotExists(x.Provider); | 				using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
|  | 				IProviderRepository providers = serviceScope.ServiceProvider.GetService<IProviderRepository>(); | ||||||
|  | 				 | ||||||
|  | 				x.ProviderID = await providers.CreateIfNotExists(x.Provider); | ||||||
| 				return x; | 				return x; | ||||||
| 			}))).ToList(); | 			}))).ToList(); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ namespace Kyoo.Controllers | |||||||
| 			_providers = providers; | 			_providers = providers; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<People> Get(long id) | 		public Task<People> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return _database.Peoples.FirstOrDefaultAsync(x => x.ID == id); | 			return _database.Peoples.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -42,7 +42,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Peoples.ToListAsync(); | 			return await _database.Peoples.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(People obj) | 		public async Task<int> Create(People obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -55,7 +55,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> CreateIfNotExists(People obj) | 		public async Task<int> CreateIfNotExists(People obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ namespace Kyoo.Controllers | |||||||
| 			_database = database; | 			_database = database; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<ProviderID> Get(long id) | 		public async Task<ProviderID> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Providers.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Providers.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -41,7 +41,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Providers.ToListAsync(); | 			return await _database.Providers.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(ProviderID obj) | 		public async Task<int> Create(ProviderID obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -51,7 +51,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(ProviderID obj) | 		public async Task<int> CreateIfNotExists(ProviderID obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
|  | |||||||
| @ -5,22 +5,23 @@ using System.Threading.Tasks; | |||||||
| using Kyoo.Models; | using Kyoo.Models; | ||||||
| using Kyoo.Models.Exceptions; | using Kyoo.Models.Exceptions; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
| 
 | 
 | ||||||
| namespace Kyoo.Controllers | namespace Kyoo.Controllers | ||||||
| { | { | ||||||
| 	public class SeasonRepository : ISeasonRepository | 	public class SeasonRepository : ISeasonRepository | ||||||
| 	{ | 	{ | ||||||
| 		private readonly DatabaseContext _database; | 		private readonly DatabaseContext _database; | ||||||
| 		private readonly IProviderRepository _providers; | 		private readonly IServiceProvider _serviceProvider; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		public SeasonRepository(DatabaseContext database, IProviderRepository providers) | 		public SeasonRepository(DatabaseContext database, IServiceProvider serviceProvider) | ||||||
| 		{ | 		{ | ||||||
| 			_database = database; | 			_database = database; | ||||||
| 			_providers = providers; | 			_serviceProvider = serviceProvider; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Season> Get(long id) | 		public async Task<Season> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Seasons.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Seasons.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -31,12 +32,12 @@ namespace Kyoo.Controllers | |||||||
| 			if (index == -1) | 			if (index == -1) | ||||||
| 				throw new InvalidOperationException("Invalid season slug. Format: {showSlug}-s{seasonNumber}"); | 				throw new InvalidOperationException("Invalid season slug. Format: {showSlug}-s{seasonNumber}"); | ||||||
| 			string showSlug = slug.Substring(0, index); | 			string showSlug = slug.Substring(0, index); | ||||||
| 			if (!long.TryParse(slug.Substring(index + 2), out long seasonNumber)) | 			if (!int.TryParse(slug.Substring(index + 2), out int seasonNumber)) | ||||||
| 				throw new InvalidOperationException("Invalid season slug. Format: {showSlug}-s{seasonNumber}"); | 				throw new InvalidOperationException("Invalid season slug. Format: {showSlug}-s{seasonNumber}"); | ||||||
| 			return Get(showSlug, seasonNumber); | 			return Get(showSlug, seasonNumber); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Season> Get(string showSlug, long seasonNumber) | 		public async Task<Season> Get(string showSlug, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Seasons.FirstOrDefaultAsync(x => x.Show.Slug == showSlug  | 			return await _database.Seasons.FirstOrDefaultAsync(x => x.Show.Slug == showSlug  | ||||||
| 			                                                        && x.SeasonNumber == seasonNumber); | 			                                                        && x.SeasonNumber == seasonNumber); | ||||||
| @ -55,7 +56,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Seasons.ToListAsync(); | 			return await _database.Seasons.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Season obj) | 		public async Task<int> Create(Season obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -69,7 +70,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Season obj) | 		public async Task<int> CreateIfNotExists(Season obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -103,11 +104,17 @@ namespace Kyoo.Controllers | |||||||
| 			if (obj.ShowID <= 0) | 			if (obj.ShowID <= 0) | ||||||
| 				throw new InvalidOperationException($"Can't store a season not related to any show (showID: {obj.ShowID})."); | 				throw new InvalidOperationException($"Can't store a season not related to any show (showID: {obj.ShowID})."); | ||||||
| 
 | 
 | ||||||
| 			obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | 			if (obj.ExternalIDs != null) | ||||||
| 			{ | 			{ | ||||||
| 				x.ProviderID = await _providers.CreateIfNotExists(x.Provider); | 				obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | ||||||
| 				return x; | 				{ | ||||||
| 			}))).ToList(); | 					using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
|  | 					IProviderRepository providers = serviceScope.ServiceProvider.GetService<IProviderRepository>(); | ||||||
|  | 					 | ||||||
|  | 					x.ProviderID = await providers.CreateIfNotExists(x.Provider); | ||||||
|  | 					return x; | ||||||
|  | 				}))).ToList(); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task Delete(Season obj) | 		public async Task Delete(Season obj) | ||||||
| @ -116,7 +123,7 @@ namespace Kyoo.Controllers | |||||||
| 			await _database.SaveChangesAsync(); | 			await _database.SaveChangesAsync(); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<ICollection<Season>> GetSeasons(long showID) | 		public async Task<ICollection<Season>> GetSeasons(int showID) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Seasons.Where(x => x.ShowID == showID).ToListAsync(); | 			return await _database.Seasons.Where(x => x.ShowID == showID).ToListAsync(); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -5,31 +5,26 @@ using System.Threading.Tasks; | |||||||
| using Kyoo.Models; | using Kyoo.Models; | ||||||
| using Kyoo.Models.Exceptions; | using Kyoo.Models.Exceptions; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  | using Microsoft.Extensions.DependencyInjection; | ||||||
| 
 | 
 | ||||||
| namespace Kyoo.Controllers | namespace Kyoo.Controllers | ||||||
| { | { | ||||||
| 	public class ShowRepository : IShowRepository | 	public class ShowRepository : IShowRepository | ||||||
| 	{ | 	{ | ||||||
| 		private readonly DatabaseContext _database; | 		private readonly DatabaseContext _database; | ||||||
| 		private readonly IGenreRepository _genres; | 		private readonly IServiceProvider _serviceProvider; | ||||||
| 		private readonly IPeopleRepository _people; | 		private readonly IStudioRepository _studios; | ||||||
| 		private readonly IStudioRepository _studio; |  | ||||||
| 		private readonly IProviderRepository _providers; |  | ||||||
| 
 | 
 | ||||||
| 		public ShowRepository(DatabaseContext database, | 		public ShowRepository(DatabaseContext database, | ||||||
| 			IGenreRepository genres, | 			IServiceProvider serviceProvider,  | ||||||
| 			IPeopleRepository people, | 			IStudioRepository studios) | ||||||
| 			IStudioRepository studio,  |  | ||||||
| 			IProviderRepository providers) |  | ||||||
| 		{ | 		{ | ||||||
| 			_database = database; | 			_database = database; | ||||||
| 			_genres = genres; | 			_serviceProvider = serviceProvider; | ||||||
| 			_people = people; | 			_studios = studios; | ||||||
| 			_studio = studio; |  | ||||||
| 			_providers = providers; |  | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Show> Get(long id) | 		public async Task<Show> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Shows.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Shows.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -58,22 +53,18 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Shows.ToListAsync(); | 			return await _database.Shows.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Show obj) | 		public async Task<int> Create(Show obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| 
 | 
 | ||||||
| 			await Validate(obj); | 			await Validate(obj); | ||||||
| 			 | 			_database.Entry(obj).State = EntityState.Added; | ||||||
| 			obj.Seasons = null; |  | ||||||
| 			obj.Episodes = null; |  | ||||||
| 			 |  | ||||||
| 			await _database.Shows.AddAsync(obj); |  | ||||||
| 			await _database.SaveChangesAsync(); | 			await _database.SaveChangesAsync(); | ||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Show obj) | 		public async Task<int> CreateIfNotExists(Show obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -103,22 +94,44 @@ namespace Kyoo.Controllers | |||||||
| 
 | 
 | ||||||
| 		private async Task Validate(Show obj) | 		private async Task Validate(Show obj) | ||||||
| 		{ | 		{ | ||||||
| 			obj.StudioID = await _studio.CreateIfNotExists(obj.Studio); | 			if (obj.Studio != null) | ||||||
| 			obj.GenreLinks = (await Task.WhenAll(obj.GenreLinks.Select(async x => | 				obj.StudioID = await _studios.CreateIfNotExists(obj.Studio); | ||||||
|  | 			 | ||||||
|  | 			if (obj.GenreLinks != null) | ||||||
| 			{ | 			{ | ||||||
| 				x.GenreID = await _genres.CreateIfNotExists(x.Genre); | 				obj.GenreLinks = (await Task.WhenAll(obj.GenreLinks.Select(async x => | ||||||
| 				return x; | 				{ | ||||||
| 			}))).ToList(); | 					using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
| 			obj.People = (await Task.WhenAll(obj.People.Select(async x => | 					IGenreRepository genres = serviceScope.ServiceProvider.GetService<IGenreRepository>(); | ||||||
|  | 					 | ||||||
|  | 					x.GenreID = await genres.CreateIfNotExists(x.Genre); | ||||||
|  | 					return x; | ||||||
|  | 				}))).ToList(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (obj.People != null) | ||||||
| 			{ | 			{ | ||||||
| 				x.PeopleID = await _people.CreateIfNotExists(x.People); | 				obj.People = (await Task.WhenAll(obj.People.Select(async x => | ||||||
| 				return x; | 				{ | ||||||
| 			}))).ToList(); | 					using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
| 			obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | 					IPeopleRepository people = serviceScope.ServiceProvider.GetService<IPeopleRepository>(); | ||||||
|  | 					 | ||||||
|  | 					x.PeopleID = await people.CreateIfNotExists(x.People); | ||||||
|  | 					return x; | ||||||
|  | 				}))).ToList(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (obj.ExternalIDs != null) | ||||||
| 			{ | 			{ | ||||||
| 				x.ProviderID = await _providers.CreateIfNotExists(x.Provider); | 				obj.ExternalIDs = (await Task.WhenAll(obj.ExternalIDs.Select(async x => | ||||||
| 				return x; | 				{ | ||||||
| 			}))).ToList(); | 					using IServiceScope serviceScope = _serviceProvider.CreateScope(); | ||||||
|  | 					IProviderRepository providers = serviceScope.ServiceProvider.GetService<IProviderRepository>(); | ||||||
|  | 					 | ||||||
|  | 					x.ProviderID = await providers.CreateIfNotExists(x.Provider); | ||||||
|  | 					return x; | ||||||
|  | 				}))).ToList(); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task Delete(Show show) | 		public async Task Delete(Show show) | ||||||
| @ -127,7 +140,7 @@ namespace Kyoo.Controllers | |||||||
| 			await _database.SaveChangesAsync(); | 			await _database.SaveChangesAsync(); | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task AddShowLink(long showID, long? libraryID, long? collectionID) | 		public async Task AddShowLink(int showID, int? libraryID, int? collectionID) | ||||||
| 		{ | 		{ | ||||||
| 			if (collectionID != null) | 			if (collectionID != null) | ||||||
| 			{ | 			{ | ||||||
| @ -147,7 +160,7 @@ namespace Kyoo.Controllers | |||||||
| 					x => x.LibraryID == libraryID && x.CollectionID == collectionID && x.ShowID == null); | 					x => x.LibraryID == libraryID && x.CollectionID == collectionID && x.ShowID == null); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			return Task.CompletedTask; | 			await _database.SaveChangesAsync(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -18,7 +18,7 @@ namespace Kyoo.Controllers | |||||||
| 			_database = database; | 			_database = database; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Studio> Get(long id) | 		public async Task<Studio> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Studios.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Studios.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -41,7 +41,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Studios.ToListAsync(); | 			return await _database.Studios.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Studio obj) | 		public async Task<int> Create(Studio obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -51,7 +51,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<long> CreateIfNotExists(Studio obj) | 		public async Task<int> CreateIfNotExists(Studio obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ namespace Kyoo.Controllers | |||||||
| 			_database = database; | 			_database = database; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public async Task<Track> Get(long id) | 		public async Task<Track> Get(int id) | ||||||
| 		{ | 		{ | ||||||
| 			return await _database.Tracks.FirstOrDefaultAsync(x => x.ID == id); | 			return await _database.Tracks.FirstOrDefaultAsync(x => x.ID == id); | ||||||
| 		} | 		} | ||||||
| @ -27,7 +27,7 @@ namespace Kyoo.Controllers | |||||||
| 			throw new InvalidOperationException("Tracks do not support the get by slug method."); | 			throw new InvalidOperationException("Tracks do not support the get by slug method."); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public Task<Track> Get(long episodeID, string languageTag, bool isForced) | 		public Task<Track> Get(int episodeID, string languageTag, bool isForced) | ||||||
| 		{ | 		{ | ||||||
| 			return _database.Tracks.FirstOrDefaultAsync(x => x.EpisodeID == episodeID | 			return _database.Tracks.FirstOrDefaultAsync(x => x.EpisodeID == episodeID | ||||||
| 			                                                       && x.Language == languageTag | 			                                                       && x.Language == languageTag | ||||||
| @ -44,7 +44,7 @@ namespace Kyoo.Controllers | |||||||
| 			return await _database.Tracks.ToListAsync(); | 			return await _database.Tracks.ToListAsync(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public async Task<long> Create(Track obj) | 		public async Task<int> Create(Track obj) | ||||||
| 		{ | 		{ | ||||||
| 			if (obj == null) | 			if (obj == null) | ||||||
| 				throw new ArgumentNullException(nameof(obj)); | 				throw new ArgumentNullException(nameof(obj)); | ||||||
| @ -58,7 +58,7 @@ namespace Kyoo.Controllers | |||||||
| 			return obj.ID; | 			return obj.ID; | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		public Task<long> CreateIfNotExists(Track obj) | 		public Task<int> CreateIfNotExists(Track obj) | ||||||
| 		{ | 		{ | ||||||
| 			return Create(obj); | 			return Create(obj); | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | |||||||
| namespace Kyoo.Models.DatabaseMigrations.Internal | namespace Kyoo.Models.DatabaseMigrations.Internal | ||||||
| { | { | ||||||
|     [DbContext(typeof(DatabaseContext))] |     [DbContext(typeof(DatabaseContext))] | ||||||
|     [Migration("20200526235513_Initial")] |     [Migration("20200607010830_Initial")] | ||||||
|     partial class Initial |     partial class Initial | ||||||
|     { |     { | ||||||
|         protected override void BuildTargetModel(ModelBuilder modelBuilder) |         protected override void BuildTargetModel(ModelBuilder modelBuilder) | ||||||
| @ -23,9 +23,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Collection", b => |             modelBuilder.Entity("Kyoo.Models.Collection", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -53,16 +53,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.CollectionLink", b => |             modelBuilder.Entity("Kyoo.Models.CollectionLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("CollectionID") |                     b.Property<int?>("CollectionID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -75,16 +75,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Episode", b => |             modelBuilder.Entity("Kyoo.Models.Episode", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("AbsoluteNumber") |                     b.Property<int>("AbsoluteNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("EpisodeNumber") |                     b.Property<int>("EpisodeNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -98,17 +98,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<DateTime?>("ReleaseDate") |                     b.Property<DateTime?>("ReleaseDate") | ||||||
|                         .HasColumnType("timestamp without time zone"); |                         .HasColumnType("timestamp without time zone"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("Runtime") |                     b.Property<int>("Runtime") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("SeasonID") |                     b.Property<int?>("SeasonID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("SeasonNumber") |                     b.Property<int>("SeasonNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -124,9 +124,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Genre", b => |             modelBuilder.Entity("Kyoo.Models.Genre", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -145,11 +145,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.GenreLink", b => |             modelBuilder.Entity("Kyoo.Models.GenreLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("GenreID") |                     b.Property<int>("GenreID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ShowID", "GenreID"); |                     b.HasKey("ShowID", "GenreID"); | ||||||
| 
 | 
 | ||||||
| @ -160,9 +160,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Library", b => |             modelBuilder.Entity("Kyoo.Models.Library", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -184,19 +184,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.LibraryLink", b => |             modelBuilder.Entity("Kyoo.Models.LibraryLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("CollectionID") |                     b.Property<int?>("CollectionID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("LibraryID") |                     b.Property<int>("LibraryID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("ShowID") |                     b.Property<int?>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -211,31 +211,31 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.MetadataID", b => |             modelBuilder.Entity("Kyoo.Models.MetadataID", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("DataID") |                     b.Property<string>("DataID") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("EpisodeID") |                     b.Property<int?>("EpisodeID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Link") |                     b.Property<string>("Link") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("PeopleID") |                     b.Property<int?>("PeopleID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ProviderID") |                     b.Property<int>("ProviderID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("SeasonID") |                     b.Property<int?>("SeasonID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("ShowID") |                     b.Property<int?>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -254,9 +254,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.People", b => |             modelBuilder.Entity("Kyoo.Models.People", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -278,19 +278,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.PeopleLink", b => |             modelBuilder.Entity("Kyoo.Models.PeopleLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("PeopleID") |                     b.Property<int>("PeopleID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Role") |                     b.Property<string>("Role") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Type") |                     b.Property<string>("Type") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -306,9 +306,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.ProviderID", b => |             modelBuilder.Entity("Kyoo.Models.ProviderID", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Logo") |                     b.Property<string>("Logo") | ||||||
| @ -327,16 +327,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.ProviderLink", b => |             modelBuilder.Entity("Kyoo.Models.ProviderLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("LibraryID") |                     b.Property<int?>("LibraryID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ProviderID") |                     b.Property<int>("ProviderID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -349,9 +349,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Season", b => |             modelBuilder.Entity("Kyoo.Models.Season", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -360,17 +360,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Overview") |                     b.Property<string>("Overview") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("SeasonNumber") |                     b.Property<int>("SeasonNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("Year") |                     b.Property<int?>("Year") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -381,9 +381,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Show", b => |             modelBuilder.Entity("Kyoo.Models.Show", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Aliases") |                     b.Property<string>("Aliases") | ||||||
| @ -392,8 +392,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Backdrop") |                     b.Property<string>("Backdrop") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("EndYear") |                     b.Property<int?>("EndYear") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<bool>("IsMovie") |                     b.Property<bool>("IsMovie") | ||||||
|                         .HasColumnType("boolean"); |                         .HasColumnType("boolean"); | ||||||
| @ -413,14 +413,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Slug") |                     b.Property<string>("Slug") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("StartYear") |                     b.Property<int?>("StartYear") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<int?>("Status") |                     b.Property<int?>("Status") | ||||||
|                         .HasColumnType("integer"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("StudioID") |                     b.Property<int?>("StudioID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -440,9 +440,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Studio", b => |             modelBuilder.Entity("Kyoo.Models.Studio", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -461,16 +461,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Track", b => |             modelBuilder.Entity("Kyoo.Models.Track", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Codec") |                     b.Property<string>("Codec") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("EpisodeID") |                     b.Property<int>("EpisodeID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<bool>("IsDefault") |                     b.Property<bool>("IsDefault") | ||||||
|                         .HasColumnType("boolean"); |                         .HasColumnType("boolean"); | ||||||
| @ -12,7 +12,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Collections", |                 name: "Collections", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Name = table.Column<string>(nullable: true), |                     Name = table.Column<string>(nullable: true), | ||||||
| @ -29,7 +29,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Genres", |                 name: "Genres", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Name = table.Column<string>(nullable: true) |                     Name = table.Column<string>(nullable: true) | ||||||
| @ -43,7 +43,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Libraries", |                 name: "Libraries", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Name = table.Column<string>(nullable: true), |                     Name = table.Column<string>(nullable: true), | ||||||
| @ -58,7 +58,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Peoples", |                 name: "Peoples", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Name = table.Column<string>(nullable: true), |                     Name = table.Column<string>(nullable: true), | ||||||
| @ -73,7 +73,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Providers", |                 name: "Providers", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Name = table.Column<string>(nullable: true), |                     Name = table.Column<string>(nullable: true), | ||||||
|                     Logo = table.Column<string>(nullable: true) |                     Logo = table.Column<string>(nullable: true) | ||||||
| @ -87,7 +87,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Studios", |                 name: "Studios", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Name = table.Column<string>(nullable: true) |                     Name = table.Column<string>(nullable: true) | ||||||
| @ -101,10 +101,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "ProviderLinks", |                 name: "ProviderLinks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     ProviderID = table.Column<long>(nullable: false), |                     ProviderID = table.Column<int>(nullable: false), | ||||||
|                     LibraryID = table.Column<long>(nullable: true) |                     LibraryID = table.Column<int>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
|                 { |                 { | ||||||
| @ -127,7 +127,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Shows", |                 name: "Shows", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Slug = table.Column<string>(nullable: true), |                     Slug = table.Column<string>(nullable: true), | ||||||
|                     Title = table.Column<string>(nullable: true), |                     Title = table.Column<string>(nullable: true), | ||||||
| @ -136,13 +136,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     Overview = table.Column<string>(nullable: true), |                     Overview = table.Column<string>(nullable: true), | ||||||
|                     Status = table.Column<int>(nullable: true), |                     Status = table.Column<int>(nullable: true), | ||||||
|                     TrailerUrl = table.Column<string>(nullable: true), |                     TrailerUrl = table.Column<string>(nullable: true), | ||||||
|                     StartYear = table.Column<long>(nullable: true), |                     StartYear = table.Column<int>(nullable: true), | ||||||
|                     EndYear = table.Column<long>(nullable: true), |                     EndYear = table.Column<int>(nullable: true), | ||||||
|                     Poster = table.Column<string>(nullable: true), |                     Poster = table.Column<string>(nullable: true), | ||||||
|                     Logo = table.Column<string>(nullable: true), |                     Logo = table.Column<string>(nullable: true), | ||||||
|                     Backdrop = table.Column<string>(nullable: true), |                     Backdrop = table.Column<string>(nullable: true), | ||||||
|                     IsMovie = table.Column<bool>(nullable: false), |                     IsMovie = table.Column<bool>(nullable: false), | ||||||
|                     StudioID = table.Column<long>(nullable: true) |                     StudioID = table.Column<int>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
|                 { |                 { | ||||||
| @ -159,10 +159,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "CollectionLinks", |                 name: "CollectionLinks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     CollectionID = table.Column<long>(nullable: true), |                     CollectionID = table.Column<int>(nullable: true), | ||||||
|                     ShowID = table.Column<long>(nullable: false) |                     ShowID = table.Column<int>(nullable: false) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
|                 { |                 { | ||||||
| @ -185,8 +185,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "GenreLinks", |                 name: "GenreLinks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ShowID = table.Column<long>(nullable: false), |                     ShowID = table.Column<int>(nullable: false), | ||||||
|                     GenreID = table.Column<long>(nullable: false) |                     GenreID = table.Column<int>(nullable: false) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
|                 { |                 { | ||||||
| @ -209,11 +209,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "LibraryLinks", |                 name: "LibraryLinks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     LibraryID = table.Column<long>(nullable: false), |                     LibraryID = table.Column<int>(nullable: false), | ||||||
|                     ShowID = table.Column<long>(nullable: true), |                     ShowID = table.Column<int>(nullable: true), | ||||||
|                     CollectionID = table.Column<long>(nullable: true) |                     CollectionID = table.Column<int>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
|                 { |                 { | ||||||
| @ -242,10 +242,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "PeopleLinks", |                 name: "PeopleLinks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     PeopleID = table.Column<long>(nullable: false), |                     PeopleID = table.Column<int>(nullable: false), | ||||||
|                     ShowID = table.Column<long>(nullable: false), |                     ShowID = table.Column<int>(nullable: false), | ||||||
|                     Role = table.Column<string>(nullable: true), |                     Role = table.Column<string>(nullable: true), | ||||||
|                     Type = table.Column<string>(nullable: true) |                     Type = table.Column<string>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
| @ -270,13 +270,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Seasons", |                 name: "Seasons", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     ShowID = table.Column<long>(nullable: false), |                     ShowID = table.Column<int>(nullable: false), | ||||||
|                     SeasonNumber = table.Column<long>(nullable: false), |                     SeasonNumber = table.Column<int>(nullable: false), | ||||||
|                     Title = table.Column<string>(nullable: true), |                     Title = table.Column<string>(nullable: true), | ||||||
|                     Overview = table.Column<string>(nullable: true), |                     Overview = table.Column<string>(nullable: true), | ||||||
|                     Year = table.Column<long>(nullable: true), |                     Year = table.Column<int>(nullable: true), | ||||||
|                     ImgPrimary = table.Column<string>(nullable: true) |                     ImgPrimary = table.Column<string>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
| @ -294,18 +294,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Episodes", |                 name: "Episodes", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     ShowID = table.Column<long>(nullable: false), |                     ShowID = table.Column<int>(nullable: false), | ||||||
|                     SeasonID = table.Column<long>(nullable: true), |                     SeasonID = table.Column<int>(nullable: true), | ||||||
|                     SeasonNumber = table.Column<long>(nullable: false), |                     SeasonNumber = table.Column<int>(nullable: false), | ||||||
|                     EpisodeNumber = table.Column<long>(nullable: false), |                     EpisodeNumber = table.Column<int>(nullable: false), | ||||||
|                     AbsoluteNumber = table.Column<long>(nullable: false), |                     AbsoluteNumber = table.Column<int>(nullable: false), | ||||||
|                     Path = table.Column<string>(nullable: true), |                     Path = table.Column<string>(nullable: true), | ||||||
|                     Title = table.Column<string>(nullable: true), |                     Title = table.Column<string>(nullable: true), | ||||||
|                     Overview = table.Column<string>(nullable: true), |                     Overview = table.Column<string>(nullable: true), | ||||||
|                     ReleaseDate = table.Column<DateTime>(nullable: true), |                     ReleaseDate = table.Column<DateTime>(nullable: true), | ||||||
|                     Runtime = table.Column<long>(nullable: false), |                     Runtime = table.Column<int>(nullable: false), | ||||||
|                     ImgPrimary = table.Column<string>(nullable: true) |                     ImgPrimary = table.Column<string>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
|                 constraints: table => |                 constraints: table => | ||||||
| @ -329,13 +329,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "MetadataIds", |                 name: "MetadataIds", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     ProviderID = table.Column<long>(nullable: false), |                     ProviderID = table.Column<int>(nullable: false), | ||||||
|                     ShowID = table.Column<long>(nullable: true), |                     ShowID = table.Column<int>(nullable: true), | ||||||
|                     EpisodeID = table.Column<long>(nullable: true), |                     EpisodeID = table.Column<int>(nullable: true), | ||||||
|                     SeasonID = table.Column<long>(nullable: true), |                     SeasonID = table.Column<int>(nullable: true), | ||||||
|                     PeopleID = table.Column<long>(nullable: true), |                     PeopleID = table.Column<int>(nullable: true), | ||||||
|                     DataID = table.Column<string>(nullable: true), |                     DataID = table.Column<string>(nullable: true), | ||||||
|                     Link = table.Column<string>(nullable: true) |                     Link = table.Column<string>(nullable: true) | ||||||
|                 }, |                 }, | ||||||
| @ -378,14 +378,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                 name: "Tracks", |                 name: "Tracks", | ||||||
|                 columns: table => new |                 columns: table => new | ||||||
|                 { |                 { | ||||||
|                     ID = table.Column<long>(nullable: false) |                     ID = table.Column<int>(nullable: false) | ||||||
|                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), |                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||||||
|                     Title = table.Column<string>(nullable: true), |                     Title = table.Column<string>(nullable: true), | ||||||
|                     Language = table.Column<string>(nullable: true), |                     Language = table.Column<string>(nullable: true), | ||||||
|                     Codec = table.Column<string>(nullable: true), |                     Codec = table.Column<string>(nullable: true), | ||||||
|                     Path = table.Column<string>(nullable: true), |                     Path = table.Column<string>(nullable: true), | ||||||
|                     Type = table.Column<int>(nullable: false), |                     Type = table.Column<int>(nullable: false), | ||||||
|                     EpisodeID = table.Column<long>(nullable: false), |                     EpisodeID = table.Column<int>(nullable: false), | ||||||
|                     IsDefault = table.Column<bool>(nullable: false), |                     IsDefault = table.Column<bool>(nullable: false), | ||||||
|                     IsForced = table.Column<bool>(nullable: false), |                     IsForced = table.Column<bool>(nullable: false), | ||||||
|                     IsExternal = table.Column<bool>(nullable: false) |                     IsExternal = table.Column<bool>(nullable: false) | ||||||
| @ -21,9 +21,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Collection", b => |             modelBuilder.Entity("Kyoo.Models.Collection", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -51,16 +51,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.CollectionLink", b => |             modelBuilder.Entity("Kyoo.Models.CollectionLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("CollectionID") |                     b.Property<int?>("CollectionID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -73,16 +73,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Episode", b => |             modelBuilder.Entity("Kyoo.Models.Episode", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("AbsoluteNumber") |                     b.Property<int>("AbsoluteNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("EpisodeNumber") |                     b.Property<int>("EpisodeNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -96,17 +96,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<DateTime?>("ReleaseDate") |                     b.Property<DateTime?>("ReleaseDate") | ||||||
|                         .HasColumnType("timestamp without time zone"); |                         .HasColumnType("timestamp without time zone"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("Runtime") |                     b.Property<int>("Runtime") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("SeasonID") |                     b.Property<int?>("SeasonID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("SeasonNumber") |                     b.Property<int>("SeasonNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -122,9 +122,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Genre", b => |             modelBuilder.Entity("Kyoo.Models.Genre", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -143,11 +143,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.GenreLink", b => |             modelBuilder.Entity("Kyoo.Models.GenreLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("GenreID") |                     b.Property<int>("GenreID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ShowID", "GenreID"); |                     b.HasKey("ShowID", "GenreID"); | ||||||
| 
 | 
 | ||||||
| @ -158,9 +158,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Library", b => |             modelBuilder.Entity("Kyoo.Models.Library", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -182,19 +182,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.LibraryLink", b => |             modelBuilder.Entity("Kyoo.Models.LibraryLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("CollectionID") |                     b.Property<int?>("CollectionID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("LibraryID") |                     b.Property<int>("LibraryID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("ShowID") |                     b.Property<int?>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -209,31 +209,31 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.MetadataID", b => |             modelBuilder.Entity("Kyoo.Models.MetadataID", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("DataID") |                     b.Property<string>("DataID") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("EpisodeID") |                     b.Property<int?>("EpisodeID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Link") |                     b.Property<string>("Link") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("PeopleID") |                     b.Property<int?>("PeopleID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ProviderID") |                     b.Property<int>("ProviderID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("SeasonID") |                     b.Property<int?>("SeasonID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("ShowID") |                     b.Property<int?>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -252,9 +252,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.People", b => |             modelBuilder.Entity("Kyoo.Models.People", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -276,19 +276,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.PeopleLink", b => |             modelBuilder.Entity("Kyoo.Models.PeopleLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("PeopleID") |                     b.Property<int>("PeopleID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Role") |                     b.Property<string>("Role") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Type") |                     b.Property<string>("Type") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -304,9 +304,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.ProviderID", b => |             modelBuilder.Entity("Kyoo.Models.ProviderID", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Logo") |                     b.Property<string>("Logo") | ||||||
| @ -325,16 +325,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.ProviderLink", b => |             modelBuilder.Entity("Kyoo.Models.ProviderLink", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("LibraryID") |                     b.Property<int?>("LibraryID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ProviderID") |                     b.Property<int>("ProviderID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -347,9 +347,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Season", b => |             modelBuilder.Entity("Kyoo.Models.Season", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("ImgPrimary") |                     b.Property<string>("ImgPrimary") | ||||||
| @ -358,17 +358,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Overview") |                     b.Property<string>("Overview") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("SeasonNumber") |                     b.Property<int>("SeasonNumber") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("ShowID") |                     b.Property<int>("ShowID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("Year") |                     b.Property<int?>("Year") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.HasKey("ID"); |                     b.HasKey("ID"); | ||||||
| 
 | 
 | ||||||
| @ -379,9 +379,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Show", b => |             modelBuilder.Entity("Kyoo.Models.Show", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Aliases") |                     b.Property<string>("Aliases") | ||||||
| @ -390,8 +390,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Backdrop") |                     b.Property<string>("Backdrop") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("EndYear") |                     b.Property<int?>("EndYear") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<bool>("IsMovie") |                     b.Property<bool>("IsMovie") | ||||||
|                         .HasColumnType("boolean"); |                         .HasColumnType("boolean"); | ||||||
| @ -411,14 +411,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
|                     b.Property<string>("Slug") |                     b.Property<string>("Slug") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("StartYear") |                     b.Property<int?>("StartYear") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<int?>("Status") |                     b.Property<int?>("Status") | ||||||
|                         .HasColumnType("integer"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long?>("StudioID") |                     b.Property<int?>("StudioID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Title") |                     b.Property<string>("Title") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| @ -438,9 +438,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Studio", b => |             modelBuilder.Entity("Kyoo.Models.Studio", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Name") |                     b.Property<string>("Name") | ||||||
| @ -459,16 +459,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal | |||||||
| 
 | 
 | ||||||
|             modelBuilder.Entity("Kyoo.Models.Track", b => |             modelBuilder.Entity("Kyoo.Models.Track", b => | ||||||
|                 { |                 { | ||||||
|                     b.Property<long>("ID") |                     b.Property<int>("ID") | ||||||
|                         .ValueGeneratedOnAdd() |                         .ValueGeneratedOnAdd() | ||||||
|                         .HasColumnType("bigint") |                         .HasColumnType("integer") | ||||||
|                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); |                         .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); | ||||||
| 
 | 
 | ||||||
|                     b.Property<string>("Codec") |                     b.Property<string>("Codec") | ||||||
|                         .HasColumnType("text"); |                         .HasColumnType("text"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<long>("EpisodeID") |                     b.Property<int>("EpisodeID") | ||||||
|                         .HasColumnType("bigint"); |                         .HasColumnType("integer"); | ||||||
| 
 | 
 | ||||||
|                     b.Property<bool>("IsDefault") |                     b.Property<bool>("IsDefault") | ||||||
|                         .HasColumnType("boolean"); |                         .HasColumnType("boolean"); | ||||||
|  | |||||||
| @ -137,6 +137,18 @@ namespace Kyoo | |||||||
| 				AllowedOrigins = { new Uri(publicUrl).GetLeftPart(UriPartial.Authority) } | 				AllowedOrigins = { new Uri(publicUrl).GetLeftPart(UriPartial.Authority) } | ||||||
| 			}); | 			}); | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 			services.AddTransient<ILibraryRepository, LibraryRepository>(); | ||||||
|  | 			services.AddTransient<ICollectionRepository, CollectionRepository>(); | ||||||
|  | 			services.AddTransient<IShowRepository, ShowRepository>(); | ||||||
|  | 			services.AddTransient<ISeasonRepository, SeasonRepository>(); | ||||||
|  | 			services.AddTransient<IEpisodeRepository, EpisodeRepository>(); | ||||||
|  | 			services.AddTransient<ITrackRepository, TrackRepository>(); | ||||||
|  | 			services.AddTransient<IPeopleRepository, PeopleRepository>(); | ||||||
|  | 			services.AddTransient<IStudioRepository, StudioRepository>(); | ||||||
|  | 			services.AddTransient<IGenreRepository, GenreRepository>(); | ||||||
|  | 			services.AddTransient<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>(); | ||||||
|  | |||||||
| @ -134,9 +134,9 @@ namespace Kyoo.Controllers | |||||||
| 			string showPath = Path.GetDirectoryName(path); | 			string showPath = Path.GetDirectoryName(path); | ||||||
| 			string collectionName = match.Groups["Collection"]?.Value; | 			string collectionName = match.Groups["Collection"]?.Value; | ||||||
| 			string showName = match.Groups["ShowTitle"].Value; | 			string showName = match.Groups["ShowTitle"].Value; | ||||||
| 			long seasonNumber = long.TryParse(match.Groups["Season"].Value, out long tmp) ? tmp : -1; | 			int seasonNumber = int.TryParse(match.Groups["Season"].Value, out int tmp) ? tmp : -1; | ||||||
| 			long episodeNumber = long.TryParse(match.Groups["Episode"].Value, out tmp) ? tmp : -1; | 			int episodeNumber = int.TryParse(match.Groups["Episode"].Value, out tmp) ? tmp : -1; | ||||||
| 			long absoluteNumber = long.TryParse(match.Groups["Absolute"].Value, out tmp) ? tmp : -1; | 			int absoluteNumber = int.TryParse(match.Groups["Absolute"].Value, out tmp) ? tmp : -1; | ||||||
| 
 | 
 | ||||||
| 			Collection collection = await GetCollection(libraryManager, collectionName, library); | 			Collection collection = await GetCollection(libraryManager, collectionName, library); | ||||||
| 			bool isMovie = seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1; | 			bool isMovie = seasonNumber == -1 && episodeNumber == -1 && absoluteNumber == -1; | ||||||
| @ -188,7 +188,7 @@ namespace Kyoo.Controllers | |||||||
| 
 | 
 | ||||||
| 		private async Task<Season> GetSeason(ILibraryManager libraryManager,  | 		private async Task<Season> GetSeason(ILibraryManager libraryManager,  | ||||||
| 			Show show,  | 			Show show,  | ||||||
| 			long seasonNumber,  | 			int seasonNumber,  | ||||||
| 			Library library) | 			Library library) | ||||||
| 		{ | 		{ | ||||||
| 			if (seasonNumber == -1) | 			if (seasonNumber == -1) | ||||||
| @ -207,8 +207,8 @@ namespace Kyoo.Controllers | |||||||
| 		private async Task<Episode> GetEpisode(ILibraryManager libraryManager,  | 		private async Task<Episode> GetEpisode(ILibraryManager libraryManager,  | ||||||
| 			Show show,  | 			Show show,  | ||||||
| 			Season season, | 			Season season, | ||||||
| 			long episodeNumber, | 			int episodeNumber, | ||||||
| 			long absoluteNumber,  | 			int absoluteNumber,  | ||||||
| 			string episodePath,  | 			string episodePath,  | ||||||
| 			Library library) | 			Library library) | ||||||
| 		{ | 		{ | ||||||
| @ -221,6 +221,7 @@ namespace Kyoo.Controllers | |||||||
| 			 | 			 | ||||||
| 			season ??= await GetSeason(libraryManager, show, episode.SeasonNumber, library); | 			season ??= await GetSeason(libraryManager, show, episode.SeasonNumber, library); | ||||||
| 			episode.Season = season; | 			episode.Season = season; | ||||||
|  | 			episode.SeasonID = season?.ID; | ||||||
| 			if (season == null) | 			if (season == null) | ||||||
| 			{ | 			{ | ||||||
| 				await Console.Error.WriteLineAsync("Error: You don't have any provider that support absolute epiode numbering. Install one and try again."); | 				await Console.Error.WriteLineAsync("Error: You don't have any provider that support absolute epiode numbering. Install one and try again."); | ||||||
| @ -234,7 +235,13 @@ namespace Kyoo.Controllers | |||||||
| 
 | 
 | ||||||
| 		private async Task<Episode> GetMovie(Show show, string episodePath) | 		private async Task<Episode> GetMovie(Show show, string episodePath) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = new Episode {Title = show.Title, Path = episodePath, Show = show}; | 			Episode episode = new Episode | ||||||
|  | 			{ | ||||||
|  | 				Title = show.Title, | ||||||
|  | 				Path = episodePath, | ||||||
|  | 				Show = show, | ||||||
|  | 				ShowID = show.ID | ||||||
|  | 			}; | ||||||
| 			episode.Tracks = await GetTracks(episode); | 			episode.Tracks = await GetTracks(episode); | ||||||
| 			return episode; | 			return episode; | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("{showSlug}/season/{seasonNumber}")] | 		[HttpGet("{showSlug}/season/{seasonNumber}")] | ||||||
| 		[Authorize(Policy="Read")] | 		[Authorize(Policy="Read")] | ||||||
| 		public async Task<ActionResult<IEnumerable<Episode>>> GetEpisodesForSeason(string showSlug, long seasonNumber) | 		public async Task<ActionResult<IEnumerable<Episode>>> GetEpisodesForSeason(string showSlug, int seasonNumber) | ||||||
| 		{ | 		{ | ||||||
| 			IEnumerable<Episode> episodes = await _libraryManager.GetEpisodes(showSlug, seasonNumber); | 			IEnumerable<Episode> episodes = await _libraryManager.GetEpisodes(showSlug, seasonNumber); | ||||||
| 
 | 
 | ||||||
| @ -34,7 +34,7 @@ namespace Kyoo.Api | |||||||
| 		[HttpGet("{showSlug}/season/{seasonNumber}/episode/{episodeNumber}")] | 		[HttpGet("{showSlug}/season/{seasonNumber}/episode/{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Read")] | 		[Authorize(Policy="Read")] | ||||||
| 		[JsonDetailed] | 		[JsonDetailed] | ||||||
| 		public async Task<ActionResult<Episode>> GetEpisode(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<ActionResult<Episode>> GetEpisode(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -41,7 +41,7 @@ namespace Kyoo.Api | |||||||
| 				return BadRequest(new {error = "The library's name must be set and not empty"}); | 				return BadRequest(new {error = "The library's name must be set and not empty"}); | ||||||
| 			if (library.Paths == null || !library.Paths.Any()) | 			if (library.Paths == null || !library.Paths.Any()) | ||||||
| 				return BadRequest(new {error = "The library should have a least one path."}); | 				return BadRequest(new {error = "The library should have a least one path."}); | ||||||
| 			if (_libraryManager.GetLibrary(library.Slug) != null) | 			if (await _libraryManager.GetLibrary(library.Slug) != null) | ||||||
| 				return BadRequest(new {error = "Duplicated library slug"}); | 				return BadRequest(new {error = "Duplicated library slug"}); | ||||||
| 			await _libraryManager.RegisterLibrary(library); | 			await _libraryManager.RegisterLibrary(library); | ||||||
| 			_taskManager.StartTask("scan", library.Slug); | 			_taskManager.StartTask("scan", library.Slug); | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ namespace Kyoo.Api | |||||||
| 				string idString = identifier.IndexOf('-') != -1  | 				string idString = identifier.IndexOf('-') != -1  | ||||||
| 					? identifier.Substring(0, identifier.IndexOf('-'))  | 					? identifier.Substring(0, identifier.IndexOf('-'))  | ||||||
| 					: identifier; | 					: identifier; | ||||||
| 				long.TryParse(idString, out long id); | 				int.TryParse(idString, out int id); | ||||||
| 				subtitle = await _libraryManager.GetTrack(id); | 				subtitle = await _libraryManager.GetTrack(id); | ||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
|  | |||||||
| @ -77,7 +77,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("thumb/{showSlug}-s{seasonNumber}e{episodeNumber}")] | 		[HttpGet("thumb/{showSlug}-s{seasonNumber}e{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Read")] | 		[Authorize(Policy="Read")] | ||||||
| 		public async Task<IActionResult> GetEpisodeThumb(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<IActionResult> GetEpisodeThumb(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			string path = (await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber))?.Path; | 			string path = (await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber))?.Path; | ||||||
| 			if (path == null) | 			if (path == null) | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] | 		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Play")] | 		[Authorize(Policy="Play")] | ||||||
| 		public async Task<IActionResult> Index(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<IActionResult> Index(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | ||||||
| 
 | 
 | ||||||
| @ -38,7 +38,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("transmux/{showSlug}-s{seasonNumber}e{episodeNumber}")] | 		[HttpGet("transmux/{showSlug}-s{seasonNumber}e{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Play")] | 		[Authorize(Policy="Play")] | ||||||
| 		public async Task<IActionResult> Transmux(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<IActionResult> Transmux(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | ||||||
| 
 | 
 | ||||||
| @ -61,7 +61,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("transcode/{showSlug}-s{seasonNumber}e{episodeNumber}")] | 		[HttpGet("transcode/{showSlug}-s{seasonNumber}e{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Play")] | 		[Authorize(Policy="Play")] | ||||||
| 		public async Task<IActionResult> Transcode(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<IActionResult> Transcode(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | 			Episode episode = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ namespace Kyoo.Api | |||||||
| 
 | 
 | ||||||
| 		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] | 		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")] | ||||||
| 		[Authorize(Policy="Read")] | 		[Authorize(Policy="Read")] | ||||||
| 		public async Task<ActionResult<WatchItem>> Index(string showSlug, long seasonNumber, long episodeNumber) | 		public async Task<ActionResult<WatchItem>> Index(string showSlug, int seasonNumber, int episodeNumber) | ||||||
| 		{ | 		{ | ||||||
| 			Episode item = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | 			Episode item = await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user