Skip to content

Commit

Permalink
v3.5.5 add 2020 game name, update python_requires, update some var names
Browse files Browse the repository at this point in the history
  • Loading branch information
NikhilNarayana committed Mar 1, 2020
1 parent def67f4 commit c255e47
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
30 changes: 15 additions & 15 deletions frcuploader/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
15 changes: 7 additions & 8 deletions frcuploader/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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):
Expand Down
10 changes: 7 additions & 3 deletions frcuploader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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',
Expand Down

0 comments on commit c255e47

Please sign in to comment.