From f7d79386d34ebcd7c6900b47cbb4e523696bb935 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 12 Jun 2020 03:52:59 +0200 Subject: [PATCH 1/2] Handling years in show names --- Kyoo/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kyoo/appsettings.json b/Kyoo/appsettings.json index a3b4f927..59f1ff47 100644 --- a/Kyoo/appsettings.json +++ b/Kyoo/appsettings.json @@ -28,5 +28,5 @@ "plugins": "plugins/", "defaultPermissions": "read,play,write,admin", "newUserPermissions": "read,play,write,admin", - "regex": "(\\/(?.*)\\/)?.*\\/(?.+?)(( S(?\\d+)E(?\\d+)| (?\\d+)))?\\." + "regex": "(\\/(?.*)\\/)?.*\\/(?.+?)( \\(\\d*\\))?(( S(?\\d+)E(?\\d+)| (?\\d+)))?\\." } From f18de8810b9d9f55543786120718ea507dc3c575 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 12 Jun 2020 04:04:31 +0200 Subject: [PATCH 2/2] Fixing a bug with multiples paths in a library --- Kyoo/Tasks/Crawler.cs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Kyoo/Tasks/Crawler.cs b/Kyoo/Tasks/Crawler.cs index 3a5c8ae9..5b9b2d2f 100644 --- a/Kyoo/Tasks/Crawler.cs +++ b/Kyoo/Tasks/Crawler.cs @@ -72,13 +72,13 @@ namespace Kyoo.Controllers Console.WriteLine("Scan finished!"); } - private Task Scan(Library library, ICollection episodes, CancellationToken cancellationToken) + private async Task Scan(Library library, ICollection episodes, CancellationToken cancellationToken) { Console.WriteLine($"Scanning library {library.Name} at {string.Join(", ", library.Paths)}."); - return Task.WhenAll(library.Paths.Select(async path => + foreach (string path in library.Paths) { if (cancellationToken.IsCancellationRequested) - return Task.CompletedTask; + return; string[] files; try @@ -87,23 +87,23 @@ namespace Kyoo.Controllers } catch (DirectoryNotFoundException) { - await Console.Error.WriteLineAsync($"The library's directory {path} could not be found (library slug: {library.Slug})"); - return Task.CompletedTask; + Console.Error.WriteLine($"The library's directory {path} could not be found (library slug: {library.Slug})"); + return; } catch (PathTooLongException) { - await Console.Error.WriteLineAsync($"The library's directory {path} is too long for this system. (library slug: {library.Slug})"); - return Task.CompletedTask; + Console.Error.WriteLine($"The library's directory {path} is too long for this system. (library slug: {library.Slug})"); + return; } catch (ArgumentException) { - await Console.Error.WriteLineAsync($"The library's directory {path} is invalid. (library slug: {library.Slug})"); - return Task.CompletedTask; + Console.Error.WriteLine($"The library's directory {path} is invalid. (library slug: {library.Slug})"); + return; } catch (UnauthorizedAccessException) { - await Console.Error.WriteLineAsync($"Permission denied: can't access library's directory at {path}. (library slug: {library.Slug})"); - return Task.CompletedTask; + Console.Error.WriteLine($"Permission denied: can't access library's directory at {path}. (library slug: {library.Slug})"); + return; } // return Task.WhenAll(files.Select(file => @@ -114,9 +114,7 @@ namespace Kyoo.Controllers string relativePath = file.Substring(path.Length); /*return*/ await RegisterFile(file, relativePath, library, cancellationToken); }//)); - - return Task.CompletedTask; - })); + }//)); } private async Task RegisterFile(string path, string relativePath, Library library, CancellationToken token)