def __init__(self): self.nn = newznab.NewzNab() self.score = searchresults.Score() self.sql = sqldb.SQL() self.predb = predb.PreDB() self.snatcher = snatcher.Snatcher() self.torrent = torrent.Torrent() self.update = library.Status()
import datetime import logging import PTN import re import core from core import searchresults, snatcher, proxy from core.library import Manage from core.providers import torrent, newznab from core.rss import predb from stringscore import liquidmetal as lm logging = logging.getLogger(__name__) nn = newznab.NewzNab() torrent = torrent.Torrent() def _t_search_grab(movie): ''' Run verify/search/snatch chain movie (dict): movie to run search for Meant to be executed *IN ITS OWN THREAD* after adding a movie from user-input (ie api, search) so the main thread is not tied up. Does not return ''' logging.info('Executing automatic search/grab for {}.'.format( movie['title'])) if core.CONFIG['Search']['verifyreleases'] == 'predb':
def __init__(self): self.nn = newznab.NewzNab() self.score = searchresults.Score() self.predb = predb.PreDB() self.snatcher = snatcher.Snatcher() self.torrent = torrent.Torrent()
def settings(self, *path): page = path[0] if len(path) > 0 else 'server' tor = torrent.Torrent() if page == 'server': themes = [ i[:-4] for i in os.listdir('static/css/themes/') if i.endswith('.css') and os.path.isfile( os.path.join(core.PROG_PATH, 'static/css/themes', i)) ] return App.server_template.render(config=core.CONFIG['Server'], themes=themes, version=core.CURRENT_HASH or '', languages=core.LANGUAGES.keys(), **self.defaults()) elif page == 'search': return App.search_template.render(config=core.CONFIG['Search'], **self.defaults()) elif page == 'quality': return App.quality_template.render(config=core.CONFIG['Quality'], sources=core.SOURCES, **self.defaults()) elif page == 'indexers': return App.indexers_template.render( config=core.CONFIG['Indexers'], providers=tor.get_torrent_providers(), **self.defaults()) elif page == 'downloader': return App.downloader_template.render( config=core.CONFIG['Downloader'], **self.defaults()) elif page == 'postprocessing': return App.postprocessing_template.render( config=core.CONFIG['Postprocessing'], os=core.PLATFORM, **self.defaults()) elif page == 'plugins': plugs = plugins.list_plugins() return App.plugins_template.render(config=core.CONFIG['Plugins'], plugins=plugs, **self.defaults()) elif page == 'logs': logdir = os.path.join(core.PROG_PATH, core.LOG_DIR) logfiles = [ i for i in os.listdir(logdir) if os.path.isfile(os.path.join(logdir, i)) ] return App.logs_template.render(logdir=logdir, logfiles=logfiles, **self.defaults()) elif page == 'download_log': if len(path) > 1: l = os.path.join(os.path.abspath(core.LOG_DIR), path[1]) return cherrypy.lib.static.serve_file( l, 'application/x-download', 'attachment') else: raise cherrypy.HTTPError(400) elif page == 'system': tasks = {} for name, obj in core.scheduler_plugin.task_list.items(): tasks[name] = { 'name': name, 'interval': obj.interval, 'last_execution': obj.last_execution, 'enabled': obj.timer.is_alive() if obj.timer else False } system = { 'database': { 'file': core.DB_FILE, 'size': os.path.getsize(core.DB_FILE) / 1024 }, 'config': { 'file': core.CONF_FILE }, 'system': { 'path': core.PROG_PATH, 'arguments': sys.argv, 'version': sys.version[:5] } } t = int(time.time()) dt = time.strftime('%a, %B %d, %Y %H:%M:%S %z', time.localtime(t)) return App.system_template.render(tasks=json.dumps(tasks), system=system, server_time=[dt, t], **self.defaults()) else: return self.error_page_404()