forked from bluetyson/hb-downloader
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathhb-downloader.py
executable file
·53 lines (41 loc) · 1.64 KB
/
hb-downloader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logger
from config_data import ConfigData
from configuration import Configuration
from event_handler import EventHandler
from humble_api.humble_api import HumbleApi
from actions import Action
__author__ = "Brian Schkerke"
__copyright__ = "Copyright 2016 Brian Schkerke"
__license__ = "MIT"
print("Humble Bundle Downloader v%s" % ConfigData.VERSION)
print("This program is not affiliated nor endorsed by Humble Bundle, Inc.")
print("For any suggestion or bug report, please create an issue at:\n%s" %
ConfigData.BUG_REPORT_URL)
print("")
# Load the configuration from the YAML file...
Configuration.load_configuration("hb-downloader-settings.yaml")
Configuration.parse_command_line()
Configuration.dump_configuration()
Configuration.push_configuration()
validation_status, message = Configuration.validate_configuration()
if not validation_status:
logger.display_message(False, "Error", message)
exit("Invalid configuration. Please check your command line arguments and"
"hb-downloader-settings.yaml.")
# Initialize the event handlers.
EventHandler.initialize()
hapi = HumbleApi(ConfigData.auth_sess_cookie)
if not hapi.check_login():
exit("Login to humblebundle.com failed."
" Please verify your authentication cookie")
logger.display_message(False, "Processing", "Downloading order list.")
game_keys = hapi.get_gamekeys()
logger.display_message(False, "Processing", "%s orders found." %
(len(game_keys)))
if ConfigData.action == "download":
Action.batch_download(hapi, game_keys)
else:
Action.list_downloads(hapi, game_keys)
exit()