Compare commits
4 Commits
be8c6b50ba
...
b099da1156
Author | SHA1 | Date | |
---|---|---|---|
b099da1156 | |||
01d1f922c2 | |||
47a80d67a8 | |||
16e3549455 |
@ -45,15 +45,14 @@ public struct Chapter
|
||||
if (!Directory.Exists(Path.Join(downloadLocation, parentPublication.folderName)))
|
||||
return false;
|
||||
FileInfo[] archives = new DirectoryInfo(Path.Join(downloadLocation, parentPublication.folderName)).GetFiles();
|
||||
Regex infoRex = new(@"(Vol.[0-9]*)?Ch.[0-9]+");
|
||||
Regex chapterInfoRex = new(@"Ch.[0-9]+");
|
||||
Regex chapterRex = new(@"[0-9]+");
|
||||
Regex chapterInfoRex = new(@"Ch\.[0-9.]+");
|
||||
Regex chapterRex = new(@"[0-9]+(\.[0-9]+)?");
|
||||
|
||||
if (File.Exists(newFilePath))
|
||||
return true;
|
||||
|
||||
string cn = this.chapterNumber;
|
||||
if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(infoRex.Match(archive.Name).Value).Value).Value == cn) is { } path)
|
||||
if (archives.FirstOrDefault(archive => chapterRex.Match(chapterInfoRex.Match(archive.Name).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,6 +159,7 @@ public class TaskManager
|
||||
}
|
||||
foreach(TrangaTask childTask in removeTask.childTasks)
|
||||
DeleteTask(childTask);
|
||||
ExportDataAndSettings();
|
||||
}
|
||||
|
||||
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask mTask)
|
||||
|
@ -95,25 +95,24 @@ public abstract class TrangaTask
|
||||
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
|
||||
{
|
||||
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