Feature: Custom naming
Thanks for all the work on Dosage, it's amazing!
I was wondering if you have any plans or if it is even feasible to add custom naming - like instead of the filenames from the sites, one could define the files to have a custom numbering system.
This would probably mean parsing the entire site before downloading, since it starts from the latest comic strip though
I actually wrote a small script that can be used to achieve this (though not foolproof, as it depends on the creation time of the file)
import os
root = "/Webcomics"
for folder in os.listdir(root):
f = os.path.join(root,folder)
count = 1
files = list(os.listdir(f))
files.sort(key=lambda fn: os.path.getctime(os.path.join(f, fn)))
files.reverse()
for i in files:
if i is not str(count).zfill(4):
file_name, file_extension = os.path.splitext(os.path.join(f, i))
os.rename(os.path.join(f, i), os.path.join(f, str(count).zfill(5) + file_extension))
count = count + 1
else:
count = count + 1
continue
There is something similar in the tools directory: https://github.com/webcomics/dosage/blob/master/scripts/create-cbz.py - Not sure if I want to entertain such a feature in the core of Dosage, but maybe as a power-user feature... This might be something which could be implemented as an EventHandler...
I'm not familiar with how you handle things in Dosage, but maybe make this as something that cannot be used in the initial full download of a comic, only when there are already files present comic, or when used with the -c option, because otherwise it would be difficult to ascertain the number position of a single file (would have to traverse the whole site).
Additionally, the script i wrote may have issues if comics are downloaded using parallelization.
I tried looking into the EventHandlers, but i do not have code experience to fully grasp it yet.