croot / nekopaw

Automatically exported from code.google.com/p/nekopaw
1 stars 0 forks source link

Option to auto-rename files to not mess up filename ordering #235

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For example, when downloading from exhentai, files will have original names 
like 1.jpg...9.jpg, 10.jpg, 100.jpg  
With all naming variables I've tried, the output file will be 
<galleryid>-<filename>.jpg, for example 12345-1.jpg....1235-10.jpg  
This causes issues in both windows ordering and viewer software ordering.  
I tried using the "%width:.6d% " example from the wiki, since the original 
filename is decimal, but it doesn't seem to work.  
For exhentai, the files have a "title" field with the number.  
So I tried the following:  
$rootdir$\pics\%album%\%title:%width:.4d%% (doesn't work at all)  
$rootdir$\pics\%album%\%title[:%width:.4d%]% (starts downloading but endlessly 
starts redownloading same file, so most likely not working)  
$rootdir$\pics\%album%\$fname[:%width:.4d%]$ (same as above)  
Maybe I'm misunderstanding width altogether, and width is the pictures X 
resolution if applicable, in which case it can't be used for renaming files 
anyways.  

In short, I want: 12345-1.jpg to be either 12345-001.jpg or just 001.jpg and 
12345-10.jpg to be 12345-010.jpg or 010.jpg.  
A program similar to yours, domdomsoft manga downloader, has a simple tickbox 
called "rename single digit to three digits" (also applies to 2 digits), 
basically this would be just what I need

Original issue reported on code.google.com by confri...@gmail.com on 21 Aug 2014 at 9:11

GoogleCodeExporter commented 9 years ago
Actually I just noticed that the original filenames on exhentai are ordered 
properly.  
It just doesn't seem to get them.   

For example, in this gallery: http://exhentai.org/g/686220/1d1b9db105/  
The files are numbered from 000.jpg to 026.jpg  
If it just downloaded them with these names it would solve everything.  
Graber 1 downloads them correctly with the original names.  
But $fname$ returns 686220-1.jpg for the first file, for example.  

Original comment by confri...@gmail.com on 21 Aug 2014 at 9:21

GoogleCodeExporter commented 9 years ago
Ok, found a solution, even though the original_name field shows up as empty, 
this one actually works.  
So...solved for me, but $fname$ does not pull the original filename from 
exhentai, if that is intended.  

Original comment by confri...@gmail.com on 21 Aug 2014 at 9:24

GoogleCodeExporter commented 9 years ago
haha, yeah, it definitely is misunderstanding.
%width% suppose to meant "picture's width" (%% for picture fields, $$ for other 
variables), and it should be a legit field.
As I got, you trying to make a leading zeroes for "string type" ordering (like 
in windows XP and older or image viewer).
You can use one of this:
$fnn$ - sequence number in current directory;
$nn$ - sequence number in current list;
$fn$ - used to get a sequence number when file is already exist, but order can 
be broken if for some reason "next" picture will be finished before previous.

And example, how to format it: $fnn:.6d$ / $fnn:.6u$. You can add an album 
here: %album_id%-$fnn:.6d$.

$fname$ used to make unique name, not original. exhentai pictures have a 
%original_name% field, but it doesn't guaranties it's unique (even in the same 
album pictures can have the same names).

%original_name% is gathered right during picture's downloading (because 
exhentai's urls to picture are always dynamic, and you can't get it during 
getting list stage).

Original comment by catgirlfighter on 21 Aug 2014 at 9:35

GoogleCodeExporter commented 9 years ago

Original comment by catgirlfighter on 22 Aug 2014 at 1:15