Added Setup tools entry points

This commit is contained in:
Peter Taylor 2022-03-09 13:55:22 +00:00
parent 16446fef7e
commit 68c30fd32d
4 changed files with 48 additions and 24 deletions

View file

@ -8,19 +8,31 @@ pip install itchiodl
## Download All Games in library from account
```bash
python -m itchiodl.downloader
# via setup-tools entry point
itch-download
```
This uses the same API the itchio app uses to download the files. If you have 2FA enabled, generate an API key [here](https://itch.io/user/settings/api-keys) and run the following instead
```bash
# via python
python -m itchiodl.downloader --api-key=KEYHERE
# via setup-tools entry point
itch-download -k KEYHERE
```
## Add All Games in a bundle to your library
```bash
# via python
python -m itchiodl.bundle_tool
# via setup-tools entry point
itch-load-bundle
```
This is a bit of a bodge, but it works. It essentially goes through and clicks the "Download" link on every item on the bundle's page, which adds it to your itchio library. It does not download any files. You will need the download page's URL (this will be in the bundle's email, and possibly your purchase history). It will not work with 2FA, and I'm unlikely to be able to fix it without making it far more complicated

View file

@ -1,11 +1,15 @@
from getpass import getpass
import itchiodl
user = input("Username: ")
password = getpass("Password: ")
l = itchiodl.LoginWeb(user, password)
def main():
user = input("Username: ")
password = getpass("Password: ")
l = itchiodl.LoginWeb(user, password)
url = input("Bundle URL: ")
b = itchiodl.Bundle(l, url)
b.load_games()
url = input("Bundle URL: ")
b = itchiodl.Bundle(l, url)
b.load_games()
if __name__ == "__main__":
main()

View file

@ -3,24 +3,28 @@ from getpass import getpass
import itchiodl
parser = argparse.ArgumentParser(
prog='python -m hstp',
description='Build an '
)
def main():
parser = argparse.ArgumentParser(
prog='python -m hstp',
description='Build an '
)
parser.add_argument("-k", "--api-key", help="Use API key instead of username/password")
parser.add_argument("-k", "--api-key", help="Use API key instead of username/password")
args = parser.parse_args()
args = parser.parse_args()
l = ""
l = ""
if not args.api_key:
user = input("Username: ")
password = getpass("Password: ")
l = itchiodl.LoginAPI(user, password)
else:
l = args.api_key
if not args.api_key:
user = input("Username: ")
password = getpass("Password: ")
l = itchiodl.LoginAPI(user, password)
else:
l = args.api_key
lib = itchiodl.Library(l)
lib.load_games()
lib.download_library()
lib = itchiodl.Library(l)
lib.load_games()
lib.download_library()
if __name__ == "__main__":
main()

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "itchiodl"
version = "1.1.2"
version = "1.2.0"
description = "Python Scripts for downloading / archiving your itchio library"
authors = ["Peter Taylor <me@et1.uk>"]
license = "MIT"
@ -17,3 +17,7 @@ clint = "^0.5.1"
[build-system]
requires = ["poetry-core>=1.0.0"]
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"