Merge branch 'main' into individual-game

This commit is contained in:
Peter Taylor 2022-05-18 13:53:49 +01:00 committed by GitHub
commit 18e147a173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -1,5 +1,7 @@
import json
from concurrent.futures import ThreadPoolExecutor
import functools
import threading
import requests
from bs4 import BeautifulSoup
@ -67,14 +69,16 @@ class Library:
def download_library(self, platform=None):
"""Download all games in the library"""
with ThreadPoolExecutor(max_workers=self.jobs) as executor:
i = 0
i = [0]
l = len(self.games)
lock = threading.RLock()
def dl(g):
def dl(i, g):
x = g.download(self.login, platform)
print(f"Downloaded {i} games of {l}")
with lock:
i[0] += 1
print(f"Downloaded {g.name} ({i[0]} of {l})")
return x
executor.map(dl, self.games)
executor.map(functools.partial(dl, i), self.games)

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "itchiodl"
version = "1.2.1"
version = "2.0.0"
description = "Python Scripts for downloading / archiving your itchio library"
authors = ["Peter Taylor <me@et1.uk>"]
license = "MIT"
@ -22,4 +22,4 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins."console_scripts"]
"itch-download" = "itchiodl.downloader.__main__:main"
"itch-load-bundle" = "itchiodl.bundle_tool.__main__:main"
"itch-load-bundle" = "itchiodl.bundle_tool.__main__:main"