Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Image Selection / Filtering #43

Closed
3 tasks done
mikf opened this issue Oct 1, 2017 · 0 comments
Closed
3 tasks done

Feature: Image Selection / Filtering #43

mikf opened this issue Oct 1, 2017 · 0 comments
Milestone

Comments

@mikf
Copy link
Owner

mikf commented Oct 1, 2017

Selecting only a certain type/volume/etc of manga chapters has been asked about a couple of times (#25, #11 (comment)) and using metadata, which is usually only used to build filenames, to select/filter images or image-groups seems like a generally useful feature.

The foundation for this has already been put into place with 9b21d3f and 0dedbe7, which add the --filter and --chapter-filter cmdline options. These allow users to specify their own Python expressions to filter out images for which the expression evaluates to False. The available variable/keyword names for a specific URL can be looked up using -K or -j.

For example, to only download chapter 3 to 5 in English:
gallery-dl --chapter-filter "lang == 'en' and 3 <= chapter <= 5" https://bato.to/comic/_/comics/fury-r12548

These user-specified Python expression are currently evaluated using the builtin eval function, which is generally considered unsafe for input from untrusted sources (Eval really is dangerous), but that shouldn't be an issue for this particular use-case (unless someone has a good argument against using it). On the plus side: eval is a lot faster and more powerful then for example youtube-dl's --match-filter, but there are probably good reasons why youtube-dl doesn't use eval for their filter implementation.

Todo:

  • Implement --filter and --chapter-filter
  • Provide manga-chapter metadata
  • Decide on sensible globals for filter expressions
@mikf mikf added this to the 1.0.0 milestone Oct 1, 2017
@mikf mikf removed the help wanted label Oct 20, 2017
@mikf mikf closed this as completed Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant