Skip to content

Commit

Permalink
SubDB fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amet authored and jrhames committed Feb 7, 2011
1 parent cc83808 commit 465119a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions script.xbmc.subtitles/resources/lib/services/SubDB/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,15 @@ def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir, sub_folder,
link = subtitles_list[pos][ "link" ]
file = os.path.splitext(subtitles_list[pos]["filename"])[0]
ext = ""

req = urllib2.Request(link)
req.add_header('User-Agent', user_agent)
try:
response = urllib2.urlopen(req)
ext = response.info()['Content-Disposition'].split(".")[1]

local_file = open(zip_subs, "w" + "b")
filename = os.path.join(tmp_sub_dir, "%s.%s" % (file, ext))
local_file = open(filename, "w" + "b")
local_file.write(response.read())
local_file.close()

filename = "%s.%s" % (file, ext)
return False, language, filename #standard output
except:
return False , language, "" #standard output

0 comments on commit 465119a

Please sign in to comment.