Advertisement
stubborn_d0nkey

Flexget+Trakt Series begin

Feb 17th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. #/usr/bin/python2.7
  2. import subprocess
  3. import json
  4. import hashlib
  5. import requests
  6. ###CONFIG###############################################
  7. username='USERNAME'
  8. password='PASSWORD'
  9. api='API'
  10. ########################################################
  11. #The rest you don't have to worry about
  12. auth = {'username':username,
  13.         'password':password}
  14. url_base='http://api.trakt.tv/'
  15. url=url_base+'user/library/shows/watched.json/'+api+'/'+username
  16. result=requests.post(url, data=json.dumps(auth))
  17. data=result.json()
  18. command_base='flexget series begin'
  19. for item in data:
  20.     title=item['title']
  21.     season=item['seasons'][0]['season']
  22.     episode=item['seasons'][0]['episodes'][-1]
  23.     next_ep='S'+str(season).zfill(2)+'E'+str((episode+1)).zfill(2)
  24.     command=command_base+' \''+title+'\' '+next_ep
  25.     print command
  26.     subprocess.call(command,shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement