Closed rEnr3n closed 5 years ago
Hello rEnr3n,
rEnr3n writes:
Please add option to rename file if it already exists.
Can you please elaborate further?
I.e. most files fetched by gallery-dl should be unique and that's often used as a way to avoid refetching them. :)
I usually download using gallery-dl -i SOMETEXT
SOMETEXT
contains URLs from varying sources. Sometimes it contains URLs like these:
https://example.lan/1.jpg
https://another.lan/1.jpg
Ah, so you're using gallery-dl like some kind of download manager, like wget?
It's certainly possible, although a bit pointless, maybe. We can't rely on any unique IDs
in this case, yes.
Eventually the directlink-extractor could be extended to generate randomized unique-y names here. The archive
functionality would be useless in such a case, though.
Doesn’t gallery-dl add a _1 to duplicates?
i'm usually using it with this config, so it more like wget
"directlink": { "filename": "{path[:120]}+{filename[:80]}.{extension}", "archive": "~/gallery-dl/archive-directlink.sqlite3" }
extractor.skip
now has an enumerate
option that adds .1
, .2
, etc to filenames if they already exist, like Wget does.
Nice, thanks.
Small suggestion: how about adding the numeric suffix between the filename and the file extension, i.e. something like..
standardfilename-1.jpg
standardfilename-2.jpg
instead of
standardfilename.jpg.1
standardfilename.jpg.2
That's what wget does, correct, but in my opinion that wget behaviour is a bit stupid 😄
Yeah, you're right. Having files with .jpg.1
as filename extension is probably not very useful on Windows systems.
At first I actually wanted to implement it like you're suggesting by modifying a file's extension
, but there were some complications for certain edge cases and I decided to rather go the easier and "already established" way ... I'll see what I can do in that regard.
Please add option to rename file if it already exists.