Moved imdbid scan to variable helpers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from couchpotato import get_session
|
||||
from couchpotato.core.event import fireEvent, addEvent
|
||||
from couchpotato.core.helpers.encoding import toUnicode, simplifyString
|
||||
from couchpotato.core.helpers.variable import getExt
|
||||
from couchpotato.core.helpers.variable import getExt, getImdb
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from couchpotato.core.settings.model import File
|
||||
@@ -298,7 +298,7 @@ class Scanner(Plugin):
|
||||
if not imdb_id:
|
||||
try:
|
||||
for nfo_file in files['nfo']:
|
||||
imdb_id = self.getImdb(nfo_file)
|
||||
imdb_id = getImdb(nfo_file)
|
||||
if imdb_id: break
|
||||
except:
|
||||
pass
|
||||
@@ -359,22 +359,6 @@ class Scanner(Plugin):
|
||||
|
||||
return False
|
||||
|
||||
def getImdb(self, 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 getMediaFiles(self, files):
|
||||
|
||||
def test(s):
|
||||
|
||||
Reference in New Issue
Block a user