Compare commits

..

No commits in common. "b099da115642458d01cefae55a4c3bc47606f21f" and "be8c6b50ba98347d2d768d56dcdd776afd62306c" have entirely different histories.

4 changed files with 14 additions and 13 deletions

View File

@ -45,14 +45,15 @@ public struct Chapter
if (!Directory.Exists(Path.Join(downloadLocation, parentPublication.folderName)))
return false;
FileInfo[] archives = new DirectoryInfo(Path.Join(downloadLocation, parentPublication.folderName)).GetFiles();
Regex chapterInfoRex = new(@"Ch\.[0-9.]+");
Regex chapterRex = new(@"[0-9]+(\.[0-9]+)?");
Regex infoRex = new(@"(Vol.[0-9]*)?Ch.[0-9]+");
Regex chapterInfoRex = new(@"Ch.[0-9]+");
Regex chapterRex = new(@"[0-9]+");
if (File.Exists(newFilePath))
return true;
string cn = this.chapterNumber;
if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(archive.Name).Value).Value == cn) is { } path)
if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(infoRex.Match(archive.Name).Value).Value).Value == cn) is { } path)
{
File.Move(path.FullName, newFilePath);
return true;

View File

@ -190,9 +190,9 @@ public class MangaDex : Connector
? attributes["volume"]!.GetValue<string>()
: null;
string chapterNum = attributes.ContainsKey("chapter") && attributes["chapter"] is not null
string? chapterNum = attributes.ContainsKey("chapter") && attributes["chapter"] is not null
? attributes["chapter"]!.GetValue<string>()
: "null";
: null;
chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId));
}

View File

@ -159,7 +159,6 @@ public class TaskManager
}
foreach(TrangaTask childTask in removeTask.childTasks)
DeleteTask(childTask);
ExportDataAndSettings();
}
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask mTask)

View File

@ -95,6 +95,8 @@ public abstract class TrangaTask
break;
}
foreach(TrangaTask childTask in this.childTasks.ToArray())
taskManager.DeleteTask(childTask);
if ((int)statusCode >= 200 && (int)statusCode < 300)
{
@ -106,13 +108,12 @@ public abstract class TrangaTask
}
else
{
if (this is DownloadChapterTask && statusCode == HttpStatusCode.NotFound)
this.state = ExecutionState.Success;
else
this.state = ExecutionState.Failed;
this.lastExecuted = DateTime.MaxValue;
}
foreach (TrangaTask childTask in this.childTasks.Where(ct => ct is DownloadChapterTask).ToArray())
taskManager.DeleteTask(childTask);
logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
}