Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/python2.7
- import subprocess
- import json
- import hashlib
- import requests
- ###CONFIG###############################################
- username='USERNAME'
- password='PASSWORD'
- api='API'
- list_name='LIST NAME'
- ########################################################
- #The rest you don't have to worry about
- list_name=list_name.lower()
- # These characters are just stripped in the url
- for char in '!@#$%^*()[]{}/=?+\\|-_':
- list_name = list_name.replace(char, '')
- # These characters get replaced
- list_name = list_name.replace('&', 'and')
- list_name = list_name.replace(' ', '-')
- auth = {'username':username,
- 'password':password}
- url_base='http://api.trakt.tv/'
- url=url_base+'user/list.json/'+api+'/'+username+'/'+list_name
- result=requests.post(url, data=json.dumps(auth))
- data=result.json()
- listTitles=[]
- for item in data["items"]:
- if 'show' in item:
- listTitles.append(item['show']['title'])
- url=url_base+'user/library/shows/watched.json/'+api+'/'+username
- result=requests.post(url, data=json.dumps(auth))
- data=result.json()
- command_base='flexget series begin'
- for item in data:
- title=item['title']
- if title in listTitles:
- season=item['seasons'][0]['season']
- episode=item['seasons'][0]['episodes'][-1]
- next_ep='S'+str(season).zfill(2)+'E'+str((episode+1)).zfill(2)
- command=command_base+' \''+title+'\' '+next_ep
- print command
- subprocess.call(command,shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement