Skip to content

Commit

Permalink
Testing some rudimentary error handling in download_library to look a…
Browse files Browse the repository at this point in the history
…t issue Emersont1#57
  • Loading branch information
64Core committed Jun 9, 2022
1 parent c0075c9 commit 0dded2a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions itchiodl/library.py
Expand Up @@ -83,10 +83,20 @@ def download_library(self, platform=None):
lock = threading.RLock()

def dl(i, g):
x = g.download(self.login, platform)
with lock:
i[0] += 1
print(f"Downloaded {g.name} ({i[0]} of {l})")
return x
try:
x = g.download(self.login, platform)
except:
with lock:
with open("errors.txt", "a") as f:
f.write(
f""" Cannot download game/asset: {g.name}
This game/asset has been skipped please download manually
---------------------------------------------------------\n """
)
finally:
with lock:
i[0] += 1
print(f"Downloaded {g.name} ({i[0]} of {l})")
return x

executor.map(functools.partial(dl, i), self.games)

0 comments on commit 0dded2a

Please sign in to comment.