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

View File

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