Browse Source

Add 3D type to renamer (e.g. SBS, Half OU, etc)

pull/3104/head
mano3m 11 years ago
parent
commit
037e77860b
  1. 2
      couchpotato/core/plugins/renamer.py
  2. 30
      couchpotato/core/plugins/scanner.py

2
couchpotato/core/plugins/renamer.py

@ -316,6 +316,7 @@ class Renamer(Plugin):
'mpaa': media['info'].get('mpaa', ''),
'category': category_label,
'3d': '3D' if group['meta_data']['quality'].get('is_3d', 0) else '',
'3d_type': group['meta_data'].get('3d_type'),
}
for file_type in group['files']:
@ -1198,6 +1199,7 @@ rename_options = {
'quality': 'Quality (720p)',
'quality_type': '(HD) or (SD)',
'3d': '3D',
'3d_type': '3D Type (Full SBS)',
'video': 'Video (x264)',
'audio': 'Audio (DTS)',
'group': 'Releasegroup name',

30
couchpotato/core/plugins/scanner.py

@ -6,7 +6,7 @@ import traceback
from couchpotato import get_db
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import toUnicode, simplifyString, sp
from couchpotato.core.helpers.encoding import toUnicode, simplifyString, sp, ss
from couchpotato.core.helpers.variable import getExt, getImdb, tryInt, \
splitString, getIdentifier
from couchpotato.core.logger import CPLog
@ -40,6 +40,17 @@ class Scanner(Plugin):
'trailer': ['mov', 'mp4', 'flv']
}
threed_types = {
'Half SBS': [('half', 'sbs'), ('h', 'sbs'), 'hsbs'],
'Full SBS': [('full', 'sbs'), ('f', 'sbs'), 'fsbs'],
'SBS': 'sbs',
'Half OU': [('half', 'ou'), ('h', 'ou'), 'hou'],
'Full OU': [('full', 'ou'), ('h', 'ou'), 'fou'],
'OU': 'ou',
'Frame Packed': ['mvc', ('complete', 'bluray')],
'3D': '3d'
}
file_types = {
'subtitle': ('subtitle', 'subtitle'),
'subtitle_extra': ('subtitle', 'subtitle_extra'),
@ -470,9 +481,24 @@ class Scanner(Plugin):
filename = re.sub('(.cp\(tt[0-9{7}]+\))', '', files[0])
data['group'] = self.getGroup(filename[len(folder):])
data['source'] = self.getSourceMedia(filename)
data['3d_type'] = self.get3dType(filename)
return data
def get3dType(self, filename):
filename = ss(filename)
words = re.split('\W+', filename.lower())
for key in self.threed_types:
tags = self.threed_types.get(key, [])
for tag in tags:
if (isinstance(tag, tuple) and '.'.join(tag) in '.'.join(words)) or (isinstance(tag, (str, unicode)) and ss(tag.lower()) in filename.lower()):
log.debug('Found %s in %s', (tag, filename))
return key
return ''
def getMeta(self, filename):
try:

Loading…
Cancel
Save