Code cleanup
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from .main import Automation
|
||||
|
||||
|
||||
def start():
|
||||
return Automation()
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class Plugin(object):
|
||||
class_name = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
||||
|
||||
# View path
|
||||
path = 'static/plugin/%s/' % (class_name)
|
||||
path = 'static/plugin/%s/' % class_name
|
||||
|
||||
# Add handler to Tornado
|
||||
Env.get('app').add_handlers(".*$", [(Env.get('web_base') + path + '(.*)', StaticFileHandler, {'path': static_folder})])
|
||||
@@ -110,7 +110,7 @@ class Plugin(object):
|
||||
f.write(content)
|
||||
f.close()
|
||||
os.chmod(path, Env.getPermission('file'))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Unable writing to file "%s": %s', (path, traceback.format_exc()))
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
@@ -121,7 +121,7 @@ class Plugin(object):
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path, Env.getPermission('folder'))
|
||||
return True
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Unable to create folder "%s": %s', (path, e))
|
||||
|
||||
return False
|
||||
@@ -243,7 +243,6 @@ class Plugin(object):
|
||||
except:
|
||||
log.error("Something went wrong when finishing the plugin function. Could not find the 'is_running' key")
|
||||
|
||||
|
||||
def getCache(self, cache_key, url = None, **kwargs):
|
||||
cache_key_md5 = md5(cache_key)
|
||||
cache = Env.get('cache').get(cache_key_md5)
|
||||
@@ -255,7 +254,7 @@ class Plugin(object):
|
||||
try:
|
||||
|
||||
cache_timeout = 300
|
||||
if kwargs.has_key('cache_timeout'):
|
||||
if 'cache_timeout' in kwargs:
|
||||
cache_timeout = kwargs.get('cache_timeout')
|
||||
del kwargs['cache_timeout']
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import FileBrowser
|
||||
|
||||
|
||||
def start():
|
||||
return FileBrowser()
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ if os.name == 'nt':
|
||||
raise ImportError("Missing the win32file module, which is a part of the prerequisite \
|
||||
pywin32 package. You can get it from http://sourceforge.net/projects/pywin32/files/pywin32/")
|
||||
else:
|
||||
import win32file #@UnresolvedImport
|
||||
import win32file #@UnresolvedImport
|
||||
|
||||
class FileBrowser(Plugin):
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import CategoryPlugin
|
||||
|
||||
|
||||
def start():
|
||||
return CategoryPlugin()
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ class CategoryPlugin(Plugin):
|
||||
self.removeFromMovie(id)
|
||||
|
||||
success = True
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
message = log.error('Failed deleting category: %s', e)
|
||||
|
||||
db.expire_all()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Custom
|
||||
|
||||
|
||||
def start():
|
||||
return Custom()
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Dashboard
|
||||
|
||||
|
||||
def start():
|
||||
return Dashboard()
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class Dashboard(Plugin):
|
||||
|
||||
for movie_id in movie_ids:
|
||||
movies.append(movie_dict[movie_id].to_dict({
|
||||
'library': {'titles': {}, 'files':{}},
|
||||
'library': {'titles': {}, 'files': {}},
|
||||
'files': {},
|
||||
}))
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import FileManager
|
||||
|
||||
|
||||
def start():
|
||||
return FileManager()
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ class FileManager(Plugin):
|
||||
def showCacheFile(self, route, **kwargs):
|
||||
Env.get('app').add_handlers(".*$", [('%s%s' % (Env.get('api_base'), route), StaticFileHandler, {'path': Env.get('cache_dir')})])
|
||||
|
||||
|
||||
def download(self, url = '', dest = None, overwrite = False, urlopen_kwargs = None):
|
||||
if not urlopen_kwargs: urlopen_kwargs = {}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Logging
|
||||
|
||||
|
||||
def start():
|
||||
return Logging()
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class Logging(Plugin):
|
||||
'desc': 'Log errors',
|
||||
'params': {
|
||||
'type': {'desc': 'Type of logging, default "error"'},
|
||||
'**kwargs': {'type':'object', 'desc': 'All other params will be printed in the log string.'},
|
||||
'**kwargs': {'type': 'object', 'desc': 'All other params will be printed in the log string.'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Manage
|
||||
|
||||
|
||||
def start():
|
||||
return Manage()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import traceback
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class Manage(Plugin):
|
||||
|
||||
in_progress = False
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import ProfilePlugin
|
||||
|
||||
|
||||
def start():
|
||||
return ProfilePlugin()
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class ProfilePlugin(Plugin):
|
||||
self.forceDefaults()
|
||||
|
||||
success = True
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
message = log.error('Failed deleting Profile: %s', e)
|
||||
|
||||
db.expire_all()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import QualityPlugin
|
||||
|
||||
|
||||
def start():
|
||||
return QualityPlugin()
|
||||
|
||||
|
||||
@@ -133,10 +133,10 @@ class QualityPlugin(Plugin):
|
||||
|
||||
# Create single quality profile
|
||||
prof = db.query(Profile).filter(
|
||||
Profile.core == True
|
||||
).filter(
|
||||
Profile.types.any(quality = qual)
|
||||
).all()
|
||||
Profile.core == True
|
||||
).filter(
|
||||
Profile.types.any(quality = qual)
|
||||
).all()
|
||||
|
||||
if not prof:
|
||||
log.info('Creating profile: %s', q.get('label'))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Release
|
||||
|
||||
|
||||
def start():
|
||||
return Release()
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ class Release(Plugin):
|
||||
|
||||
identifier = '%s.%s.%s' % (group['library']['identifier'], group['meta_data'].get('audio', 'unknown'), group['meta_data']['quality']['identifier'])
|
||||
|
||||
|
||||
done_status, snatched_status = fireEvent('status.get', ['done', 'snatched'], single = True)
|
||||
|
||||
# Add movie
|
||||
@@ -237,15 +236,15 @@ class Release(Plugin):
|
||||
success = self.download(data = item, media = rel.movie.to_dict({
|
||||
'profile': {'types': {'quality': {}}},
|
||||
'releases': {'status': {}, 'quality': {}},
|
||||
'library': {'titles': {}, 'files':{}},
|
||||
'library': {'titles': {}, 'files': {}},
|
||||
'files': {}
|
||||
}), manual = True)
|
||||
|
||||
if success == True:
|
||||
db.expunge_all()
|
||||
rel = db.query(Relea).filter_by(id = id).first() # Get release again @RuudBurger why do we need to get it again??
|
||||
db.expunge_all()
|
||||
|
||||
if success:
|
||||
fireEvent('notify.frontend', type = 'release.manual_download', data = True, message = 'Successfully snatched "%s"' % item['name'])
|
||||
|
||||
return {
|
||||
'success': success == True
|
||||
}
|
||||
@@ -317,8 +316,8 @@ class Release(Plugin):
|
||||
# If renamer isn't used, mark media done if finished or release downloaded
|
||||
else:
|
||||
if media['status_id'] == active_status.get('id'):
|
||||
finished = next((True for profile_type in media['profile']['types'] if \
|
||||
profile_type['quality_id'] == rls.quality.id and profile_type['finish']), False)
|
||||
finished = next((True for profile_type in media['profile']['types']
|
||||
if profile_type['quality_id'] == rls.quality.id and profile_type['finish']), False)
|
||||
if finished:
|
||||
log.info('Renamer disabled, marking media as finished: %s', log_movie)
|
||||
|
||||
@@ -423,7 +422,7 @@ class Release(Plugin):
|
||||
.filter(Relea.movie_id == id) \
|
||||
.all()
|
||||
|
||||
releases = [r.to_dict({'info':{}, 'files':{}}) for r in releases_raw]
|
||||
releases = [r.to_dict({'info': {}, 'files': {}}) for r in releases_raw]
|
||||
releases = sorted(releases, key = lambda k: k['info'].get('score', 0), reverse = True)
|
||||
|
||||
return releases
|
||||
@@ -449,6 +448,7 @@ class Release(Plugin):
|
||||
for info in rel.info:
|
||||
item[info.identifier] = info.value
|
||||
|
||||
release_name = None
|
||||
if rel.files:
|
||||
for file_item in rel.files:
|
||||
if file_item.type.identifier == 'movie':
|
||||
@@ -456,6 +456,7 @@ class Release(Plugin):
|
||||
break
|
||||
else:
|
||||
release_name = item['name']
|
||||
|
||||
#update status in Db
|
||||
log.debug('Marking release %s as %s', (release_name, status.get("label")))
|
||||
rel.status_id = status.get('id')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from couchpotato.core.plugins.renamer.main import Renamer
|
||||
import os
|
||||
|
||||
|
||||
def start():
|
||||
return Renamer()
|
||||
|
||||
@@ -136,7 +137,8 @@ config = [{
|
||||
'default': 'link',
|
||||
'type': 'dropdown',
|
||||
'values': [('Link', 'link'), ('Copy', 'copy'), ('Move', 'move')],
|
||||
'description': ('<strong>Link</strong>, <strong>Copy</strong> or <strong>Move</strong> after download completed.', 'Link first tries <a href="http://en.wikipedia.org/wiki/Hard_link">hard link</a>, then <a href="http://en.wikipedia.org/wiki/Sym_link">sym link</a> and falls back to Copy. It is perfered to use link when downloading torrents as it will save you space, while still beeing able to seed.'),
|
||||
'description': ('<strong>Link</strong>, <strong>Copy</strong> or <strong>Move</strong> after download completed.',
|
||||
'Link first tries <a href="http://en.wikipedia.org/wiki/Hard_link">hard link</a>, then <a href="http://en.wikipedia.org/wiki/Sym_link">sym link</a> and falls back to Copy. It is perfered to use link when downloading torrents as it will save you space, while still beeing able to seed.'),
|
||||
'advanced': True,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ import traceback
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class Renamer(Plugin):
|
||||
|
||||
renaming_started = False
|
||||
@@ -33,7 +34,7 @@ class Renamer(Plugin):
|
||||
'media_folder': {'desc': 'Optional: The folder of the media to scan. Keep empty for default renamer folder.'},
|
||||
'files': {'desc': 'Optional: Provide the release files if more releases are in the same media_folder, delimited with a \'|\'. Note that no dedicated release folder is expected for releases with one file.'},
|
||||
'base_folder': {'desc': 'Optional: The folder to find releases in. Leave empty for default folder.'},
|
||||
'downloader' : {'desc': 'Optional: The downloader the release has been downloaded with. \'download_id\' is required with this option.'},
|
||||
'downloader': {'desc': 'Optional: The downloader the release has been downloaded with. \'download_id\' is required with this option.'},
|
||||
'download_id': {'desc': 'Optional: The nzb/torrent ID of the release in media_folder. \'downloader\' is required with this option.'},
|
||||
'status': {'desc': 'Optional: The status of the release: \'completed\' (default) or \'seeding\''},
|
||||
},
|
||||
@@ -274,25 +275,25 @@ class Renamer(Plugin):
|
||||
name_the = movie_name[4:] + ', The'
|
||||
|
||||
replacements = {
|
||||
'ext': 'mkv',
|
||||
'namethe': name_the.strip(),
|
||||
'thename': movie_name.strip(),
|
||||
'year': library['year'],
|
||||
'first': name_the[0].upper(),
|
||||
'quality': group['meta_data']['quality']['label'],
|
||||
'quality_type': group['meta_data']['quality_type'],
|
||||
'video': group['meta_data'].get('video'),
|
||||
'audio': group['meta_data'].get('audio'),
|
||||
'group': group['meta_data']['group'],
|
||||
'source': group['meta_data']['source'],
|
||||
'resolution_width': group['meta_data'].get('resolution_width'),
|
||||
'resolution_height': group['meta_data'].get('resolution_height'),
|
||||
'audio_channels': group['meta_data'].get('audio_channels'),
|
||||
'imdb_id': library['identifier'],
|
||||
'cd': '',
|
||||
'cd_nr': '',
|
||||
'mpaa': library['info'].get('mpaa', ''),
|
||||
'category': category_label,
|
||||
'ext': 'mkv',
|
||||
'namethe': name_the.strip(),
|
||||
'thename': movie_name.strip(),
|
||||
'year': library['year'],
|
||||
'first': name_the[0].upper(),
|
||||
'quality': group['meta_data']['quality']['label'],
|
||||
'quality_type': group['meta_data']['quality_type'],
|
||||
'video': group['meta_data'].get('video'),
|
||||
'audio': group['meta_data'].get('audio'),
|
||||
'group': group['meta_data']['group'],
|
||||
'source': group['meta_data']['source'],
|
||||
'resolution_width': group['meta_data'].get('resolution_width'),
|
||||
'resolution_height': group['meta_data'].get('resolution_height'),
|
||||
'audio_channels': group['meta_data'].get('audio_channels'),
|
||||
'imdb_id': library['identifier'],
|
||||
'cd': '',
|
||||
'cd_nr': '',
|
||||
'mpaa': library['info'].get('mpaa', ''),
|
||||
'category': category_label,
|
||||
}
|
||||
|
||||
for file_type in group['files']:
|
||||
@@ -434,7 +435,7 @@ class Renamer(Plugin):
|
||||
movie.status_id = done_status.get('id')
|
||||
movie.last_edit = int(time.time())
|
||||
db.commit()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Failed marking movie finished: %s %s', (e, traceback.format_exc()))
|
||||
|
||||
# Go over current movie releases
|
||||
@@ -526,7 +527,7 @@ class Renamer(Plugin):
|
||||
for delete_folder in delete_folders:
|
||||
try:
|
||||
self.deleteEmptyFolder(delete_folder, show_error = False)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Failed to delete folder: %s %s', (e, traceback.format_exc()))
|
||||
|
||||
# Rename all files marked
|
||||
@@ -592,7 +593,7 @@ class Renamer(Plugin):
|
||||
# Break if CP wants to shut down
|
||||
if self.shuttingDown():
|
||||
break
|
||||
|
||||
|
||||
self.renaming_started = False
|
||||
|
||||
def getRenameExtras(self, extra_type = '', replacements = None, folder_name = '', file_name = '', destination = '', group = None, current_file = '', remove_multiple = False):
|
||||
@@ -1160,7 +1161,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
rar_handle.extract(condition = [packedinfo.index], path = extr_path, withSubpath = False, overwrite = False)
|
||||
extr_files.append(sp(os.path.join(extr_path, os.path.basename(packedinfo.filename))))
|
||||
del rar_handle
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Failed to extract %s: %s %s', (archive['file'], e, traceback.format_exc()))
|
||||
continue
|
||||
|
||||
@@ -1169,7 +1170,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
if cleanup:
|
||||
try:
|
||||
os.remove(filename)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Failed to remove %s: %s %s', (filename, e, traceback.format_exc()))
|
||||
continue
|
||||
files.remove(filename)
|
||||
@@ -1182,7 +1183,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
try:
|
||||
self.makeDir(os.path.dirname(move_to))
|
||||
self.moveFile(leftoverfile, move_to, cleanup)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
log.error('Failed moving left over file %s to %s: %s %s', (leftoverfile, move_to, e, traceback.format_exc()))
|
||||
# As we probably tried to overwrite the nfo file, check if it exists and then remove the original
|
||||
if os.path.isfile(move_to):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Scanner
|
||||
|
||||
|
||||
def start():
|
||||
return Scanner()
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Scanner(Plugin):
|
||||
|
||||
ignored_in_path = [os.path.sep + 'extracted' + os.path.sep, 'extracting', '_unpack', '_failed_', '_unknown_', '_exists_', '_failed_remove_',
|
||||
'_failed_rename_', '.appledouble', '.appledb', '.appledesktop', os.path.sep + '._', '.ds_store', 'cp.cpnfo',
|
||||
'thumbs.db', 'ehthumbs.db', 'desktop.ini'] #unpacking, smb-crap, hidden files
|
||||
'thumbs.db', 'ehthumbs.db', 'desktop.ini'] #unpacking, smb-crap, hidden files
|
||||
ignore_names = ['extract', 'extracting', 'extracted', 'movie', 'movies', 'film', 'films', 'download', 'downloads', 'video_ts', 'audio_ts', 'bdmv', 'certificate']
|
||||
extensions = {
|
||||
'movie': ['mkv', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'm2ts', 'iso', 'img', 'mdf', 'ts', 'm4v'],
|
||||
@@ -48,7 +48,7 @@ class Scanner(Plugin):
|
||||
'leftover': ('leftover', 'leftover'),
|
||||
}
|
||||
|
||||
file_sizes = { # in MB
|
||||
file_sizes = { # in MB
|
||||
'movie': {'min': 300},
|
||||
'trailer': {'min': 2, 'max': 250},
|
||||
'backdrop': {'min': 0, 'max': 5},
|
||||
@@ -83,17 +83,17 @@ class Scanner(Plugin):
|
||||
clean = '[ _\,\.\(\)\[\]\-]?(extended.cut|directors.cut|french|swedisch|danish|dutch|swesub|spanish|german|ac3|dts|custom|dc|divx|divx5|dsr|dsrip|dutch|dvd|dvdr|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip' \
|
||||
'|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|r3|r5|bd5|se|svcd|swedish|german|read.nfo|nfofix|unrated|ws|telesync|ts|telecine|tc|brrip|bdrip|video_ts|audio_ts|480p|480i|576p|576i|720p|720i|1080p|1080i|hrhd|hrhdtv|hddvd|bluray|x264|h264|xvid|xvidvd|xxx|www.www|cd[1-9]|\[.*\])([ _\,\.\(\)\[\]\-]|$)'
|
||||
multipart_regex = [
|
||||
'[ _\.-]+cd[ _\.-]*([0-9a-d]+)', #*cd1
|
||||
'[ _\.-]+dvd[ _\.-]*([0-9a-d]+)', #*dvd1
|
||||
'[ _\.-]+part[ _\.-]*([0-9a-d]+)', #*part1
|
||||
'[ _\.-]+dis[ck][ _\.-]*([0-9a-d]+)', #*disk1
|
||||
'cd[ _\.-]*([0-9a-d]+)$', #cd1.ext
|
||||
'dvd[ _\.-]*([0-9a-d]+)$', #dvd1.ext
|
||||
'part[ _\.-]*([0-9a-d]+)$', #part1.mkv
|
||||
'dis[ck][ _\.-]*([0-9a-d]+)$', #disk1.mkv
|
||||
'[ _\.-]+cd[ _\.-]*([0-9a-d]+)', #*cd1
|
||||
'[ _\.-]+dvd[ _\.-]*([0-9a-d]+)', #*dvd1
|
||||
'[ _\.-]+part[ _\.-]*([0-9a-d]+)', #*part1
|
||||
'[ _\.-]+dis[ck][ _\.-]*([0-9a-d]+)', #*disk1
|
||||
'cd[ _\.-]*([0-9a-d]+)$', #cd1.ext
|
||||
'dvd[ _\.-]*([0-9a-d]+)$', #dvd1.ext
|
||||
'part[ _\.-]*([0-9a-d]+)$', #part1.mkv
|
||||
'dis[ck][ _\.-]*([0-9a-d]+)$', #disk1.mkv
|
||||
'()[ _\.-]+([0-9]*[abcd]+)(\.....?)$',
|
||||
'([a-z])([0-9]+)(\.....?)$',
|
||||
'()([ab])(\.....?)$' #*a.mkv
|
||||
'()([ab])(\.....?)$' #*a.mkv
|
||||
]
|
||||
|
||||
cp_imdb = '(.cp.(?P<id>tt[0-9{7}]+).)'
|
||||
@@ -263,7 +263,7 @@ class Scanner(Plugin):
|
||||
delete_identifiers.append(identifier)
|
||||
|
||||
# Remove the found files from the leftover stack
|
||||
leftovers = leftovers - set([ff])
|
||||
leftovers -= leftovers - set([ff])
|
||||
|
||||
# Break if CP wants to shut down
|
||||
if self.shuttingDown():
|
||||
@@ -445,7 +445,7 @@ class Scanner(Plugin):
|
||||
files = list(group['files']['movie'])
|
||||
|
||||
for cur_file in files:
|
||||
if not self.filesizeBetween(cur_file, self.file_sizes['movie']): continue # Ignore smaller files
|
||||
if not self.filesizeBetween(cur_file, self.file_sizes['movie']): continue # Ignore smaller files
|
||||
|
||||
meta = self.getMeta(cur_file)
|
||||
|
||||
@@ -727,7 +727,9 @@ class Scanner(Plugin):
|
||||
if is_sample: log.debug('Is sample file: %s', filename)
|
||||
return is_sample
|
||||
|
||||
def filesizeBetween(self, file, file_size = []):
|
||||
def filesizeBetween(self, file, file_size = None):
|
||||
if not file_size: file_size = []
|
||||
|
||||
try:
|
||||
return (file_size.get('min', 0) * 1048576) < os.path.getsize(file) < (file_size.get('max', 100000) * 1048576)
|
||||
except:
|
||||
@@ -875,7 +877,7 @@ class Scanner(Plugin):
|
||||
except:
|
||||
pass
|
||||
|
||||
if not cp_guess: # Split name on multiple spaces
|
||||
if not cp_guess: # Split name on multiple spaces
|
||||
try:
|
||||
movie_name = cleaned.split(' ').pop(0).strip()
|
||||
cp_guess = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Score
|
||||
|
||||
|
||||
def start():
|
||||
return Score()
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ def nameScore(name, year, preferred_words):
|
||||
|
||||
return score
|
||||
|
||||
|
||||
def nameRatioScore(nzb_name, movie_name):
|
||||
nzb_words = re.split('\W+', fireEvent('scanner.create_file_identifier', nzb_name, single = True))
|
||||
movie_words = re.split('\W+', simplifyString(movie_name))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import StatusPlugin
|
||||
|
||||
|
||||
def start():
|
||||
return StatusPlugin()
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class StatusPlugin(Plugin):
|
||||
addEvent('status.get_by_id', self.getById)
|
||||
addEvent('status.all', self.all)
|
||||
addEvent('app.initialize', self.fill)
|
||||
addEvent('app.load', self.all) # Cache all statuses
|
||||
addEvent('app.load', self.all) # Cache all statuses
|
||||
|
||||
addApiView('status.list', self.list, docs = {
|
||||
'desc': 'Check for available update',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Subtitle
|
||||
|
||||
|
||||
def start():
|
||||
return Subtitle()
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Trailer
|
||||
|
||||
|
||||
def start():
|
||||
return Trailer()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Trailer(Plugin):
|
||||
destination = os.path.join(group['destination_dir'], filename)
|
||||
if not os.path.isfile(destination):
|
||||
trailer_file = fireEvent('file.download', url = trailer, dest = destination, urlopen_kwargs = {'headers': {'User-Agent': 'Quicktime'}}, single = True)
|
||||
if os.path.getsize(trailer_file) < (1024 * 1024): # Don't trust small trailers (1MB), try next one
|
||||
if os.path.getsize(trailer_file) < (1024 * 1024): # Don't trust small trailers (1MB), try next one
|
||||
os.unlink(trailer_file)
|
||||
continue
|
||||
else:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Userscript
|
||||
|
||||
|
||||
def start():
|
||||
return Userscript()
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class Userscript(Plugin):
|
||||
'excludes': fireEvent('userscript.get_excludes', merge = True),
|
||||
}
|
||||
|
||||
def getUserScript(self, route, **kwargs):
|
||||
def getUserScript(self, script_route, **kwargs):
|
||||
|
||||
klass = self
|
||||
|
||||
@@ -63,8 +63,7 @@ class Userscript(Plugin):
|
||||
|
||||
self.redirect(Env.get('api_base') + 'file.cache/couchpotato.user.js')
|
||||
|
||||
Env.get('app').add_handlers(".*$", [('%s%s' % (Env.get('api_base'), route), UserscriptHandler)])
|
||||
|
||||
Env.get('app').add_handlers(".*$", [('%s%s' % (Env.get('api_base'), script_route), UserscriptHandler)])
|
||||
|
||||
def getVersion(self):
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .main import Wizard
|
||||
|
||||
|
||||
def start():
|
||||
return Wizard()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user