Skip to content

Commit

Permalink
fix(?): app.download_media() seems to complete before we can actually…
Browse files Browse the repository at this point in the history
… run it
  • Loading branch information
EDM115 committed Sep 8, 2024
1 parent cf173d9 commit 80f4ce3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions unzipper/helpers/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ def dl_thumbs():
maxthumbs = len(thumbs)
LOGGER.info(Messages.DL_THUMBS.format(maxthumbs))
for thumb in thumbs:
loop2 = asyncio.get_event_loop()
if thumb.get("url") is None and thumb.get("file_id") is not None:
coroutine2 = unzipperbot.download_media(
unzipperbot.download_media(
message=thumb.get("file_id"),
file_name=(Config.THUMB_LOCATION + "/" + str(thumb.get("_id")) + ".jpg"),
)
elif thumb.get("url") is not None and thumb.get("file_id") is None:
loop2 = asyncio.get_event_loop()
coroutine2 = download(
thumb.get("url"), (Config.THUMB_LOCATION + "/" + str(thumb.get("_id")) + ".jpg")
)
if coroutine2 is not None:
loop2.run_until_complete(coroutine2)
i += 1
if i % 10 == 0 or i == maxthumbs:
Expand Down

0 comments on commit 80f4ce3

Please sign in to comment.