Finishing up the tasks

This commit is contained in:
Zoe Roux 2020-04-09 00:03:37 +02:00
parent 221b5afb8b
commit a11c281bcb
4 changed files with 13 additions and 5 deletions

View File

@ -11,7 +11,7 @@
<Company>SDG</Company>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageVersion>1.0.12</PackageVersion>
<PackageVersion>1.0.13</PackageVersion>
</PropertyGroup>
<ItemGroup>

View File

@ -87,7 +87,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}\n\n");
return null;
}
}).Where(x => x != null).ToList();

View File

@ -36,8 +36,15 @@ namespace Kyoo.Controllers
{
(ITask task, string arguments) = _queuedTasks.Dequeue();
_runningTask = task;
try
{
await task.Run(_serviceProvider, _taskToken.Token, arguments);
}
catch (Exception e)
{
Console.Error.WriteLine($"An unhandled exception occured while running the task {task.Name}.\nInner exception: {e.Message}\n\n");
}
}
else
{
await Task.Delay(10, cancellationToken);
@ -106,6 +113,7 @@ namespace Kyoo.Controllers
foreach (ITask task in prerunTasks)
task.Run(_serviceProvider, _taskToken.Token);
foreach (IPlugin plugin in _pluginManager.GetAllPlugins())
if (plugin.Tasks != null)
_tasks.AddRange(plugin.Tasks.Select(x => (x, DateTime.Now + GetTaskDelay(x.Slug))));
}

View File

@ -26,5 +26,5 @@
"profilePicturePath": "users/",
"plugins": "plugins/",
"defaultPermissions": "read,play",
"regex": "(\\/(?<Collection>.*)\\/)?.*\\/(?<ShowTitle>.+?)(( S(?<Season>\\d+)E(?<Episode>\\d+)| (?<Absolute>\\d+)))?\\.",
"regex": "(\\/(?<Collection>.*)\\/)?.*\\/(?<ShowTitle>.+?)(( S(?<Season>\\d+)E(?<Episode>\\d+)| (?<Absolute>\\d+)))?\\."
}