Skip to content

Commit

Permalink
fix issue where all downloads are downloaded
Browse files Browse the repository at this point in the history
fix issue with 0 size items
  • Loading branch information
datawhores committed Dec 19, 2023
1 parent daf9be5 commit f886b0a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ofscraper/db/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def get_timeline_media(model_id=None, username=None, conn=None) -> list:

def get_last_timeline_date(model_id=None, username=None):
data = get_timeline_postdates(model_id=model_id, username=username)
return sorted(data, key=lambda x: x.float_timestamp)[-1]
return sorted(data, key=lambda x: x)[-1]


@operation_wrapper
Expand Down
2 changes: 1 addition & 1 deletion ofscraper/download/main_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def main_download(c, ele, path, username, model_id, progress):
if args_.getargs().metadata:
return await metadata(c, ele, path, username, model_id)
result = await main_download_downloader(c, ele, path, username, model_id, progress)

# special case for zero byte files
if len(result) == 2 and result[-1] == 0:
return result
total, temp, path_to_file = result
Expand Down
7 changes: 7 additions & 0 deletions ofscraper/download/main_downloadbatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ async def main_download(c, ele, path, username, model_id):
)
result = list(await main_download_downloader(c, ele, path, username, model_id))
if len(result) == 2 and result[-1] == 0:
await operations.update_media_table(
ele,
filename=None,
model_id=model_id,
username=username,
downloaded=True,
)
return result
total, temp_path, path_to_file = result

Expand Down
6 changes: 5 additions & 1 deletion ofscraper/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@ def get_dupe_ofscraper():


def setName():
setproctitle("OF-Scraper")
log = logging.getLogger("shared")
try:
setproctitle("OF-Scraper")
except Exception as E:
log.debug(E)

0 comments on commit f886b0a

Please sign in to comment.