Skip to content

Commit

Permalink
add downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 27, 2024
1 parent be8ef36 commit 90ceb03
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions ofscraper/commands/managers/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import ofscraper.utils.args.accessors.read as read_args
from ofscraper.db.operations_.media import (
get_media_ids_downloaded_model,
get_timeline_media,
get_archived_media,
get_messages_media,
Expand Down Expand Up @@ -40,6 +39,8 @@ async def get_all_media(self):
stories=[]
model_id=self.model_id
username=self.username
log=logging.getLogger("shared")
log.
if all(
(
"Timeline" in args.download_area,
Expand Down Expand Up @@ -69,23 +70,17 @@ async def get_all_media(self):
if "Stories" in args.download_area:
stories=await get_stories_media(model_id=model_id, username=username)
self.media=timeline+messages+archived+streams+pinned+stories+highlights
self.dedup_by_media_id()
# if len(curr) == 0:
# log.debug("Setting oldest date to zero because database is empty")
# return 0
# curr_downloaded = await get_media_ids_downloaded_model(
# model_id=model_id, username=username
# )

# missing_items = list(
# filter(
# lambda x: x.get("downloaded") != 1
# and x.get("post_id") not in curr_downloaded
# and x.get("unlocked") != 0,
# curr,
# )
# )
self.dedup_by_media_id()
self.filter_media()
def filter_media(self) :
args=read_args.retriveArgs()
if args.downloaded:
self.media=[media for media in self.media if media["downloaded"]]
elif args.not_downloaded:
self.media=[media for media in self.media if not media["downloaded"]]



def print_dictionary_table(self):
"""Prints a list of dictionaries as a table.
Expand Down

0 comments on commit 90ceb03

Please sign in to comment.