Skip to content

Commit

Permalink
fix download text check mode
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 17, 2024
1 parent fe7c406 commit 3d381ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
7 changes: 4 additions & 3 deletions ofscraper/actions/actions/download/batch/downloadbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ async def process_dicts(username, model_id, filtered_medialist,posts):
log = logging.getLogger("shared")
log.info("Downloading in batch mode")
log_text_array=[]
if read_args.retriveArgs().download_text:
log_text_array.append(await textDownloader(posts, username=username))
if len(get_download_area())==0:
log_text_array.append(await textDownloader(posts, username=username) or [])
if read_args.retriveArgs().text_only:
return log_text_array,(0,0,0,0,0)
elif len(get_download_area())==0:
return log_text_array,(0,0,0,0,0)
elif len(filtered_medialist)==0:
empty_log=final_log_text(username,0,0,0,0,0,0)
Expand Down
7 changes: 4 additions & 3 deletions ofscraper/actions/actions/download/normal/downloadnormal.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
async def process_dicts(username, model_id, medialist,posts):
log_text_array=[]
download_log_clear_helper()
if read_args.retriveArgs().download_text:
log_text_array.append(await textDownloader(posts, username=username))
if len(get_download_area())==0:
log_text_array.append(await textDownloader(posts, username=username)or [])
if read_args.retriveArgs().text_only:
return log_text_array,(0,0,0,0,0)
elif len(get_download_area())==0:
return log_text_array,(0,0,0,0,0)
elif len(medialist)==0:
empty_log=final_log_text(username,0,0,0,0,0,0)
Expand Down
2 changes: 1 addition & 1 deletion ofscraper/actions/actions/download/utils/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ async def textDownloader(objectdicts, username=None):
return logs.text_log(username, count, fails, exists, log=log)
except Exception as E:
log.debug(f"Issue with text {E}")
log.debug(f"Issue with text {traceback.format_exc()}")
log.debug(f"Issue with text {traceback.format_exc()}")
15 changes: 4 additions & 11 deletions ofscraper/commands/runners/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,10 @@ def process_item():
f"Downloading individual media ({media.filename}) to disk for {username}"
)
operations.table_init_create(model_id=model_id, username=username)
if read_args.retriveArgs().text_only:
output=textDownloader(post,username)

else:
output,values = downloadnormal.process_dicts(username, model_id, [media])
if values is None or values[-1] == 1:
raise Exception("Download is marked as skipped")
else:
raise Exception("Issue getting download")



output,values = downloadnormal.process_dicts(username, model_id, [media],[post])
if values is None or values[-1] == 1:
raise Exception("Download is marked as skipped")
log.info("Download Finished")
update_globals(model_id,username,post,media,output)
table.app.update_cell(key, "download_cart", "[downloaded]")
Expand Down

0 comments on commit 3d381ed

Please sign in to comment.