diff --git a/frcuploader/consts.py b/frcuploader/consts.py index 0883530..a96a9f1 100755 --- a/frcuploader/consts.py +++ b/frcuploader/consts.py @@ -38,37 +38,37 @@ VALID_PRIVACY_STATUSES = ("public", "unlisted", "private") GAMES = { - "2019": "FIRST Destination: Deep Space, Destination: Deep Space, Deep Space", - "2018": "FIRST Power Up, FIRST POWER UP", - "2017": "FIRST Steamworks, FIRST STEAMworks", - "2016": "FIRST Stronghold", - "2015": "Recycle Rush", - "2014": "Aerial Assist", - "2013": "Ultimate Ascent" + 2020: "FIRST Rise: Infinite Recharge, Rise: INFINITE RECHARGE, INFINITE RECHARGE", + 2019: "FIRST Destination: Deep Space, Destination: Deep Space, Deep Space", + 2018: "FIRST Power Up, FIRST POWER UP", + 2017: "FIRST Steamworks, FIRST STEAMworks", + 2016: "FIRST Stronghold", + 2015: "Recycle Rush", + 2014: "Aerial Assist", + 2013: "Ultimate Ascent" } # Extra Stuff abbrv = "frc" short_name = "frcuploader" long_name = "FRC YouTube Uploader" -spreadsheetID = "18flsXvAcYvQximmeyG0-9lhYtb5jd_oRtKzIN7zQDqk" -rowRange = "Data!A1:G1" -firstrun = True +spreadsheet_id = "18flsXvAcYvQximmeyG0-9lhYtb5jd_oRtKzIN7zQDqk" +row_range = "Data!A1:G1" +first_run = True stop_thread = False response = None status = None error = None sleep_minutes = 600 retry = 0 -retryforlimit = 0 youtube = None spreadsheet = None tba = tbapy.TBA("wvIxtt5Qvbr2qJtqW7ZsZ4vNppolYy0zMNQduH8LdYA7v2o1myt8ZbEOHAwzRuqf") trusted = False sizes = ("bytes", "KB", "MB", "GB", "TB") cerem = ("None", "Opening Ceremonies", "Alliance Selection", "Closing Ceremonies", "Highlight Reel") -queue_values = os.path.join(os.path.expanduser("~"), ".frc_queue_values.txt") -form_values = os.path.join(os.path.expanduser("~"), '.frc_form_values.json') -log_file = os.path.join(os.path.expanduser("~"), ".frc_log.txt") -rec_formats = (".ts", ".mkv", ".avi", ".mp4", ".flv", ".mov") root = os.path.expanduser("~") +queue_values = os.path.join(root, ".frc_queue_values.txt") +form_values = os.path.join(root, '.frc_form_values.json') +log_file = os.path.join(root, ".frc_log.txt") +rec_formats = (".ts", ".mkv", ".avi", ".mp4", ".flv", ".mov") diff --git a/frcuploader/forms.py b/frcuploader/forms.py index 2b5c91e..0813e2e 100755 --- a/frcuploader/forms.py +++ b/frcuploader/forms.py @@ -57,7 +57,7 @@ def __init__(self): if resp == "yes": ret = subprocess.call(('pip3', 'install', '-U', f'frcuploader=={latest_version}')) if ret: - self.message(f'The app failed to update\nType "pip3 install -U meleeuploader=={latest_version}" into CMD/Terminal to update', title="FRCUploader") + self.message(f'The app failed to update\nType "pip3 install -U frcuploader=={latest_version}" into CMD/Terminal to update', title="FRCUploader") else: self.info("You can now restart the app to use the new version", title="FRCUploader") except Exception as e: @@ -258,11 +258,11 @@ def __button_action(self): self._queue.put(options) self._queueref.append(options) self._qview.resize_rows_contents() - if consts.firstrun: + if consts.first_run: thr = threading.Thread(target=self.__worker) thr.daemon = True thr.start() - consts.firstrun = False + consts.first_run = False if not self._ceremonies.value: if not int(self._end.value): self._mnum.value = self._mnum.value + 1 @@ -308,11 +308,11 @@ def __toggle_worker(self): if not consts.stop_thread: print("Stopping Uploads") consts.stop_thread = True - consts.firstrun = False + consts.first_run = False else: print("Ready to Upload") consts.stop_thread = False - consts.firstrun = True + consts.first_run = True def __save_form(self, options=[]): row = [None] * (len(self._form_fields) + 1) @@ -424,7 +424,7 @@ def __load_queue(self): if resp == "yes": thr = threading.Thread(target=self.__worker) thr.daemon = True - consts.firstrun = False + consts.first_run = False consts.stop_thread = False thr.start() @@ -456,8 +456,7 @@ def __reset_cred(self): title = title['items'][0]['snippet']['title'] resp = self.question(f"You are currently logged into {title}\nWould you like to log out?", title="FRCUploader") if resp == "yes": - os.remove(os.path.join(os.path.expanduser("~"), ".frc-oauth2-spreadsheet.json")) - os.remove(os.path.join(os.path.expanduser("~"), ".frc-oauth2-youtube.json")) + os.remove(os.path.join(consts.root, ".frc-oauth2-youtube.json")) sys.exit(0) def __reset_descrip_event(self): diff --git a/frcuploader/utils.py b/frcuploader/utils.py index df663f8..a4d419e 100755 --- a/frcuploader/utils.py +++ b/frcuploader/utils.py @@ -459,7 +459,11 @@ def init(options): """The program starts here, options is a Namespace() object""" options.day = dt.datetime.now().strftime("%A") # weekday in english ex: "Monday" options.files = list(reversed([f for f in os.listdir(options.where) if os.path.isfile(os.path.join(options.where, f)) and not f.startswith('.')])) - options.tags = consts.DEFAULT_TAGS.format(options.ecode, game=consts.GAMES[options.ecode[:4]]) # add the ecode and game to default tags + try: + options.tags = consts.DEFAULT_TAGS.format(options.ecode, game=consts.GAMES[options.ecode[:4]]) # add the ecode and game to default tags + except KeyError as e: + options.tags = consts.DEFAULT_TAGS.format(options.ecode, game="") # new year so just use empty string for game + print("This must be a new year, please message Nikki or whoever runs this repo at that point") # default category is science & technology options.category = 28 options.title = options.ename + f" - Qualification Match {options.mnum}" # default title @@ -585,8 +589,8 @@ def post_upload(options, mcode): sheetbody = {'values': values} try: consts.spreadsheet.spreadsheets().values().append( - spreadsheetId=consts.spreadsheetID, - range=consts.rowRange, + spreadsheetId=consts.spreadsheet_id, + range=consts.row_range, valueInputOption="USER_ENTERED", body=sheetbody).execute() print("Added data to spreadsheet") diff --git a/setup.py b/setup.py index c02bed9..88e14cf 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from os import path here = path.abspath(path.dirname(__file__)) -version = '3.5.4' +version = '3.5.5' long_des = "" with open(path.join(here, 'README.md')) as f: @@ -27,12 +27,13 @@ "Natural Language :: English", ], entry_points=dict(console_scripts=['frcuploader = frcuploader.main:main']), - python_requires='>=3.6, <3.7.4', + python_requires='>=3.6, <3.8', version=version, packages=["frcuploader"], install_requires=[ 'CacheControl', 'google-api-python-client', + 'google_auth_oauthlib', 'oauth2client', 'Pyforms-Lite', 'tbapy',