Compare commits
No commits in common. "b099da115642458d01cefae55a4c3bc47606f21f" and "be8c6b50ba98347d2d768d56dcdd776afd62306c" have entirely different histories.
b099da1156
...
be8c6b50ba
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -159,7 +159,6 @@ public class TaskManager
|
||||
}
|
||||
foreach(TrangaTask childTask in removeTask.childTasks)
|
||||
DeleteTask(childTask);
|
||||
ExportDataAndSettings();
|
||||
}
|
||||
|
||||
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask mTask)
|
||||
|
@ -94,25 +94,26 @@ public abstract class TrangaTask
|
||||
nm.SendNotification("Chapter downloaded", $"{dct.publication.sortName} {dct.chapter.chapterNumber} {dct.chapter.name}");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach(TrangaTask childTask in this.childTasks.ToArray())
|
||||
taskManager.DeleteTask(childTask);
|
||||
|
||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||
{
|
||||
this.lastExecuted = DateTime.Now;
|
||||
if(this is DownloadChapterTask)
|
||||
if (this is DownloadChapterTask)
|
||||
this.state = ExecutionState.Success;
|
||||
else
|
||||
this.state = ExecutionState.Waiting;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.state = ExecutionState.Failed;
|
||||
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}");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user