Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X.5 Chapters & Bundling #57

Open
audiojunky23 opened this issue Jan 25, 2025 · 2 comments
Open

X.5 Chapters & Bundling #57

audiojunky23 opened this issue Jan 25, 2025 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@audiojunky23
Copy link

I came across an interesting issue. I'm using the --bundle feature to group according to volume. Volume 12 of Bleach ends on 107.5. Pulling the chapters 99-107 excludes this 107.5. If you just try to grab 107, it also misses 107.5. Bundling 107-108 (for example) does grab 107.5. The program does not recognize the syntax if you simply try to grab 107.5 by itself. Interestingly enough, when you do bundle it with other chapters, it looks like this:

  • downloading Chapter 0107 Heat in Trust pages...
    fetched ←[36mBleach←[0m ←[90mChapter 0108 A Time to Scare←[0m
  • downloading Chapter 0108 A Time to Scare pages...
    fetched ←[36mBleach←[0m ←[90mChapter 0107 A Wonderful Error←[0m
  • downloading Chapter 0107 A Wonderful Error pages...
  • ←[32msaved file←[0m ←[90mBleach 107-108 - bundle.cbz←[0m

Is there a workaround to be able to include 107.5 in that volume bundle at the end? I assume this would be an issue if you were also simply trying to download that individual chapter as well because it will pull the "real" 107.

@elboletaire
Copy link
Owner

Is there a workaround to be able to include 107.5 in that volume bundle at the end? I assume this would be an issue if you were also simply trying to download that individual chapter as well because it will pull the "real" 107.

Not that I'm aware of. What's happening could be probably fixed by simply adding support for float numbers to the range parser.

@elboletaire elboletaire added bug Something isn't working good first issue Good for newcomers labels Jan 25, 2025
@audiojunky23
Copy link
Author

audiojunky23 commented Jan 26, 2025

I've made a bit of a work around for anyone else experiencing this. In the case above with 107.5, put in for the chapter range 107-108 and not bundled. Delete 107 and 108. Change 107.5 from .cbz to a .zip along with the previous bundle (in the case of Bleach, the previous volume contains chapters 99-107). Rename the images in 107.5 to follow after the last image in the previous bundle. Let's say it was 180, the images from 107.5 should start with 181. If it's just one or two chapters to do, it isn't bad.

Unfortunately there are two volumes that have a significant amount of additional chapters (up to .12). Renaming manually would be a pain. So to automate the process I made a rename.bat file in notepad with the following:

@echo off
setlocal enabledelayedexpansion

:: Set the starting number
set "counter=181"

:: Step 1: Rename files to temporary names to avoid conflicts
for /f "tokens=*" %%f in ('dir /b /on *.jpg') do (
    ren "%%f" "temp_%%f"
)

:: Step 2: Rename temporary files to final names with leading zeros
for /f "tokens=*" %%f in ('dir /b /on temp_*.jpg') do (
    set "padded=00!counter!"
    set "padded=!padded:~-3!"  :: Extract the last three characters for leading zeros
    ren "%%f" "!padded!.jpg"
    set /a counter+=1
)

Setting the counter to whatever number is next. Zip this folder back up, change it back to a .cbz and ta-da!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants