Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
- Fixed a bug which created an invalid EPUB file or caused the downloader to go in an infinite loop when multiple scanlations of the same chapter were selected
- The downloader will no longer show external chapters as options
- The downloader will no longer overwrite the tags of mangas that are being updated to preserve custom tags
  • Loading branch information
ErisLoona committed Dec 26, 2024
1 parent 3f833a4 commit d0f6f0b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
13 changes: 8 additions & 5 deletions Downloader.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ private void AddMangaToQueue(string mangaID, bool isUpdate)
ContentRating = MDLGetData.GetContentRating().Substring(0, 1).ToUpper() + MDLGetData.GetContentRating().Substring(1),
Tags = MDLGetData.GetTags().ToList<string>()
};
if (isUpdate == true)
newManga.TempManga.Tags = mangaList[passIndex].Tags;
newManga.Updating = isUpdate;

TextBlock title = new TextBlock()
Expand Down Expand Up @@ -538,21 +540,22 @@ private async void DownloadButton_Clicked(object sender, RoutedEventArgs args)

currentManga.TempManga.Title = currentManga.Titles[currentManga.SelectedTitleIndex];

Dictionary<string, int> chaptersToDownload = new Dictionary<string, int>(); // Chapter ID to Nr. of pages
List<decimal> selectedChapterNumbers = new List<decimal>();
Dictionary<string, int> chaptersToDownload = new Dictionary<string, int>(); // Chapter ID to Nr. of pages for the Progress Bars
List<string> selectedChapterNumbers = new List<string>();
for (int i = 0; i < currentManga.Chapters.Count; i++)
if (currentManga.Chapters[i].Checked == true)
{
chaptersToDownload[currentManga.ChapterIDs[i]] = currentManga.ChapterPages[i];
try
{
currentManga.TempManga.FileLastChapter = Convert.ToDecimal(currentManga.Chapters[i].Content.Split(' ')[0].Split("Ch.")[1]);
selectedChapterNumbers.Add(Convert.ToDecimal(currentManga.Chapters[i].Content.Split(' ')[0].Split("Ch.")[1]));
string sanitizedGroupName = new string(currentManga.Chapters[i].Content.Split(" by ")[1].Where(c => char.IsLetter(c)).ToArray()).ToLower();
selectedChapterNumbers.Add(currentManga.Chapters[i].Content.Split(' ')[0].Split("Ch.")[1] + "by" + sanitizedGroupName);
}
catch
{
currentManga.TempManga.FileLastChapter = Convert.ToDecimal(currentManga.Chapters[i].Content.Split("Ch.")[1]);
selectedChapterNumbers.Add(Convert.ToDecimal(currentManga.Chapters[i].Content.Split("Ch.")[1]));
selectedChapterNumbers.Add(currentManga.Chapters[i].Content.Split("Ch.")[1]);
}
}

Expand Down Expand Up @@ -1028,7 +1031,7 @@ private async void DownloadButton_Clicked(object sender, RoutedEventArgs args)

if (selectedChapterNumbers.Count > 0)
{
string nr = padDecimal(selectedChapterNumbers.Max(), "D" + selectedChapterNumbers.Count.ToString().Length.ToString());
string nr = padDecimal(currentManga.TempManga.FileLastChapter, "D" + selectedChapterNumbers.Count.ToString().Length.ToString());
doc.DocumentElement.SelectSingleNode("//dc:description", nsmgr).InnerText = currentManga.TempManga.Description.Replace("\r\n", "<br>").Replace("\n", "<br>") + "<br>Last chapter: " + "Ch." + nr;
}

Expand Down
2 changes: 1 addition & 1 deletion Manga Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Copyright>Eris Loona, pseudonym</Copyright>
<PackageProjectUrl>https://github.com/ErisLoona/Manga-Library-Manager</PackageProjectUrl>
<NeutralLanguage>en</NeutralLanguage>
<FileVersion>3.1.0</FileVersion>
<FileVersion>3.1.1</FileVersion>
<ApplicationIcon>icon256.ico</ApplicationIcon>
<DebugType>embedded</DebugType>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
Expand Down
2 changes: 2 additions & 0 deletions MangaDex Library/MDLGetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ private static void UpdateFeed()
foreach (JObject page in feed)
foreach (JToken chapter in page.SelectToken("data"))
{
if (chapter.SelectToken("attributes.pages").Value<int>() == 0)
continue;
chapterIDs.Add(chapter.SelectToken("id").Value<string>());
chapterNumbers.Add(Convert.ToDecimal(chapter.SelectToken("attributes.chapter").Value<string>(), new CultureInfo("en-US")));
chapterTitles.Add(chapter.SelectToken("attributes.title").Value<string>());
Expand Down
2 changes: 1 addition & 1 deletion Properties/PublishProfiles/Windows Release.pubxml.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-12-16T13:24:31.6017240Z||;True|2024-12-05T15:48:21.6380912+01:00||;True|2024-12-05T15:41:01.2998753+01:00||;True|2024-12-05T10:27:53.9063325+01:00||;True|2024-12-05T10:21:12.0877537+01:00||;True|2024-12-03T08:56:07.4697318+01:00||;True|2024-12-02T21:20:40.1113007+01:00||;True|2024-12-02T20:38:59.4610959+01:00||;True|2024-12-02T14:28:33.8752294+01:00||;True|2024-11-29T11:47:38.5429477+01:00||;True|2024-11-29T11:44:44.4931353+01:00||;True|2024-11-29T11:37:46.7879782+01:00||;True|2024-11-29T11:37:29.3303495+01:00||;True|2024-11-29T11:34:51.3573996+01:00||;True|2024-11-29T10:43:16.4214680+01:00||;True|2024-11-27T22:06:40.4122930+01:00||;True|2024-11-27T17:00:15.2266919+01:00||;True|2024-11-27T09:40:04.3729036+01:00||;True|2024-11-27T09:01:36.0426378+01:00||;True|2024-11-27T08:35:34.4591883+01:00||;True|2024-11-27T08:25:58.6905083+01:00||;True|2024-11-26T18:08:57.6730121+01:00||;True|2024-11-26T17:32:30.7716846+01:00||;</History>
<History>True|2024-12-26T12:41:06.4260890Z||;True|2024-12-26T13:40:56.7004797+01:00||;True|2024-12-16T14:24:31.6017240+01:00||;True|2024-12-05T15:48:21.6380912+01:00||;True|2024-12-05T15:41:01.2998753+01:00||;True|2024-12-05T10:27:53.9063325+01:00||;True|2024-12-05T10:21:12.0877537+01:00||;True|2024-12-03T08:56:07.4697318+01:00||;True|2024-12-02T21:20:40.1113007+01:00||;True|2024-12-02T20:38:59.4610959+01:00||;True|2024-12-02T14:28:33.8752294+01:00||;True|2024-11-29T11:47:38.5429477+01:00||;True|2024-11-29T11:44:44.4931353+01:00||;True|2024-11-29T11:37:46.7879782+01:00||;True|2024-11-29T11:37:29.3303495+01:00||;True|2024-11-29T11:34:51.3573996+01:00||;True|2024-11-29T10:43:16.4214680+01:00||;True|2024-11-27T22:06:40.4122930+01:00||;True|2024-11-27T17:00:15.2266919+01:00||;True|2024-11-27T09:40:04.3729036+01:00||;True|2024-11-27T09:01:36.0426378+01:00||;True|2024-11-27T08:35:34.4591883+01:00||;True|2024-11-27T08:25:58.6905083+01:00||;True|2024-11-26T18:08:57.6730121+01:00||;True|2024-11-26T17:32:30.7716846+01:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

0 comments on commit d0f6f0b

Please sign in to comment.