Compare commits
No commits in common. "621468f498778dd61d4048daef9b985940a5ec1e" and "08e0fe7c710f563ffc22baa443a949da41890005" have entirely different histories.
621468f498
...
08e0fe7c71
@ -77,16 +77,6 @@ public abstract class Connector
|
||||
);
|
||||
return comicInfo.ToString();
|
||||
}
|
||||
|
||||
public bool ChapterIsDownloaded(Publication publication, Chapter chapter)
|
||||
{
|
||||
return File.Exists(CreateFullFilepath(publication, chapter));
|
||||
}
|
||||
|
||||
protected string CreateFullFilepath(Publication publication, Chapter chapter)
|
||||
{
|
||||
return Path.Join(downloadLocation, publication.folderName, chapter.fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Downloads Image from URL and saves it to the given path(incl. fileName)
|
||||
|
@ -201,7 +201,7 @@ public class MangaDex : Connector
|
||||
File.WriteAllText(comicInfoPath, CreateComicInfo(publication, chapter));
|
||||
|
||||
//Download Chapter-Images
|
||||
DownloadChapterImages(imageUrls.ToArray(), CreateFullFilepath(publication, chapter), downloadClient, comicInfoPath);
|
||||
DownloadChapterImages(imageUrls.ToArray(), Path.Join(downloadLocation, publication.folderName, chapter.fileName), this.downloadClient, comicInfoPath);
|
||||
}
|
||||
|
||||
public override void DownloadCover(Publication publication)
|
||||
|
@ -33,7 +33,7 @@ public readonly struct Publication
|
||||
this.originalLanguage = originalLanguage;
|
||||
this.status = status;
|
||||
this.downloadUrl = downloadUrl;
|
||||
this.folderName = string.Concat(sortName.Split(Path.GetInvalidPathChars().Concat(Path.GetInvalidFileNameChars()).ToArray()));
|
||||
this.folderName = string.Concat(sortName.Split(Path.GetInvalidPathChars()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -93,11 +93,14 @@ public static class TaskExecutor
|
||||
private static List<Chapter> UpdateChapters(Connector connector, Publication publication, string language, Dictionary<Publication, List<Chapter>> chapterCollection)
|
||||
{
|
||||
List<Chapter> newChaptersList = new();
|
||||
chapterCollection.TryAdd(publication, newChaptersList); //To ensure publication is actually in collection
|
||||
if (!chapterCollection.ContainsKey(publication))
|
||||
return newChaptersList;
|
||||
|
||||
List<Chapter> currentChapters = chapterCollection[publication];
|
||||
Chapter[] newChapters = connector.GetChapters(publication, language);
|
||||
newChaptersList = newChapters.Where(nChapter => !connector.ChapterIsDownloaded(publication, nChapter)).ToList();
|
||||
|
||||
newChaptersList = newChapters.ToList()
|
||||
.ExceptBy(currentChapters.Select(cChapter => cChapter.url), nChapter => nChapter.url).ToList();
|
||||
return newChaptersList;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user