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)))
|
if (!Directory.Exists(Path.Join(downloadLocation, parentPublication.folderName)))
|
||||||
return false;
|
return false;
|
||||||
FileInfo[] archives = new DirectoryInfo(Path.Join(downloadLocation, parentPublication.folderName)).GetFiles();
|
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 chapterInfoRex = new(@"Ch.[0-9]+");
|
Regex chapterRex = new(@"[0-9]+(\.[0-9]+)?");
|
||||||
Regex chapterRex = new(@"[0-9]+");
|
|
||||||
|
|
||||||
if (File.Exists(newFilePath))
|
if (File.Exists(newFilePath))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
string cn = this.chapterNumber;
|
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);
|
File.Move(path.FullName, newFilePath);
|
||||||
return true;
|
return true;
|
||||||
|
@ -190,9 +190,9 @@ public class MangaDex : Connector
|
|||||||
? attributes["volume"]!.GetValue<string>()
|
? attributes["volume"]!.GetValue<string>()
|
||||||
: null;
|
: 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>()
|
? attributes["chapter"]!.GetValue<string>()
|
||||||
: null;
|
: "null";
|
||||||
|
|
||||||
chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId));
|
chapters.Add(new Chapter(publication, title, volume, chapterNum, chapterId));
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,7 @@ public class TaskManager
|
|||||||
}
|
}
|
||||||
foreach(TrangaTask childTask in removeTask.childTasks)
|
foreach(TrangaTask childTask in removeTask.childTasks)
|
||||||
DeleteTask(childTask);
|
DeleteTask(childTask);
|
||||||
|
ExportDataAndSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask mTask)
|
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask mTask)
|
||||||
|
@ -94,26 +94,25 @@ public abstract class TrangaTask
|
|||||||
nm.SendNotification("Chapter downloaded", $"{dct.publication.sortName} {dct.chapter.chapterNumber} {dct.chapter.name}");
|
nm.SendNotification("Chapter downloaded", $"{dct.publication.sortName} {dct.chapter.chapterNumber} {dct.chapter.name}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(TrangaTask childTask in this.childTasks.ToArray())
|
|
||||||
taskManager.DeleteTask(childTask);
|
|
||||||
|
|
||||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||||
{
|
{
|
||||||
this.lastExecuted = DateTime.Now;
|
this.lastExecuted = DateTime.Now;
|
||||||
if (this is DownloadChapterTask)
|
if(this is DownloadChapterTask)
|
||||||
this.state = ExecutionState.Success;
|
this.state = ExecutionState.Success;
|
||||||
else
|
else
|
||||||
this.state = ExecutionState.Waiting;
|
this.state = ExecutionState.Waiting;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this is DownloadChapterTask && statusCode == HttpStatusCode.NotFound)
|
this.state = ExecutionState.Failed;
|
||||||
this.state = ExecutionState.Success;
|
|
||||||
else
|
|
||||||
this.state = ExecutionState.Failed;
|
|
||||||
this.lastExecuted = DateTime.MaxValue;
|
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}");
|
logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user