Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Apr 20, 2013
1 parent fc2c693 commit ad3783e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions TheMovieDB.py
Expand Up @@ -118,23 +118,26 @@ def SearchForSet(setname):
def GetMovieDBData(url):
from base64 import b64encode
filename = b64encode(url).replace("/","XXXX")
url = "http://api.themoviedb.org/3/" + url + "api_key=%s" % moviedb_key
log("Downloading MovieDB Data: " + url)
headers = {"Accept": "application/json"}
succeed = 0
while succeed < 3:
if True:
request = Request(url, headers = headers)
response = urlopen(request).read()
log(response)
save_to_file(response,filename,Addon_Data_Path)
response = json.loads(response)
return response
else:
log("could not get data from %s" % url)
xbmc.sleep(1000)
succeed += 1
return []
try:
url = "http://api.themoviedb.org/3/" + url + "api_key=%s" % moviedb_key
log("Downloading MovieDB Data: " + url)
headers = {"Accept": "application/json"}
succeed = 0
while succeed < 3:
if True:
request = Request(url, headers = headers)
response = urlopen(request).read()
log(response)
save_to_file(response,filename,Addon_Data_Path)
response = json.loads(response)
return response
else:
log("could not get data from %s" % url)
xbmc.sleep(1000)
succeed += 1
return []
except:
pass

def GetMovieDBConfig():
filename = Addon_Data_Path + "/MovieDBConfig.txt"
Expand Down

0 comments on commit ad3783e

Please sign in to comment.