Skip to content

Instantly share code, notes, and snippets.

@wastrachan
Last active July 1, 2023 15:33
Show Gist options
  • Save wastrachan/6a9c8d3834b647ad75520b85e27eb153 to your computer and use it in GitHub Desktop.
Save wastrachan/6a9c8d3834b647ad75520b85e27eb153 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import datetime
import shutil
import os
import sys
if not len(sys.argv) > 1:
print("Expects path to F1 episode as first argument")
quit(1)
year = datetime.datetime.now().year
practice_path = f'/tank/share/Sports/Formula 1 Practice/{year}/'
qualifying_path = f'/tank/share/Sports/Formula 1 Qualifying/{year}/'
races_path = f'/tank/share/Sports/Formula 1 Races/{year}/'
episode = int(input('Episode Number? '))
city = input('City? ')
segment = input('(R)ace, (S)print Race, (Q)ualifying, or Free Practice(1)(2)(3)? ')
if segment.lower() == 'r':
event = "Race"
season_path = races_path
episode = (episode * 100)
if segment.lower() == 's':
event = "Sprint Race"
season_path = races_path
episode = (episode * 100) + 1
if segment.lower() == 'q':
event = "Qualifying"
episode = (episode * 100)
season_path = qualifying_path
if segment.lower() == '1':
event = "FP1"
episode = (episode * 100) + 1
season_path = practice_path
if segment.lower() == '2':
event = "FP2"
episode = (episode * 100) + 2
season_path = practice_path
if segment.lower() == '3':
event = "FP3"
episode = (episode * 100) + 3
season_path = practice_path
destination = "Formula 1 S{year}E{episode:0>2} {city} Grand Prix {event}".format(year=year, episode=episode, city=city, event=event)
extension = os.path.splitext(sys.argv[1])[1]
print("Copying episode from {} to {}...".format(sys.argv[1], destination + extension))
shutil.copy(sys.argv[1], season_path + destination + extension)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment