Moved imdbid scan to variable helpers
This commit is contained in:
1 parent
50be46bbea
commit
3c869f7945
2 files changed
+18
-18
No files matched your search
@@ -43,6 +43,22 @@ def cleanHost(host):
|
|||||||
|
|
||||||
return 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):
|
def tryInt(s):
|
||||||
try: return int(s)
|
try: return int(s)
|
||||||
except: return s
|
except: return s
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from couchpotato import get_session
|
from couchpotato import get_session
|
||||||
from couchpotato.core.event import fireEvent, addEvent
|
from couchpotato.core.event import fireEvent, addEvent
|
||||||
from couchpotato.core.helpers.encoding import toUnicode, simplifyString
|
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.logger import CPLog
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.core.settings.model import File
|
from couchpotato.core.settings.model import File
|
||||||
@@ -298,7 +298,7 @@ class Scanner(Plugin):
|
|||||||
if not imdb_id:
|
if not imdb_id:
|
||||||
try:
|
try:
|
||||||
for nfo_file in files['nfo']:
|
for nfo_file in files['nfo']:
|
||||||
imdb_id = self.getImdb(nfo_file)
|
imdb_id = getImdb(nfo_file)
|
||||||
if imdb_id: break
|
if imdb_id: break
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -359,22 +359,6 @@ class Scanner(Plugin):
|
|||||||
|
|
||||||
return False
|
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 getMediaFiles(self, files):
|
||||||
|
|
||||||
def test(s):
|
def test(s):
|
||||||
|
|||||||
Reference in new issue
Block a user