mirror of
https://github.com/Emersont1/itchio.git
synced 2026-03-11 08:54:39 +00:00
better resumes without as many web requests
This commit is contained in:
parent
9825ee7f34
commit
19cfda12e7
2 changed files with 14 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "itchio"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
description = "Python Scripts for downloading / archiving your itchio library"
|
||||
authors = ["Peter Taylor <me@et1.uk>"]
|
||||
license = "MIT"
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ class Game:
|
|||
self.downloads.append(d)
|
||||
|
||||
def download(self, token):
|
||||
if os.path.exists(f"{self.publisher_slug}/{self.game_slug}.json"):
|
||||
print(f"Skipping Game {self.name}")
|
||||
|
||||
self.load_downloads(token)
|
||||
|
||||
if not os.path.exists(self.publisher_slug):
|
||||
|
|
@ -37,16 +40,6 @@ class Game:
|
|||
if not os.path.exists(f"{self.publisher_slug}/{self.game_slug}"):
|
||||
os.mkdir(f"{self.publisher_slug}/{self.game_slug}")
|
||||
|
||||
with open(f"{self.publisher_slug}/{self.game_slug}.json", "w") as f:
|
||||
json.dump({
|
||||
"name": self.name,
|
||||
"publisher": self.publisher,
|
||||
"link": self.link,
|
||||
"itch_id": self.id,
|
||||
"game_id": self.game_id,
|
||||
"itch_data": self.data,
|
||||
}, f)
|
||||
|
||||
for d in self.downloads:
|
||||
file = d['filename'] or d['display_name'] or d['id']
|
||||
outfile = f"{self.publisher_slug}/{self.game_slug}/{file}"
|
||||
|
|
@ -62,3 +55,13 @@ class Game:
|
|||
|
||||
url = f"https://api.itch.io/uploads/{d['id']}/download?api_key={token}&download_key_id={self.id}&uuid={j['uuid']}"
|
||||
itchio.utils.download_url(url, outfile, self.name +" - "+file)
|
||||
|
||||
with open(f"{self.publisher_slug}/{self.game_slug}.json", "w") as f:
|
||||
json.dump({
|
||||
"name": self.name,
|
||||
"publisher": self.publisher,
|
||||
"link": self.link,
|
||||
"itch_id": self.id,
|
||||
"game_id": self.game_id,
|
||||
"itch_data": self.data,
|
||||
}, f)
|
||||
|
|
|
|||
Loading…
Reference in a new issue