diff --git a/Kyoo.Common/Kyoo.Common.csproj b/Kyoo.Common/Kyoo.Common.csproj index 1cc85725..131dda1e 100644 --- a/Kyoo.Common/Kyoo.Common.csproj +++ b/Kyoo.Common/Kyoo.Common.csproj @@ -11,7 +11,7 @@ SDG GPL-3.0-or-later true - 1.0.5 + 1.0.6 diff --git a/Kyoo.Common/Models/Collection.cs b/Kyoo.Common/Models/Collection.cs index c2e7a3b1..74d63518 100644 --- a/Kyoo.Common/Models/Collection.cs +++ b/Kyoo.Common/Models/Collection.cs @@ -51,6 +51,8 @@ namespace Kyoo.Models public Collection Merge(Collection collection) { + if (collection == null) + return this; if (ID == -1) ID = collection.ID; if (Slug == null) diff --git a/Kyoo.Common/Models/Episode.cs b/Kyoo.Common/Models/Episode.cs index f650ded4..3ad3aada 100644 --- a/Kyoo.Common/Models/Episode.cs +++ b/Kyoo.Common/Models/Episode.cs @@ -108,6 +108,8 @@ namespace Kyoo.Models public Episode Merge(Episode other) { + if (other == null) + return this; if (ID == -1) ID = other.ID; if (ShowID == -1) diff --git a/Kyoo.Common/Models/Genre.cs b/Kyoo.Common/Models/Genre.cs index 233c9f01..e80fa2c0 100644 --- a/Kyoo.Common/Models/Genre.cs +++ b/Kyoo.Common/Models/Genre.cs @@ -16,7 +16,7 @@ namespace Kyoo.Models public Genre(long id, string slug, string name) { - this.ID = id; + ID = id; Slug = slug; Name = name; } diff --git a/Kyoo.Common/Models/People.cs b/Kyoo.Common/Models/People.cs index 0738c577..4c189f99 100644 --- a/Kyoo.Common/Models/People.cs +++ b/Kyoo.Common/Models/People.cs @@ -57,6 +57,8 @@ namespace Kyoo.Models public People Merge(People other) { + if (other == null) + return this; if (ID == -1) ID = other.ID; if (Slug == null) diff --git a/Kyoo.Common/Models/Season.cs b/Kyoo.Common/Models/Season.cs index 38225c56..5ff2bee5 100644 --- a/Kyoo.Common/Models/Season.cs +++ b/Kyoo.Common/Models/Season.cs @@ -43,6 +43,8 @@ namespace Kyoo.Models public Season Merge(Season other) { + if (other == null) + return this; if (ShowID == -1) ShowID = other.ShowID; if (SeasonNumber == -1) diff --git a/Kyoo.Common/Models/Show.cs b/Kyoo.Common/Models/Show.cs index 53146e49..00cbfafa 100644 --- a/Kyoo.Common/Models/Show.cs +++ b/Kyoo.Common/Models/Show.cs @@ -170,6 +170,8 @@ namespace Kyoo.Models public Show Merge(Show other) { + if (other == null) + return this; if (ID == -1) ID = other.ID; if (Slug == null) diff --git a/Kyoo.Common/Models/Studio.cs b/Kyoo.Common/Models/Studio.cs index 7c45fdc9..48f6d68c 100644 --- a/Kyoo.Common/Models/Studio.cs +++ b/Kyoo.Common/Models/Studio.cs @@ -16,7 +16,7 @@ namespace Kyoo.Models public Studio(long id, string slug, string name) { - this.ID = id; + ID = id; Slug = slug; Name = name; } diff --git a/Kyoo.Common/Models/Track.cs b/Kyoo.Common/Models/Track.cs index f716f0bf..6c403fde 100644 --- a/Kyoo.Common/Models/Track.cs +++ b/Kyoo.Common/Models/Track.cs @@ -94,7 +94,7 @@ namespace Kyoo.Models if (language == "fre") language = "fra"; - DisplayName = CultureInfo.GetCultures(CultureTypes.NeutralCultures).FirstOrDefault(x => x.ThreeLetterISOLanguageName == language)?.DisplayName ?? language; + DisplayName = CultureInfo.GetCultures(CultureTypes.NeutralCultures).FirstOrDefault(x => x.ThreeLetterISOLanguageName == language)?.EnglishName ?? language; Link = "/subtitle/" + episodeSlug + "." + Language; if (IsForced) diff --git a/Kyoo/Controllers/LibraryManager.cs b/Kyoo/Controllers/LibraryManager.cs index 309106b3..0c3003ca 100644 --- a/Kyoo/Controllers/LibraryManager.cs +++ b/Kyoo/Controllers/LibraryManager.cs @@ -18,10 +18,9 @@ namespace Kyoo.Controllers { string databasePath = configuration.GetValue("databasePath"); - Debug.WriteLine("&Library Manager init, databasePath: " + databasePath); if (!File.Exists(databasePath)) { - Debug.WriteLine("&Database doesn't exist, creating one."); + Console.WriteLine($"Creating the database at {databasePath}."); if (!Directory.Exists(Path.GetDirectoryName(databasePath))) Directory.CreateDirectory(databasePath); diff --git a/Kyoo/Controllers/PluginManager.cs b/Kyoo/Controllers/PluginManager.cs index c93b7083..3c41fa0e 100644 --- a/Kyoo/Controllers/PluginManager.cs +++ b/Kyoo/Controllers/PluginManager.cs @@ -22,13 +22,17 @@ namespace Kyoo.Controllers } public T GetPlugin(string name) - { + { + if (plugins == null) + return default; return (T)(from plugin in plugins where plugin.Name == name && plugin is T select plugin).FirstOrDefault(); } public IEnumerable GetPlugins() - { + { + if (plugins == null) + return null; return from plugin in plugins where plugin is T select (T)plugin; } @@ -52,7 +56,7 @@ namespace Kyoo.Controllers } catch (Exception ex) { - Console.Error.WriteLine($"Error loading the plugin at ${path}.\nException: {ex.Message}"); + Console.Error.WriteLine($"Error loading the plugin at {path}.\nException: {ex.Message}"); return null; } }).Where(x => x != null).ToList(); diff --git a/Kyoo/Controllers/ProviderManager.cs b/Kyoo/Controllers/ProviderManager.cs index c05e5ec1..bf743f50 100644 --- a/Kyoo/Controllers/ProviderManager.cs +++ b/Kyoo/Controllers/ProviderManager.cs @@ -29,7 +29,7 @@ namespace Kyoo.Controllers if (library.Providers.Contains(provider.Name)) ret = ret.Merge(await providerCall(provider)); } catch (Exception ex) { - Console.Error.WriteLine($"The provider {provider.Name} coudln't work for {what}. (Excepetion: {ex.Message}"); + Console.Error.WriteLine($"The provider {provider.Name} coudln't work for {what}. (Exception: {ex.Message}"); } } return ret; @@ -66,19 +66,19 @@ namespace Kyoo.Controllers public async Task GetSeason(Show show, long seasonNumber, Library library) { - return await GetMetadata(provider => provider.GetSeason(show, seasonNumber), library, $"the season ${seasonNumber} of {show.Title}"); + return await GetMetadata(provider => provider.GetSeason(show, seasonNumber), library, $"the season {seasonNumber} of {show.Title}"); } public async Task GetEpisode(Show show, long seasonNumber, long episodeNumber, long absoluteNumber, Library library) { - Episode episode = await GetMetadata(provider => provider.GetEpisode(show, seasonNumber, episodeNumber, absoluteNumber), library, $"an episode"); + Episode episode = await GetMetadata(provider => provider.GetEpisode(show, seasonNumber, episodeNumber, absoluteNumber), library, "an episode"); await thumbnailsManager.Validate(episode); return episode; } public async Task> GetPeople(Show show, Library library) { - IEnumerable people = await GetMetadata(provider => provider.GetPeople(show), library, $"unknown data"); + IEnumerable people = await GetMetadata(provider => provider.GetPeople(show), library, "unknown data"); people = await thumbnailsManager.Validate(people); return people; } diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 09b88261..d5ffa11a 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -17,6 +17,7 @@ + diff --git a/transcoder b/transcoder index d8f72ff8..bedf98f8 160000 --- a/transcoder +++ b/transcoder @@ -1 +1 @@ -Subproject commit d8f72ff87020f2d38a4552f6083ef0659bf1f2be +Subproject commit bedf98f85d2cf669a1d1c4af35271841133cfec2