mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Adding a try catch in the crawler
This commit is contained in:
parent
57c5cefaf8
commit
42bf34064a
@ -36,7 +36,14 @@ namespace Kyoo.Controllers
|
||||
if (isRunning)
|
||||
return;
|
||||
isRunning = true;
|
||||
StartAsync(cancellation.Token);
|
||||
try
|
||||
{
|
||||
StartAsync(cancellation.Token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"Unknown exception thrown durring libraries scan.\nException: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
@ -52,7 +59,6 @@ namespace Kyoo.Controllers
|
||||
IEnumerable<Episode> episodes = libraryManager.GetAllEpisodes();
|
||||
IEnumerable<Library> libraries = libraryManager.GetLibraries();
|
||||
|
||||
Debug.WriteLine("&Crawler started");
|
||||
foreach (Episode episode in episodes)
|
||||
{
|
||||
if (!File.Exists(episode.Path))
|
||||
@ -63,7 +69,7 @@ namespace Kyoo.Controllers
|
||||
await Scan(library, cancellationToken);
|
||||
|
||||
isRunning = false;
|
||||
Debug.WriteLine("&Crawler stopped");
|
||||
Console.WriteLine("Scan finished!");
|
||||
}
|
||||
|
||||
private async Task Scan(Library library, CancellationToken cancellationToken)
|
||||
|
@ -56,10 +56,10 @@ namespace Kyoo.Controllers.TranscoderLink
|
||||
}
|
||||
}
|
||||
else
|
||||
tracks = null;
|
||||
tracks = new Track[0];
|
||||
|
||||
free(ptr);
|
||||
Console.WriteLine("&" + tracks?.Length + " tracks got at: " + path);
|
||||
Console.WriteLine(tracks.Length + " tracks got at: " + path);
|
||||
}
|
||||
|
||||
public static void ExtractSubtitles(string path, string outPath, out Track[] tracks)
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Kyoo.Controllers;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Kyoo
|
||||
{
|
||||
@ -13,6 +13,7 @@ namespace Kyoo
|
||||
{
|
||||
IWebHost host = CreateWebHostBuilder(args).Build();
|
||||
|
||||
Console.WriteLine($"Running as: {Environment.UserName}");
|
||||
using (IServiceScope serviceScope = host.Services.CreateScope())
|
||||
{
|
||||
IPluginManager pluginManager = serviceScope.ServiceProvider.GetService<IPluginManager>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user