mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-05 22:54:12 -04:00
Reworking the models to use EF
This commit is contained in:
parent
37abbdd5e0
commit
38d6b4fbde
@ -6,21 +6,20 @@ using System.Linq;
|
|||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
{
|
{
|
||||||
public class Collection : IMergable<Collection>
|
public class Collection : IMergable<Collection>
|
||||||
|
|
||||||
{
|
{
|
||||||
[JsonIgnore] public long ID = -1;
|
[JsonIgnore] public long Id { get; set; } = -1;
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Name;
|
public string Name { get; set; }
|
||||||
public string Poster;
|
public string Poster { get; set; }
|
||||||
public string Overview;
|
public string Overview { get; set; }
|
||||||
[JsonIgnore] public string ImgPrimary;
|
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||||
public IEnumerable<Show> Shows;
|
public IEnumerable<Show> Shows;
|
||||||
|
|
||||||
public Collection() { }
|
public Collection() { }
|
||||||
|
|
||||||
public Collection(long id, string slug, string name, string overview, string imgPrimary)
|
public Collection(long id, string slug, string name, string overview, string imgPrimary)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Name = name;
|
Name = name;
|
||||||
Overview = overview;
|
Overview = overview;
|
||||||
@ -45,7 +44,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Collection SetShows(ILibraryManager libraryManager)
|
public Collection SetShows(ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
Shows = libraryManager.GetShowsInCollection(ID);
|
Shows = libraryManager.GetShowsInCollection(Id);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,8 +52,8 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
if (collection == null)
|
if (collection == null)
|
||||||
return this;
|
return this;
|
||||||
if (ID == -1)
|
if (Id == -1)
|
||||||
ID = collection.ID;
|
Id = collection.Id;
|
||||||
if (Slug == null)
|
if (Slug == null)
|
||||||
Slug = collection.Slug;
|
Slug = collection.Slug;
|
||||||
if (Name == null)
|
if (Name == null)
|
||||||
|
@ -5,22 +5,24 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
public class Episode : IMergable<Episode>
|
public class Episode : IMergable<Episode>
|
||||||
{
|
{
|
||||||
[JsonIgnore] public long ID;
|
[JsonIgnore] public long Id { get; set; }
|
||||||
[JsonIgnore] public long ShowID;
|
[JsonIgnore] public long ShowID { get; set; }
|
||||||
[JsonIgnore] public long SeasonID;
|
public virtual Show Show { get; set; }
|
||||||
|
[JsonIgnore] public long SeasonID { get; set; }
|
||||||
|
public virtual Season Season { get; set; }
|
||||||
|
|
||||||
public long SeasonNumber;
|
public long SeasonNumber { get; set; }
|
||||||
public long EpisodeNumber;
|
public long EpisodeNumber { get; set; }
|
||||||
public long AbsoluteNumber;
|
public long AbsoluteNumber { get; set; }
|
||||||
[JsonIgnore] public string Path;
|
[JsonIgnore] public string Path { get; set; }
|
||||||
public string Title;
|
public string Title { get; set; }
|
||||||
public string Overview;
|
public string Overview { get; set; }
|
||||||
public DateTime? ReleaseDate;
|
public DateTime? ReleaseDate { get; set; }
|
||||||
|
|
||||||
public long Runtime; //This runtime variable should be in minutes
|
public long Runtime { get; set; } //This runtime variable should be in minutes
|
||||||
|
|
||||||
[JsonIgnore] public string ImgPrimary;
|
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||||
public string ExternalIDs;
|
public string ExternalIDs { get; set; }
|
||||||
|
|
||||||
public string ShowTitle; //Used in the API response only
|
public string ShowTitle; //Used in the API response only
|
||||||
public string Link; //Used in the API response only
|
public string Link; //Used in the API response only
|
||||||
@ -29,7 +31,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Episode()
|
public Episode()
|
||||||
{
|
{
|
||||||
ID = -1;
|
Id = -1;
|
||||||
ShowID = -1;
|
ShowID = -1;
|
||||||
SeasonID = -1;
|
SeasonID = -1;
|
||||||
SeasonNumber = -1;
|
SeasonNumber = -1;
|
||||||
@ -39,7 +41,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Episode(long seasonNumber, long episodeNumber, long absoluteNumber, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
public Episode(long seasonNumber, long episodeNumber, long absoluteNumber, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
||||||
{
|
{
|
||||||
ID = -1;
|
Id = -1;
|
||||||
ShowID = -1;
|
ShowID = -1;
|
||||||
SeasonID = -1;
|
SeasonID = -1;
|
||||||
SeasonNumber = seasonNumber;
|
SeasonNumber = seasonNumber;
|
||||||
@ -55,7 +57,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Episode(long id, long showID, long seasonID, long seasonNumber, long episodeNumber, long absoluteNumber, string path, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
public Episode(long id, long showID, long seasonID, long seasonNumber, long episodeNumber, long absoluteNumber, string path, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
ShowID = showID;
|
ShowID = showID;
|
||||||
SeasonID = seasonID;
|
SeasonID = seasonID;
|
||||||
SeasonNumber = seasonNumber;
|
SeasonNumber = seasonNumber;
|
||||||
@ -110,8 +112,8 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return this;
|
return this;
|
||||||
if (ID == -1)
|
if (Id == -1)
|
||||||
ID = other.ID;
|
Id = other.Id;
|
||||||
if (ShowID == -1)
|
if (ShowID == -1)
|
||||||
ShowID = other.ShowID;
|
ShowID = other.ShowID;
|
||||||
if (SeasonID == -1)
|
if (SeasonID == -1)
|
||||||
|
@ -4,9 +4,9 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
public class Genre
|
public class Genre
|
||||||
{
|
{
|
||||||
[JsonIgnore] public readonly long ID;
|
[JsonIgnore] public long Id { get; set; }
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Name;
|
public string Name { get; set; }
|
||||||
|
|
||||||
public Genre(string slug, string name)
|
public Genre(string slug, string name)
|
||||||
{
|
{
|
||||||
@ -16,7 +16,7 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Genre(long id, string slug, string name)
|
public Genre(long id, string slug, string name)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
{
|
{
|
||||||
public class Library
|
public class Library
|
||||||
{
|
{
|
||||||
[JsonIgnore] public readonly long ID;
|
[JsonIgnore] public long Id { get; set; }
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Name;
|
public string Name { get; set; }
|
||||||
public string[] Paths;
|
public string[] Paths { get; set; }
|
||||||
public string[] Providers;
|
public string[] Providers { get; set; }
|
||||||
|
|
||||||
|
public Library() { }
|
||||||
|
|
||||||
public Library(long id, string slug, string name, string[] paths, string[] providers)
|
public Library(long id, string slug, string name, string[] paths, string[] providers)
|
||||||
{
|
{
|
||||||
ID = id;
|
Id = id;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Name = name;
|
Name = name;
|
||||||
Paths = paths;
|
Paths = paths;
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
{
|
{
|
||||||
public class People : IMergable<People>
|
public class People : IMergable<People>
|
||||||
{
|
{
|
||||||
[JsonIgnore] public long ID = -1;
|
[JsonIgnore] public long ID { get; set; } = -1;
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Name;
|
public string Name { get; set; }
|
||||||
public string Role; //Dynamic data not stored as it in the database
|
public string Role;//Dynamic data not stored as it in the database
|
||||||
public string Type; //Dynamic data not stored as it in the database ---- Null for now
|
public string Type; //Dynamic data not stored as it in the database ---- Null for now
|
||||||
[JsonIgnore] public string ImgPrimary;
|
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||||
|
public string ExternalIDs { get; set; }
|
||||||
|
|
||||||
public string ExternalIDs;
|
public virtual IEnumerable<PeopleLink> Roles { get; set; }
|
||||||
|
|
||||||
public People() {}
|
public People() {}
|
||||||
|
|
||||||
|
13
Kyoo.Common/Models/PeopleLink.cs
Normal file
13
Kyoo.Common/Models/PeopleLink.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Kyoo.Models
|
||||||
|
{
|
||||||
|
public class PeopleLink
|
||||||
|
{
|
||||||
|
public long ID { get; set; }
|
||||||
|
public long PeopleID { get; set; }
|
||||||
|
public People People { get; set; }
|
||||||
|
public long ShowID { get; set; }
|
||||||
|
public Show Show { get; set; }
|
||||||
|
public string Role { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,24 @@
|
|||||||
using Newtonsoft.Json;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Kyoo.Models
|
namespace Kyoo.Models
|
||||||
{
|
{
|
||||||
public class Season : IMergable<Season>
|
public class Season : IMergable<Season>
|
||||||
{
|
{
|
||||||
[JsonIgnore] public readonly long ID = -1;
|
[JsonIgnore] public long ID { get; set; } = -1;
|
||||||
[JsonIgnore] public long ShowID = -1;
|
[JsonIgnore] public long ShowID { get; set; } = -1;
|
||||||
|
|
||||||
public long SeasonNumber = -1;
|
public long SeasonNumber { get; set; } = -1;
|
||||||
public string Title;
|
public string Title { get; set; }
|
||||||
public string Overview;
|
public string Overview { get; set; }
|
||||||
public long? Year;
|
public long? Year { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public string ImgPrimary;
|
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||||
public string ExternalIDs;
|
public string ExternalIDs { get; set; }
|
||||||
|
|
||||||
|
public virtual Show Show { get; set; }
|
||||||
|
public virtual IEnumerable<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
public Season() { }
|
public Season() { }
|
||||||
|
|
||||||
|
@ -8,34 +8,34 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
public class Show : IMergable<Show>
|
public class Show : IMergable<Show>
|
||||||
{
|
{
|
||||||
[JsonIgnore] public long ID = -1;
|
[JsonIgnore] public long ID { get; set; } = -1;
|
||||||
|
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Title;
|
public string Title { get; set; }
|
||||||
public IEnumerable<string> Aliases;
|
public string[] Aliases { get; set; }
|
||||||
[JsonIgnore] public string Path;
|
[JsonIgnore] public string Path { get; set; }
|
||||||
public string Overview;
|
public string Overview { get; set; }
|
||||||
public IEnumerable<Genre> Genres;
|
public Status? Status { get; set; }
|
||||||
public Status? Status;
|
public string TrailerUrl { get; set; }
|
||||||
public string TrailerUrl;
|
|
||||||
|
|
||||||
public long? StartYear;
|
public long? StartYear { get; set; }
|
||||||
public long? EndYear;
|
public long? EndYear { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public string ImgPrimary;
|
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||||
[JsonIgnore] public string ImgThumb;
|
[JsonIgnore] public string ImgThumb { get; set; }
|
||||||
[JsonIgnore] public string ImgLogo;
|
[JsonIgnore] public string ImgLogo { get; set; }
|
||||||
[JsonIgnore] public string ImgBackdrop;
|
[JsonIgnore] public string ImgBackdrop { get; set; }
|
||||||
|
|
||||||
public string ExternalIDs;
|
public string ExternalIDs { get; set; }
|
||||||
|
|
||||||
//Used in the rest API excusively.
|
|
||||||
public Studio Studio;
|
|
||||||
public IEnumerable<People> Directors;
|
|
||||||
public IEnumerable<People> People;
|
|
||||||
public IEnumerable<Season> Seasons;
|
|
||||||
public bool IsCollection;
|
public bool IsCollection;
|
||||||
|
|
||||||
|
public IEnumerable<Genre> Genres;
|
||||||
|
public virtual Studio Studio { get; set; }
|
||||||
|
public virtual IEnumerable<PeopleLink> People { get; set; }
|
||||||
|
public virtual IEnumerable<Season> Seasons { get; set; }
|
||||||
|
public virtual IEnumerable<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string GetAliases()
|
public string GetAliases()
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ namespace Kyoo.Models
|
|||||||
ID = id;
|
ID = id;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Title = title;
|
Title = title;
|
||||||
Aliases = aliases;
|
Aliases = aliases.ToArray();
|
||||||
Path = path;
|
Path = path;
|
||||||
Overview = overview;
|
Overview = overview;
|
||||||
TrailerUrl = trailerUrl;
|
TrailerUrl = trailerUrl;
|
||||||
@ -72,7 +72,7 @@ namespace Kyoo.Models
|
|||||||
ID = id;
|
ID = id;
|
||||||
Slug = slug;
|
Slug = slug;
|
||||||
Title = title;
|
Title = title;
|
||||||
Aliases = aliases;
|
Aliases = aliases.ToArray();
|
||||||
Path = path;
|
Path = path;
|
||||||
Overview = overview;
|
Overview = overview;
|
||||||
TrailerUrl = trailerUrl;
|
TrailerUrl = trailerUrl;
|
||||||
@ -152,13 +152,13 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public Show SetDirectors(ILibraryManager manager)
|
public Show SetDirectors(ILibraryManager manager)
|
||||||
{
|
{
|
||||||
Directors = manager.GetDirectors(ID);
|
//Directors = manager.GetDirectors(ID);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Show SetPeople(ILibraryManager manager)
|
public Show SetPeople(ILibraryManager manager)
|
||||||
{
|
{
|
||||||
People = manager.GetPeople(ID);
|
//People = manager.GetPeople(ID);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ namespace Kyoo.Models
|
|||||||
if (Aliases == null)
|
if (Aliases == null)
|
||||||
Aliases = other.Aliases;
|
Aliases = other.Aliases;
|
||||||
else
|
else
|
||||||
Aliases = Aliases.Concat(other.Aliases);
|
Aliases = Aliases.Concat(other.Aliases).ToArray();
|
||||||
if (Genres == null)
|
if (Genres == null)
|
||||||
Genres = other.Genres;
|
Genres = other.Genres;
|
||||||
else
|
else
|
||||||
|
@ -4,9 +4,11 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
public class Studio
|
public class Studio
|
||||||
{
|
{
|
||||||
[JsonIgnore] public readonly long ID = -1;
|
[JsonIgnore] public long ID { get; set; } = -1;
|
||||||
public string Slug;
|
public string Slug { get; set; }
|
||||||
public string Name;
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public Studio() { }
|
||||||
|
|
||||||
public Studio(string slug, string name)
|
public Studio(string slug, string name)
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ namespace Kyoo.Models
|
|||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||||
public class Stream
|
public class Stream
|
||||||
{
|
{
|
||||||
public string Title;
|
public string Title { get; set; }
|
||||||
public string Language;
|
public string Language { get; set; }
|
||||||
public string Codec;
|
public string Codec { get; set; }
|
||||||
[MarshalAs(UnmanagedType.I1)] public bool IsDefault;
|
[MarshalAs(UnmanagedType.I1)] public bool isDefault;
|
||||||
[MarshalAs(UnmanagedType.I1)] public bool IsForced;
|
[MarshalAs(UnmanagedType.I1)] public bool isForced;
|
||||||
[JsonIgnore] public string Path;
|
[JsonIgnore] public string Path { get; set; }
|
||||||
[JsonIgnore] public StreamType Type;
|
[JsonIgnore] public StreamType Type { get; set; }
|
||||||
|
|
||||||
public Stream() {}
|
public Stream() {}
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ namespace Kyoo.Models
|
|||||||
Title = title;
|
Title = title;
|
||||||
Language = language;
|
Language = language;
|
||||||
Codec = codec;
|
Codec = codec;
|
||||||
IsDefault = isDefault;
|
this.isDefault = isDefault;
|
||||||
IsForced = isForced;
|
this.isForced = isForced;
|
||||||
Path = path;
|
Path = path;
|
||||||
Type = type;
|
Type = type;
|
||||||
}
|
}
|
||||||
@ -45,8 +45,8 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
Title = stream.Title;
|
Title = stream.Title;
|
||||||
Language = stream.Language;
|
Language = stream.Language;
|
||||||
IsDefault = stream.IsDefault;
|
isDefault = stream.isDefault;
|
||||||
IsForced = stream.IsForced;
|
isForced = stream.isForced;
|
||||||
Codec = stream.Codec;
|
Codec = stream.Codec;
|
||||||
Path = stream.Path;
|
Path = stream.Path;
|
||||||
Type = stream.Type;
|
Type = stream.Type;
|
||||||
@ -56,11 +56,25 @@ namespace Kyoo.Models
|
|||||||
|
|
||||||
public class Track : Stream
|
public class Track : Stream
|
||||||
{
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
[JsonIgnore] public long EpisodeID { get; set; }
|
||||||
|
public bool IsDefault
|
||||||
|
{
|
||||||
|
get => isDefault;
|
||||||
|
set => isDefault = value;
|
||||||
|
}
|
||||||
|
public bool IsForced
|
||||||
|
{
|
||||||
|
get => isForced;
|
||||||
|
set => isForced = value;
|
||||||
|
}
|
||||||
public string DisplayName;
|
public string DisplayName;
|
||||||
public string Link;
|
public string Link;
|
||||||
|
|
||||||
[JsonIgnore] public long EpisodeID;
|
[JsonIgnore] public bool IsExternal { get; set; }
|
||||||
[JsonIgnore] public bool IsExternal;
|
public virtual Episode Episode { get; set; }
|
||||||
|
|
||||||
|
public Track() { }
|
||||||
|
|
||||||
public Track(StreamType type, string title, string language, bool isDefault, bool isForced, string codec, bool isExternal, string path)
|
public Track(StreamType type, string title, string language, bool isDefault, bool isForced, string codec, bool isExternal, string path)
|
||||||
: base(title, language, codec, isDefault, isForced, path, type)
|
: base(title, language, codec, isDefault, isForced, path, type)
|
||||||
|
@ -183,7 +183,7 @@ namespace Kyoo.Controllers
|
|||||||
if (seasonID == -1)
|
if (seasonID == -1)
|
||||||
seasonID = await RegisterSeason(show, seasonNumber, library);
|
seasonID = await RegisterSeason(show, seasonNumber, library);
|
||||||
episode.SeasonID = seasonID;
|
episode.SeasonID = seasonID;
|
||||||
episode.ID = libraryManager.RegisterEpisode(episode);
|
episode.Id = libraryManager.RegisterEpisode(episode);
|
||||||
|
|
||||||
Track[] tracks = await transcoder.GetTrackInfo(episode.Path);
|
Track[] tracks = await transcoder.GetTrackInfo(episode.Path);
|
||||||
int subcount = 0;
|
int subcount = 0;
|
||||||
@ -194,7 +194,7 @@ namespace Kyoo.Controllers
|
|||||||
subcount++;
|
subcount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
track.EpisodeID = episode.ID;
|
track.EpisodeID = episode.Id;
|
||||||
libraryManager.RegisterTrack(track);
|
libraryManager.RegisterTrack(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
foreach (Track track in subtitles)
|
foreach (Track track in subtitles)
|
||||||
{
|
{
|
||||||
track.EpisodeID = episode.ID;
|
track.EpisodeID = episode.Id;
|
||||||
libraryManager.RegisterTrack(track);
|
libraryManager.RegisterTrack(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ namespace Kyoo.Controllers
|
|||||||
string language = sub.Substring(Path.GetDirectoryName(sub).Length + episodeLink.Length + 2, 3);
|
string language = sub.Substring(Path.GetDirectoryName(sub).Length + episodeLink.Length + 2, 3);
|
||||||
bool isDefault = sub.Contains("default");
|
bool isDefault = sub.Contains("default");
|
||||||
bool isForced = sub.Contains("forced");
|
bool isForced = sub.Contains("forced");
|
||||||
Track track = new Track(StreamType.Subtitle, null, language, isDefault, isForced, null, false, sub) { EpisodeID = episode.ID };
|
Track track = new Track(StreamType.Subtitle, null, language, isDefault, isForced, null, false, sub) { EpisodeID = episode.Id };
|
||||||
|
|
||||||
if (Path.GetExtension(sub) == ".ass")
|
if (Path.GetExtension(sub) == ".ass")
|
||||||
track.Codec = "ass";
|
track.Codec = "ass";
|
||||||
|
@ -11,162 +11,13 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
public class LibraryManager : ILibraryManager
|
public class LibraryManager : ILibraryManager
|
||||||
{
|
{
|
||||||
|
private readonly DatabaseContext _database;
|
||||||
private readonly SQLiteConnection sqlConnection;
|
private readonly SQLiteConnection sqlConnection;
|
||||||
|
|
||||||
|
|
||||||
public LibraryManager(IConfiguration configuration)
|
public LibraryManager(DatabaseContext database)
|
||||||
{
|
{
|
||||||
string databasePath = configuration.GetValue<string>("databasePath");
|
_database = database;
|
||||||
|
|
||||||
if (!File.Exists(databasePath))
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Creating the database at {databasePath}.");
|
|
||||||
|
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(databasePath)))
|
|
||||||
Directory.CreateDirectory(databasePath);
|
|
||||||
SQLiteConnection.CreateFile(databasePath);
|
|
||||||
sqlConnection = new SQLiteConnection($"Data Source={databasePath};Version=3");
|
|
||||||
sqlConnection.Open();
|
|
||||||
|
|
||||||
const string createStatement = @"CREATE TABLE shows(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
title TEXT,
|
|
||||||
aliases TEXT,
|
|
||||||
path TEXT UNIQUE,
|
|
||||||
overview TEXT,
|
|
||||||
trailerUrl TEXT,
|
|
||||||
status TEXT,
|
|
||||||
startYear INTEGER,
|
|
||||||
endYear INTEGER,
|
|
||||||
imgPrimary TEXT,
|
|
||||||
imgThumb TEXT,
|
|
||||||
imgLogo TEXT,
|
|
||||||
imgBackdrop TEXT,
|
|
||||||
externalIDs TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE seasons(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
showID INTEGER,
|
|
||||||
seasonNumber INTEGER,
|
|
||||||
title TEXT,
|
|
||||||
overview TEXT,
|
|
||||||
imgPrimary TEXT,
|
|
||||||
year INTEGER,
|
|
||||||
externalIDs TEXT,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE TABLE episodes(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
showID INTEGER,
|
|
||||||
seasonID INTEGER,
|
|
||||||
seasonNumber INTEGER,
|
|
||||||
episodeNumber INTEGER,
|
|
||||||
absoluteNumber INTEGER,
|
|
||||||
path TEXT UNIQUE,
|
|
||||||
title TEXT,
|
|
||||||
overview TEXT,
|
|
||||||
imgPrimary TEXT,
|
|
||||||
releaseDate TEXT,
|
|
||||||
runtime INTEGER,
|
|
||||||
externalIDs TEXT,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(seasonID) REFERENCES seasons(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE TABLE tracks(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
episodeID INTEGER,
|
|
||||||
streamType INTEGER,
|
|
||||||
title TEXT,
|
|
||||||
language TEXT,
|
|
||||||
codec TEXT,
|
|
||||||
isDefault BOOLEAN,
|
|
||||||
isForced BOOLEAN,
|
|
||||||
isExternal BOOLEAN,
|
|
||||||
path TEXT,
|
|
||||||
FOREIGN KEY(episodeID) REFERENCES episodes(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE libraries(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
name TEXT,
|
|
||||||
path TEXT,
|
|
||||||
providers TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE librariesLinks(
|
|
||||||
libraryID INTEGER,
|
|
||||||
showID INTEGER,
|
|
||||||
FOREIGN KEY(libraryID) REFERENCES libraries(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE collections(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
name TEXT,
|
|
||||||
overview TEXT,
|
|
||||||
startYear INTEGER,
|
|
||||||
endYear INTEGER,
|
|
||||||
imgPrimary TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE collectionsLinks(
|
|
||||||
collectionID INTEGER,
|
|
||||||
showID INTEGER,
|
|
||||||
FOREIGN KEY(collectionID) REFERENCES collections(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE studios(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
name TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE studiosLinks(
|
|
||||||
studioID INTEGER,
|
|
||||||
showID INTEGER,
|
|
||||||
FOREIGN KEY(studioID) REFERENCES studios(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE people(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
name TEXT,
|
|
||||||
imgPrimary TEXT,
|
|
||||||
externalIDs TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE peopleLinks(
|
|
||||||
peopleID INTEGER,
|
|
||||||
showID INTEGER,
|
|
||||||
role TEXT,
|
|
||||||
type TEXT,
|
|
||||||
FOREIGN KEY(peopleID) REFERENCES people(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE genres(
|
|
||||||
id INTEGER PRIMARY KEY UNIQUE,
|
|
||||||
slug TEXT UNIQUE,
|
|
||||||
name TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE genresLinks(
|
|
||||||
genreID INTEGER,
|
|
||||||
showID INTEGER,
|
|
||||||
FOREIGN KEY(genreID) REFERENCES genres(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY(showID) REFERENCES shows(id) ON DELETE CASCADE
|
|
||||||
);";
|
|
||||||
|
|
||||||
using SQLiteCommand createCmd = new SQLiteCommand(createStatement, sqlConnection);
|
|
||||||
createCmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sqlConnection = new SQLiteConnection($"Data Source={databasePath};Version=3");
|
|
||||||
sqlConnection.Open();
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.WriteLine("&Sql Database initated.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~LibraryManager()
|
~LibraryManager()
|
||||||
@ -177,17 +28,7 @@ namespace Kyoo.Controllers
|
|||||||
#region Read the database
|
#region Read the database
|
||||||
public IEnumerable<Library> GetLibraries()
|
public IEnumerable<Library> GetLibraries()
|
||||||
{
|
{
|
||||||
const string query = "SELECT * FROM libraries;";
|
return _database.Libraries;
|
||||||
|
|
||||||
using SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection);
|
|
||||||
SQLiteDataReader reader = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
List<Library> libraries = new List<Library>();
|
|
||||||
|
|
||||||
while (reader.Read())
|
|
||||||
libraries.Add(Library.FromReader(reader));
|
|
||||||
|
|
||||||
return libraries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> GetLibrariesPath()
|
public IEnumerable<string> GetLibrariesPath()
|
||||||
@ -836,7 +677,7 @@ namespace Kyoo.Controllers
|
|||||||
Genre existingGenre = GetGenreBySlug(genre.Slug);
|
Genre existingGenre = GetGenreBySlug(genre.Slug);
|
||||||
|
|
||||||
if (existingGenre != null)
|
if (existingGenre != null)
|
||||||
return existingGenre.ID;
|
return existingGenre.Id;
|
||||||
|
|
||||||
string query = "INSERT INTO genres (slug, name) VALUES($slug, $name);";
|
string query = "INSERT INTO genres (slug, name) VALUES($slug, $name);";
|
||||||
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
||||||
@ -957,7 +798,7 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("$libraryID", library.ID);
|
cmd.Parameters.AddWithValue("$libraryID", library.Id);
|
||||||
cmd.Parameters.AddWithValue("$showID", showID);
|
cmd.Parameters.AddWithValue("$showID", showID);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
@ -1166,7 +1007,7 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
using (SQLiteCommand cmd = new SQLiteCommand(query, sqlConnection))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("$episodeID", episode.ID);
|
cmd.Parameters.AddWithValue("$episodeID", episode.Id);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
60
Kyoo/DatabaseContext.cs
Normal file
60
Kyoo/DatabaseContext.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Kyoo.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
namespace Kyoo
|
||||||
|
{
|
||||||
|
public class DatabaseContext : DbContext
|
||||||
|
{
|
||||||
|
public DatabaseContext(DbContextOptions options) : base(options) { }
|
||||||
|
|
||||||
|
public DbSet<Library> Libraries { get; set; }
|
||||||
|
public DbSet<Collection> Collections { get; set; }
|
||||||
|
public DbSet<Show> Shows { get; set; }
|
||||||
|
public DbSet<Season> Seasons { get; set; }
|
||||||
|
public DbSet<Episode> Episodes { get; set; }
|
||||||
|
public DbSet<Track> Tracks { get; set; }
|
||||||
|
public DbSet<Genre> Genres { get; set; }
|
||||||
|
public DbSet<People> Peoples { get; set; }
|
||||||
|
public DbSet<PeopleLink> PeopleLinks { get; set; }
|
||||||
|
public DbSet<Studio> Studios { get; set; }
|
||||||
|
|
||||||
|
private ValueConverter<string[], string> stringArrayConverter = new ValueConverter<string[], string>(
|
||||||
|
arr => string.Join("|", arr),
|
||||||
|
str => str.Split("|", StringSplitOptions.None));
|
||||||
|
|
||||||
|
private ValueComparer<string[]> stringArrayComparer = new ValueComparer<string[]>(
|
||||||
|
(l1, l2) => l1.SequenceEqual(l2),
|
||||||
|
arr => arr.Aggregate(0, (i, s) => s.GetHashCode()));
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Library>().Property(e => e.Paths).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
|
||||||
|
modelBuilder.Entity<Library>().Property(e => e.Providers).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
|
||||||
|
modelBuilder.Entity<Show>().Property(e => e.Aliases).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
|
||||||
|
|
||||||
|
modelBuilder.Entity<PeopleLink>()
|
||||||
|
.HasOne(l => l.Show)
|
||||||
|
.WithMany(s => s.People)
|
||||||
|
.HasForeignKey(l => l.ShowID);
|
||||||
|
|
||||||
|
modelBuilder.Entity<PeopleLink>()
|
||||||
|
.HasOne(l => l.People)
|
||||||
|
.WithMany(p => p.Roles)
|
||||||
|
.HasForeignKey(l => l.PeopleID);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Track>()
|
||||||
|
.Property(t => t.IsDefault)
|
||||||
|
.ValueGeneratedNever();
|
||||||
|
|
||||||
|
modelBuilder.Entity<Track>()
|
||||||
|
.Property(t => t.IsForced)
|
||||||
|
.ValueGeneratedNever();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
Kyoo/HtmlAPI/AuthentificationAPI.cs
Normal file
16
Kyoo/HtmlAPI/AuthentificationAPI.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Kyoo.Controllers
|
||||||
|
{
|
||||||
|
public class AuthentificationAPI : Controller
|
||||||
|
{
|
||||||
|
// [Authorize, HttpGet("/connect/authorize")]
|
||||||
|
// public async Task<IActionResult> Authorize(CancellationToken token)
|
||||||
|
// {
|
||||||
|
// //HttpContext.GetOpenIdConnectResponse()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
@ -30,7 +30,7 @@ namespace Kyoo.Controllers
|
|||||||
if (library == null)
|
if (library == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
return libraryManager.GetShowsInLibrary(library.ID);
|
return libraryManager.GetShowsInLibrary(library.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -50,12 +50,12 @@ namespace Kyoo.Controllers
|
|||||||
public async Task<string> ExtractSubtitle(string showSlug, long seasonNumber, long episodeNumber)
|
public async Task<string> ExtractSubtitle(string showSlug, long seasonNumber, long episodeNumber)
|
||||||
{
|
{
|
||||||
Episode episode = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber);
|
Episode episode = libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber);
|
||||||
libraryManager.ClearSubtitles(episode.ID);
|
libraryManager.ClearSubtitles(episode.Id);
|
||||||
|
|
||||||
Track[] tracks = await transcoder.ExtractSubtitles(episode.Path);
|
Track[] tracks = await transcoder.ExtractSubtitles(episode.Path);
|
||||||
foreach (Track track in tracks)
|
foreach (Track track in tracks)
|
||||||
{
|
{
|
||||||
track.EpisodeID = episode.ID;
|
track.EpisodeID = episode.Id;
|
||||||
libraryManager.RegisterTrack(track);
|
libraryManager.RegisterTrack(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,12 +68,12 @@ namespace Kyoo.Controllers
|
|||||||
List<Episode> episodes = libraryManager.GetEpisodes(showSlug);
|
List<Episode> episodes = libraryManager.GetEpisodes(showSlug);
|
||||||
foreach (Episode episode in episodes)
|
foreach (Episode episode in episodes)
|
||||||
{
|
{
|
||||||
libraryManager.ClearSubtitles(episode.ID);
|
libraryManager.ClearSubtitles(episode.Id);
|
||||||
|
|
||||||
Track[] tracks = await transcoder.ExtractSubtitles(episode.Path);
|
Track[] tracks = await transcoder.ExtractSubtitles(episode.Path);
|
||||||
foreach (Track track in tracks)
|
foreach (Track track in tracks)
|
||||||
{
|
{
|
||||||
track.EpisodeID = episode.ID;
|
track.EpisodeID = episode.Id;
|
||||||
libraryManager.RegisterTrack(track);
|
libraryManager.RegisterTrack(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,22 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="IdentityServer4" Version="3.0.2" />
|
||||||
|
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="3.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.1">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using Kyoo.Controllers;
|
using Kyoo.Controllers;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.SpaServices.AngularCli;
|
using Microsoft.AspNetCore.SpaServices.AngularCli;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
@ -31,16 +33,22 @@ namespace Kyoo
|
|||||||
services.AddControllers().AddNewtonsoftJson();
|
services.AddControllers().AddNewtonsoftJson();
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
|
|
||||||
services.AddSingleton<ILibraryManager, LibraryManager>();
|
services.AddDbContext<DatabaseContext>(options => options.UseSqlite(Configuration.GetConnectionString("Database")));
|
||||||
services.AddSingleton<ITranscoder, Transcoder>();
|
|
||||||
services.AddSingleton<IThumbnailsManager, ThumbnailsManager>();
|
// services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
services.AddSingleton<IProviderManager, ProviderManager>();
|
// .AddEntityFrameworkStores()
|
||||||
services.AddSingleton<ICrawler, Crawler>();
|
// services.AddIdentityServer();
|
||||||
services.AddSingleton<IPluginManager, PluginManager>();
|
|
||||||
|
services.AddScoped<ILibraryManager, LibraryManager>();
|
||||||
|
services.AddScoped<ITranscoder, Transcoder>();
|
||||||
|
services.AddScoped<IThumbnailsManager, ThumbnailsManager>();
|
||||||
|
services.AddScoped<IProviderManager, ProviderManager>();
|
||||||
|
services.AddScoped<ICrawler, Crawler>();
|
||||||
|
services.AddScoped<IPluginManager, PluginManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DatabaseContext database)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
@ -86,6 +94,10 @@ namespace Kyoo
|
|||||||
spa.UseAngularCliServer(npmScript: "start");
|
spa.UseAngularCliServer(npmScript: "start");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
database.Database.EnsureCreated();;
|
||||||
|
// Use the next line if the database is not SQLite (SQLite doesn't support complexe migrations).
|
||||||
|
// database.Database.Migrate();;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"databasePath": "/tmp/database.db",
|
"ConnectionStrings": {
|
||||||
|
"Database": "Data Source=kyoo.db"
|
||||||
|
},
|
||||||
|
|
||||||
"transmuxTempPath": "/tmp/cached/kyoo/transmux",
|
"transmuxTempPath": "/tmp/cached/kyoo/transmux",
|
||||||
"transcodeTempPath": "/tmp/cached/kyoo/transcode",
|
"transcodeTempPath": "/tmp/cached/kyoo/transcode",
|
||||||
"peoplePath": "/tmp/people",
|
"peoplePath": "/tmp/people",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user