Skip to content

Commit

Permalink
add mediatype
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 27, 2024
1 parent bd0a526 commit 750ac60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ofscraper/commands/managers/db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import time
import arrow
from rich.table import Table
from rich import box
Expand All @@ -21,6 +22,8 @@
from ofscraper.utils.logs.other import add_other_handler
from ofscraper.utils.context.run_async import run as run_async
import ofscraper.utils.constants as constants
import ofscraper.utils.settings as settings

class DBManager():
def __init__(self, username,model_id,remove_keys=None):
self.username = username
Expand Down Expand Up @@ -76,10 +79,16 @@ def filter_media(self) :
self.log.info(f"filtering media for {self.username}_{self.model_id}")
args=read_args.retriveArgs()
medias=self.media
#downloaded
if args.downloaded:
medias=[media for media in medias if media["downloaded"]]
elif args.not_downloaded:
medias=[media for media in medias if not media["downloaded"]]
#media type
if all(element in settings.get_mediatypes() for element in ["Audios", "Videos", "Images"]):
pass
else:
medias=[media for media in medias if media["mediatype"] in settings.get_mediatypes()]
self.media=medias


Expand Down Expand Up @@ -156,5 +165,7 @@ def dedup_by_media_id(self):
self.media=deduped_dictionaries
def print_media(self):
self.get_all_media()
#allow logs to print
time.sleep(1.5)
self.print_dictionary_table()

11 changes: 11 additions & 0 deletions ofscraper/utils/args/parse/group_bundles/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
max_count_option,
neg_filter_option,
)
from ofscraper.utils.args.parse.groups.media_filter import(
media_type_option,
media_filter_options_desc,
media_filter_options_help
)
from ofscraper.utils.args.parse.arguments.content import db_posts_option
from ofscraper.utils.args.parse.groups.user_list import userlist_options
from ofscraper.utils.args.parse.groups.user_select import user_select_options
Expand Down Expand Up @@ -67,6 +72,12 @@ def db_args(func):
after_option,
help=content_options_help,
)
@click.option_group(
media_filter_options_desc,
media_type_option,
help=media_filter_options_help
)

@user_select_options
@userlist_options
@advanced_userfilters_options
Expand Down

0 comments on commit 750ac60

Please sign in to comment.