Exemplo n.º 1
0
 def __init__(self):
     self.tmdb = TMDB()
     self.data_file = os.path.join(
         os.path.dirname(os.path.realpath(__file__)), 'imdb')
     self.date_format = '%a, %d %b %Y %H:%M:%S %Z'
     self.searcher = searcher.Searcher()
     return
Exemplo n.º 2
0
 def __init__(self):
     self.tmdb = movieinfo.TMDB()
     self.config = config.Config()
     self.metadata = library.Metadata()
     self.predb = predb.PreDB()
     self.searcher = searcher.Searcher()
     self.score = searchresults.Score()
     self.snatcher = snatcher.Snatcher()
     self.version = version.Version()
Exemplo n.º 3
0
 def __init__(self):
     self.omdb = Omdb()
     self.config = config.Config()
     self.predb = predb.PreDB()
     self.searcher = searcher.Searcher()
     self.sql = sqldb.SQL()
     self.poster = poster.Poster()
     self.snatcher = snatcher.Snatcher()
     self.update = updatestatus.Status()
Exemplo n.º 4
0
 def __init__(self):
     self.tmdb = TMDB()
     self.config = config.Config()
     self.library = library.ImportDirectory()
     self.predb = predb.PreDB()
     self.plugins = plugins.Plugins()
     self.searcher = searcher.Searcher()
     self.score = scoreresults.ScoreResults()
     self.sql = sqldb.SQL()
     self.poster = poster.Poster()
     self.snatcher = snatcher.Snatcher()
     self.update = updatestatus.Status()
Exemplo n.º 5
0
 def __init__(self):
     self.itunes = ITunes()
     self.config = config.Config()
     self.library = library.ImportDirectory()
     self.predb = predb.PreDB()
     self.plugins = plugins.Plugins()
     self.searcher = searcher.Searcher()
     self.score = scoreresults.ScoreResults()
     self.sql = sqldb.SQL()
     self.musicinfo = musicinfo.ITunes()
     self.snatcher = snatcher.Snatcher()
     self.update = updatestatus.Status()
Exemplo n.º 6
0
 def __init__(self):
     self.tmdb = TMDB()
     self.config = config.Config()
     self.metadata = library.Metadata()
     self.predb = predb.PreDB()
     self.plugins = plugins.Plugins()
     self.searcher = searcher.Searcher()
     self.score = searchresults.Score()
     self.sql = sqldb.SQL()
     self.library = library
     self.poster = poster.Poster()
     self.snatcher = snatcher.Snatcher()
     self.update = library.Status()
Exemplo n.º 7
0
    def create():
        search = searcher.Searcher()
        interval = int(core.CONFIG['Search']['searchfrequency']) * 3600

        hr = int(core.CONFIG['Search']['searchtimehr'])
        min = int(core.CONFIG['Search']['searchtimemin'])

        task_search = taskscheduler.ScheduledTask(hr,
                                                  min,
                                                  interval,
                                                  search.auto_search_and_grab,
                                                  auto_start=True)

        # update core.NEXT_SEARCH
        delay = task_search.task.delay
        now = datetime.datetime.today().replace(second=0, microsecond=0)
        core.NEXT_SEARCH = now + datetime.timedelta(0, delay)
Exemplo n.º 8
0
    def create():
        search = searcher.Searcher()
        interval = core.CONFIG['Search']['rsssyncfrequency'] * 60

        now = datetime.datetime.today()
        hr = now.hour
        min = now.minute + 5

        task_search = taskscheduler.ScheduledTask(hr,
                                                  min,
                                                  interval,
                                                  search.auto_search_and_grab,
                                                  auto_start=True)

        # update core.NEXT_SEARCH
        delay = task_search.task.delay
        now = datetime.datetime.today().replace(second=0, microsecond=0)
        core.NEXT_SEARCH = now + datetime.timedelta(0, delay)
Exemplo n.º 9
0
import core
import os
import time
from base64 import b16encode

from core import searcher, postprocessing
from core.rss import imdb, popularmovies
from core.cp_plugins.taskscheduler import SchedulerPlugin
from core import trakt
from core.library import Metadata

logging = logging.getLogger(__name__)

md = Metadata()
pp = postprocessing.Postprocessing()
search = searcher.Searcher()
imdb = imdb.ImdbRss()
popular_feed = popularmovies.PopularMoviesFeed()
trakt = trakt.Trakt()


def create_plugin():
    ''' Creates plugin instance, adds tasks, and subscribes to cherrypy.engine

    Does not return
    '''
    logging.info('Initializing scheduler plugin.')
    core.scheduler_plugin = SchedulerPlugin(cherrypy.engine,
                                            record_handler=record_handler)
    AutoSearch.create()
    AutoUpdateCheck.create()
Exemplo n.º 10
0
 def __init__(self):
     self.searcher = searcher.Searcher()
     return
Exemplo n.º 11
0
 def __init__(self):
     self.score = searchresults.Score()
     self.tmdb = TMDB()
     self.metadata = Metadata()
     self.poster = Poster()
     self.searcher = searcher.Searcher()
Exemplo n.º 12
0
    def default(self, **params):
        ''' Get handler for API calls

        params: kwargs must inlcude {'apikey': $, 'mode': $}

        Checks api key matches and other required keys are present based on
            mode. Then dispatches to correct method to handle request.
        '''

        logging.info('API request from {}'.format(
            cherrypy.request.headers['Remote-Addr']))

        serverkey = core.CONFIG['Server']['apikey']

        if 'apikey' not in params:
            logging.warning('API request failed, no key supplied.')
            return {'response': False, 'error': 'no api key supplied'}

        # check for api key
        if serverkey != params['apikey']:
            logging.warning('Invalid API key in request: {}'.format(
                params['apikey']))
            return {'response': False, 'error': 'incorrect api key'}

        # find what we are going to do
        if 'mode' not in params:
            return {'response': False, 'error': 'no api mode specified'}

        if params['mode'] == 'liststatus':

            if 'imdbid' in params:
                return self.liststatus(imdbid=params['imdbid'])
            else:
                return self.liststatus()

        elif params['mode'] == 'addmovie':
            if 'imdbid' not in params and 'tmdbid' not in params:
                return {'response': False, 'error': 'no movie id supplied'}
            if params.get('imdbid') and params.get('tmdbid'):
                return {
                    'response': False,
                    'error': 'multiple movie ids supplied'
                }
            else:
                quality = params.get('quality')
                if params.get('imdbid'):
                    return self.addmovie(imdbid=params['imdbid'],
                                         quality=quality)
                elif params.get('tmdbid'):
                    return self.addmovie(tmdbid=params['tmdbid'],
                                         quality=quality)
        elif params['mode'] == 'removemovie':
            if 'imdbid' not in params:
                return {'response': False, 'error': 'no imdbid supplied'}
            else:
                imdbid = params['imdbid']
            return self.removemovie(imdbid)

        elif params['mode'] == 'version':
            return self.version()

        elif params['mode'] == 'getconfig':
            return {'response': True, 'config': core.CONFIG}

        elif params['mode'] == 'server_shutdown':
            threading.Timer(1, core.shutdown).start()
            return {'response': True}

        elif params['mode'] == 'server_restart':
            threading.Timer(1, core.restart).start()
            return {'response': True}

        elif params['mode'] == 'debug':
            if params['debug'] == 'searcher':
                logging.debug("debugging searchers")
                search = searcher.Searcher()
                search.search_all()
                return {'response': True}

            if params['debug'] == 'torrentproviders':
                providers = TorrentProvider.__subclasses__()
                print(providers)
                return True

        else:
            return {'response': False, 'error': 'invalid mode'}
Exemplo n.º 13
0
 def __init__(self):
     self.tmdb = TMDB()
     self.searcher = searcher.Searcher()
     return