mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
10.77k stars 889 forks source link

Option to compress into archives after download #85

Closed carks32 closed 6 years ago

carks32 commented 6 years ago

Is there any way to make gallery-dl compress every folder it downloads after the download?

mikf commented 6 years ago

No, a feature like that doesn't exist at the moment, but I'm currently working on stuff where this would fit right in.

RonaldBolado commented 6 years ago

https://sourceforge.net/projects/icompress/

Use this software.

Also this http://www.visipics.info/index.php?title=Download if you want to find duplicates.

Bfgeshka commented 6 years ago

Btw, can we get this feature for selected list of extractors in config?

I.e., it is good to pack some doujinshi chapters, but it's rarely desirable to put some imgur pictures or even galleries into archive.

mikf commented 6 years ago

@Bfgeshka thats the plan ... kind of. You will be able to specify a list of "post processors", including their options, for each extractor category, i.e. in the same way you can configure filename formats and so on.

@carks32 just to make sure: you want an option to put downloaded files into an ZIP archive for convenience's sake and not to actually reduce their filesize, like @RonaldBolado implies, right?. Because compressing JPGs and PNGs with general purpose compression algorithms isn't going to do anything for filesize.

carks32 commented 6 years ago

I want to put the downloaded files in a ZIP, yes. Just for convenience to read basically. Having them in folders kinda messes up my reading flow in my reader. If you add an option to archive them in cbz i would appreciate it , too.

mikf commented 6 years ago

There is now (as of v1.4.0) a postprocessors config option which allows, among other things, to specify a zip post-processor (see this example). Doing so will store all downloaded files in a ZIP archive with the same name as the target directory. You can use the extension option if you want a .cbz archive.

In case you want to keep it simple, just use the --zip command-line option, but that is going to use the default options (.zip, no compression)

VanTuz5 commented 6 years ago

Could you add the option to set the archive name?

mikf commented 6 years ago

The archive name is determined by the last segment of the target directory path. You can change that by setting the extractor.directory option.

VanTuz5 commented 6 years ago

What should I write to make the archive the name I want?

mikf commented 6 years ago

If you are using a config file:

"extractor": {
    "directory": ["dir1", "dir2", "<archive name>"],
    "postprocessors": [
        {"name": "zip", "extension": "<archive ext>"}
    ]
}

If you just want to use the command-line and don't need any sub-directories:

$ gallery-dl --zip -o "directory=[\"<archive name>\"]" URL...

(the --zip option is only available since https://github.com/mikf/gallery-dl/commit/709c5d466d6fb975aac35ec5435e5f3ae731b377 and not in v1.4.0)

VanTuz5 commented 6 years ago

Thank you!