Fixing missing external ids for episode registering

This commit is contained in:
Zoe Roux 2021-03-30 22:28:02 +02:00
parent fe68c1f608
commit 4c79514e05
2 changed files with 8 additions and 5 deletions

View File

@ -67,10 +67,7 @@ namespace Kyoo.Controllers
{
string pluginFolder = _config.GetValue<string>("plugins");
if (!Directory.Exists(pluginFolder))
{
Console.WriteLine("\nPlugin directory does not exist. No plugin loaded.\n");
return;
}
Directory.CreateDirectory(pluginFolder);
string[] pluginsPaths = Directory.GetFiles(pluginFolder);
_plugins = pluginsPaths.SelectMany(path =>
@ -78,7 +75,7 @@ namespace Kyoo.Controllers
path = Path.GetFullPath(path);
try
{
PluginDependencyLoader loader = new PluginDependencyLoader(path);
PluginDependencyLoader loader = new(path);
Assembly ass = loader.LoadFromAssemblyPath(path);
return ass.GetTypes()
.Where(x => typeof(IPlugin).IsAssignableFrom(x))

View File

@ -274,7 +274,10 @@ namespace Kyoo.Controllers
{
Show old = await libraryManager.GetShow(x => x.Path == showPath);
if (old != null)
{
await libraryManager.Load(old, x => x.ExternalIDs);
return old;
}
Show show = await _metadataProvider.SearchShow(showTitle, isMovie, library);
show.Path = showPath;
show.People = await _metadataProvider.GetPeople(show, library);
@ -287,7 +290,10 @@ namespace Kyoo.Controllers
{
old = await libraryManager.GetShow(show.Slug);
if (old.Path == showPath)
{
await libraryManager.Load(old, x => x.ExternalIDs);
return old;
}
show.Slug += $"-{show.StartYear}";
await libraryManager.RegisterShow(show);
}