Support for multiple numbers and 00X numbers

Asked by KIAaze

Hi again,

Is support for URLs of the following form planned (or already possible)?:
http://url/000000xx/00000xxx/0x.jpg

This means I need 3 numeric variables + numbering in the 00x format.

Question information

Language:
English Edit question
Status:
Solved
For:
Comicget Edit question
Assignee:
No assignee Edit question
Solved by:
KIAaze
Solved:
Last query:
Last reply:
Revision history for this message
KIAaze (zohn-joidberg) said :
#1

Note: I think I could eventually implement it myself. ;)
But just asking in case it hasn't been implemented yet.

Revision history for this message
Zach "theY4Kman" Kanzler (they4kman) said :
#2

Have a look at my branch of Comicget. I have written a URL formatter for it that allows for easy formatting with printf-like syntax: https://code.launchpad.net/~they4kman/comicget/cget-new

Revision history for this message
KIAaze (zohn-joidberg) said :
#3

Thx, I tested your branch. The formatting works.
However, it seems to use the same loop for both numbers.
When I run:
./comicget.py -d -r 1-2,1-3 http://URL/%8N/%2N.jpg
I get:
wget http://URL/00000001/01.jpg
wget http://URL/00000001/01.jpg
wget http://URL/00000001/01.jpg
wget http://URL/00000002/02.jpg
wget http://URL/00000002/02.jpg
wget http://URL/00000002/02.jpg
instead of:
wget http://URL/00000001/01.jpg
wget http://URL/00000001/02.jpg
wget http://URL/00000001/03.jpg
wget http://URL/00000002/01.jpg
wget http://URL/00000002/02.jpg
wget http://URL/00000002/03.jpg

Revision history for this message
KIAaze (zohn-joidberg) said :
#4

It will also be necessary to automatically create new directories named "%8N" for example to store the image files named "%2N.jpg" to avoid conflicts (and to simplify reading obviously). ;)

Revision history for this message
Zach "theY4Kman" Kanzler (they4kman) said :
#5

By default, %N will use the first range. The precision modifier of %N will change which range it uses. For example, with -r 1-3,4-5 %8.1N will loop through 1-3 and %2.2N will loop through 4-5.

Unfortunately, my version doesn't allow for switching save directories mid-command, but that will change once I get home today.

Revision history for this message
KIAaze (zohn-joidberg) said :
#6

Thanks. This works. :)
Can't wait to see the directory change implemented. :)

Revision history for this message
Zach "theY4Kman" Kanzler (they4kman) said :
#7

The cget-new branch has been updated with the added ability to have formatted ave directories. The format syntax is exactly the same as the URL format, and has access to the range just as the URL format does.

Revision history for this message
KIAaze (zohn-joidberg) said :
#8

I tried:
./comicget.py -d -r 1-2,1-3 -D %8.1N http://URL/%8.1N/%2.2N.jpg

and it does create the directories 00000001 and 00000002, but doesn't save the images in there.

Revision history for this message
KIAaze (zohn-joidberg) said :
#9

I tested without the -d option of course, i.e.:
./comicget.py -r 1-2,1-3 -D %8.1N http://URL/%8.1N/%2.2N.jpg

Revision history for this message
Zach "theY4Kman" Kanzler (they4kman) said :
#10

Whoops, that's embarrassing -- I forgot to run os.chdir() in Comicget.change_dir(). Fixed and pushed now. I've been meaning to write some unit tests :P

Revision history for this message
KIAaze (zohn-joidberg) said :
#11

Yes, it's working perfectly now! Thanks! :D

Revision history for this message
KIAaze (zohn-joidberg) said :
#12

Oops, not perfect: It doesn't skip to the next chapter after a failed wget in case the range is bigger than the actual number of strips.
This should be an optional command-line option of course. ;)

Revision history for this message
Zach "theY4Kman" Kanzler (they4kman) said :
#13

I've updated it just for you! The new option --notfound offers that functionality. --notfound=skip will skip the next larger range, --notfound=ignore (the default option) will ignore the error and continue, and --notfound=abort will quit the program when a file could not be downloaded.

Check out revision 8.