Created
October 4, 2014 09:58
-
-
Save dorukcan/9e570892156b65ed9015 to your computer and use it in GitHub Desktop.
episodecalendar.com to trakt.tv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import hashlib | |
import json | |
def markaswatched(): | |
""" | |
marks episodes which are marked on episodecalendar as seen on trakt. because episodecalendar forced me to buy premium version. fuck you episodecalendar. | |
http://trakt.tv/api-docs/show-episode-seen | |
""" | |
user = "username comes to here" | |
passw = hashlib.sha1("password comes to here").hexdigest() #they want sha1 encoded password | |
#export your data as a json file from http://episodecalendar.com/account/edit#7 | |
ecFile = json.load( open("C:\Users\Doruk\Desktop\episodecalendar-data.json") ) | |
data = {"username": user, | |
"password": passw, | |
"title": "", | |
"episodes": []} | |
title = ecFile[0]["show"] | |
for episode in ecFile: | |
if title != episode["show"]: | |
if data["episodes"] != []: | |
r = requests.post('http://api.trakt.tv/show/episode/seen/e66ae4b64761e4e72ede067271a12bbf', data=json.dumps(data)) | |
print r.text , title | |
data["title"] = episode["show"] | |
if episode["watched"] == "true": | |
data["episodes"] = [{"season": episode["season"], "episode": episode["number"]}] | |
else: | |
data["episodes"] = [] | |
title = episode["show"] | |
else: | |
if episode["watched"] == "true": | |
data["episodes"].append({"season": episode["season"], "episode": episode["number"]}) | |
if __name__ == '__main__': | |
markaswatched() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try using python 2.7 or just do what the SyntaxError says, use
print(r.text, title)