Moved imdbid scan to variable helpers

This commit is contained in:
Ruud
2011-10-12 13:46:13 +02:00
parent 50be46bbea
commit 3c869f7945
2 changed files with 18 additions and 18 deletions
+16
View File
@@ -43,6 +43,22 @@ def cleanHost(host):
return host
def getImdb(txt):
if os.path.isfile(txt):
output = open(txt, 'r')
txt = output.read()
output.close()
try:
m = re.search('(?P<id>tt[0-9{7}]+)', txt)
id = m.group('id')
if id: return id
except AttributeError:
pass
return False
def tryInt(s):
try: return int(s)
except: return s