rename oxutils -> oxlib

This commit is contained in:
j 2008-07-03 11:24:49 +02:00
commit 68f7621ac7
15 changed files with 59 additions and 59 deletions

View file

@ -3,9 +3,9 @@
import re
import feedparser
from oxutils.cache import getUrl, getUrlUnicode
import oxutils
from oxutils.lang import langCode2To3, langTo3Code
from oxlib.cache import getUrl, getUrlUnicode
import oxlib
from oxlib.lang import langCode2To3, langTo3Code
def findSubtitlesByImdb(imdb, parts = 1, language = "eng"):
if len(language) == 2:
@ -26,7 +26,7 @@ def findSubtitlesByImdb(imdb, parts = 1, language = "eng"):
if opensubtitleId:
opensubtitleId = opensubtitleId[0]
else:
opensubtitleId = oxutils.findRe(data, '/en/subtitles/(.*?)/')
opensubtitleId = oxlib.findRe(data, '/en/subtitles/(.*?)/')
return opensubtitleId
def downloadSubtitleById(opensubtitle_id):
@ -34,7 +34,7 @@ def downloadSubtitleById(opensubtitle_id):
data = getUrl('http://www.opensubtitles.org/en/subtitles/%s' % opensubtitle_id)
reg_exp = 'href="(/en/download/file/.*?)">(.*?)</a>'
for f in re.compile(reg_exp, re.DOTALL).findall(data):
name = oxutils.stripTags(f[1]).split('\n')[0]
name = oxlib.stripTags(f[1]).split('\n')[0]
url = "http://www.opensubtitles.com%s" % f[0]
srts[name] = getUrlUnicode(url)
return srts