sort subtitle parts

This commit is contained in:
j 2007-08-11 15:47:43 +00:00
parent 50e9f3e819
commit afe518fc7d

View file

@ -69,10 +69,12 @@ def downloadSubtitleByID(opensubtitle_id):
data = read_url('http://www.opensubtitles.org/en/subtitles/%s' % opensubtitle_id)
soup = BeautifulSoup(data)
srts = {}
c = 0
for a in soup('a', {'href': re.compile('download/file')}):
download_url = 'http://www.opensubtitles.org' + a['href']
file_name = a.contents[-1].split('\n')[0].strip()
data = loadSrtUnicode(read_url(download_url))
if data:
srts[file_name] = data
srts["%03d_%s" %(c, file_name)] = data
c += 1
return srts