From 068adfb80fff013f61a4cbcc162b57fe27d881a2 Mon Sep 17 00:00:00 2001 From: datawhores Date: Tue, 27 Aug 2024 15:36:10 -0500 Subject: [PATCH] add size filters --- ofscraper/commands/managers/db.py | 5 +++++ ofscraper/utils/args/parse/group_bundles/db.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ofscraper/commands/managers/db.py b/ofscraper/commands/managers/db.py index af5408ed..3e6c35b2 100644 --- a/ofscraper/commands/managers/db.py +++ b/ofscraper/commands/managers/db.py @@ -91,6 +91,11 @@ def filter_media(self) : medias=[media for media in medias if media["unlocked"]] elif args.locked: medias=[media for media in medias if not media["unlocked"]] + #size + if settings.get_size_max(): + medias=[media for media in medias if media["size"] <= settings.get_size_max()] + if settings.get_size_min(): + medias=[media for media in medias if media["size"] >= settings.get_size_min()] # media type if all(element in settings.get_mediatypes() for element in ["Audios", "Videos", "Images"]): pass diff --git a/ofscraper/utils/args/parse/group_bundles/db.py b/ofscraper/utils/args/parse/group_bundles/db.py index 5f08a443..9e8f3e05 100644 --- a/ofscraper/utils/args/parse/group_bundles/db.py +++ b/ofscraper/utils/args/parse/group_bundles/db.py @@ -15,6 +15,8 @@ ) from ofscraper.utils.args.parse.groups.media_filter import( media_type_option, +max_size_option, +min_size_option, media_filter_options_desc, media_id_filter, media_filter_options_help @@ -96,6 +98,8 @@ def db_args(func): @click.option_group( media_filter_options_desc, media_type_option, + max_size_option, + min_size_option, media_id_filter, help=media_filter_options_help )