Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jfeilbach/ae7345a9a2359d8b08126240b8d86033 to your computer and use it in GitHub Desktop.
Save jfeilbach/ae7345a9a2359d8b08126240b8d86033 to your computer and use it in GitHub Desktop.
try:
season_data = requests.get(ERGAST_SEASON.format(PAGE_SIZE, OFFSET)).json()['MRData']
pages = int(season_data['total']) / int(season_data['limit'])
if pages > 0:
for page in range(1, pages):
offset = page*PAGE_SIZE
page_data = requests.get(ERGAST_SEASON.format(PAGE_SIZE, offset))
season_data.update(page_data.json()['MRData'])
races = sorted(filter(lambda x: (x['date'] <= pendulum.now()), [{'name': race['raceName'], 'date': pendulum.parse(race['date']+'T'+race['time']), } for race in season_data['RaceTable']['Races']]), key=lambda x: x['date'])
for torrent_id in client.list():
torrent = client.torrent.get({'trackers', 'name'}, torrent_id)[0]
for tracker in torrent['trackers']:
if DOM not in tracker['scrape']:
races = sorted(filter(lambda x: (x['date'] <= pendulum.now()), [{'active': False, 'season': race['season'], 'round': race['round'], 'name': race['raceName'], 'date': pendulum.parse(race['date']+'T'+race['time']), } for race in season_data['RaceTable']['Races']]), key=lambda x: x['date'])
f1_torrents = {}
for torrent_id in client.list():
torrent = client.torrent.get({'name'}, torrent_id)[0]
if 'Formula.1' not in torrent['name']:
continue
f1_torrents.update({torrent_id:torrent})
Formula.1.{season}x{race number}.{race name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment