Return titles included in video headers
This commit is contained in:
1 parent
0b14fe5454
commit
286f14a6d2
1 file changed
+20
-3
@@ -11,7 +11,6 @@ from couchpotato.core.helpers.variable import getExt, getImdb, tryInt, \
|
|||||||
splitString, getIdentifier
|
splitString, getIdentifier
|
||||||
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 enzyme.exceptions import NoParserError, ParseError
|
|
||||||
from guessit import guess_movie_info
|
from guessit import guess_movie_info
|
||||||
from subliminal.videos import Video
|
from subliminal.videos import Video
|
||||||
import enzyme
|
import enzyme
|
||||||
@@ -457,6 +456,7 @@ class Scanner(Plugin):
|
|||||||
meta = self.getMeta(cur_file)
|
meta = self.getMeta(cur_file)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
data['titles'] = meta.get('titles', [])
|
||||||
data['video'] = meta.get('video', self.getCodec(cur_file, self.codecs['video']))
|
data['video'] = meta.get('video', self.getCodec(cur_file, self.codecs['video']))
|
||||||
data['audio'] = meta.get('audio', self.getCodec(cur_file, self.codecs['audio']))
|
data['audio'] = meta.get('audio', self.getCodec(cur_file, self.codecs['audio']))
|
||||||
data['audio_channels'] = meta.get('audio_channels', 2.0)
|
data['audio_channels'] = meta.get('audio_channels', 2.0)
|
||||||
@@ -527,16 +527,33 @@ class Scanner(Plugin):
|
|||||||
try: ac = self.audio_codec_map.get(p.audio[0].codec)
|
try: ac = self.audio_codec_map.get(p.audio[0].codec)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
|
# Find title in video headers
|
||||||
|
titles = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
if p.title and self.findYear(p.title):
|
||||||
|
titles.append(ss(p.title))
|
||||||
|
except:
|
||||||
|
log.error('Failed getting title from meta: %s', traceback.format_exc())
|
||||||
|
|
||||||
|
for video in p.video:
|
||||||
|
try:
|
||||||
|
if video.title and self.findYear(video.title):
|
||||||
|
titles.append(ss(video.title))
|
||||||
|
except:
|
||||||
|
log.error('Failed getting title from meta: %s', traceback.format_exc())
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'titles': list(set(titles)),
|
||||||
'video': vc,
|
'video': vc,
|
||||||
'audio': ac,
|
'audio': ac,
|
||||||
'resolution_width': tryInt(p.video[0].width),
|
'resolution_width': tryInt(p.video[0].width),
|
||||||
'resolution_height': tryInt(p.video[0].height),
|
'resolution_height': tryInt(p.video[0].height),
|
||||||
'audio_channels': p.audio[0].channels,
|
'audio_channels': p.audio[0].channels,
|
||||||
}
|
}
|
||||||
except ParseError:
|
except enzyme.exceptions.ParseError:
|
||||||
log.debug('Failed to parse meta for %s', filename)
|
log.debug('Failed to parse meta for %s', filename)
|
||||||
except NoParserError:
|
except enzyme.exceptions.NoParserError:
|
||||||
log.debug('No parser found for %s', filename)
|
log.debug('No parser found for %s', filename)
|
||||||
except:
|
except:
|
||||||
log.debug('Failed parsing %s', filename)
|
log.debug('Failed parsing %s', filename)
|
||||||
|
|||||||
Reference in new issue
Block a user