Ejemplo n.º 1
0
from app.config.cplog import CPLog
from app.lib.provider.yarr.base import nzbBase
from dateutil.parser import parse
from urllib import urlencode
from urllib2 import URLError
import time
import traceback
import urllib
import urllib2

log = CPLog(__name__)

class newzbin(nzbBase):
    """Api for newzbin"""

    name = 'Newzbin'
    searchUrl = 'https://www.newzbin.com/search/'
    downloadUrl = 'http://www.newzbin.com/api/dnzb/'

    formatIds = {
        2: ['scr'],
        1: ['cam'],
        4: ['tc'],
        8: ['ts'],
        1024: ['r5'],
    }
    catIds = {
        2097152: ['1080p'],
        524288: ['720p'],
        262144: ['brrip'],
        2: ['dvdr'],
Ejemplo n.º 2
0
def server_start():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-d', action = "store_true",
                 dest = 'daemonize', help = "Run the server as a daemon")
    p.add_option('-q', '--quiet', action = "store_true",
                 dest = 'quiet', help = "Don't log to console")
    p.add_option('-p', '--pidfile',
                 dest = 'pidfile', default = None,
                 help = "Store the process id in the given file")
    p.add_option('--config',
                 dest = 'config', default = None,
                 help = "Path to config.ini file")
    p.add_option('--datadir',
                 dest = 'datadir', default = None,
                 help = "Path to the data directory")


    options, args = p.parse_args()
    
    if options.datadir:
        datadir = options.datadir

        if not os.path.isdir(datadir):
            os.makedirs(datadir)

    else:
        datadir = rundir
	
    datadir = os.path.abspath(datadir)
    
    if not os.access(datadir, os.W_OK):
        raise SystemExit("Data dir must be writeable '" + datadir + "'")
    
    import app.config
    app.config.DATADIR = datadir
   
    if options.config:
        config = options.config
    else:
        config = os.path.join(datadir, 'config.ini')

    config = os.path.abspath(config)

    if not os.access(os.path.dirname(config), os.W_OK) and not os.access(config, os.W_OK):
        if not os.path.exists(os.path.dirname(config)):
            os.makedirs(os.path.dirname(config))
        else:
            raise SystemExit("Directory for config file must be writeable")

    import cherrypy
    import app.config.render

    # Configure logging
    from app.config.cplog import CPLog
    
    # Setup logging
    debug = os.path.isfile(os.path.join(datadir, 'debug.conf'))
    log = CPLog()
    log.config(os.path.join(datadir, 'logs'), debug)

    # Create cache dir
    cachedir = os.path.join(datadir, 'cache')
    if not os.path.isdir(cachedir):
        os.mkdir(cachedir)

    # Stop logging
    if options.quiet or options.daemonize:
        cherrypy.config.update({'log.screen': False})
    

    # Config app
    from app.config.configApp import configApp
    ca = configApp(config)

    # Setup db
    from app.config.db import initDb
    initDb()

    from app.config.routes import setup as Routes
    from app.lib.cron import CronJobs
    from app.config.updater import Updater
    from cherrypy.process import plugins

    # Check an see if CP is already running
    import socket
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    host = ca.get('global', 'host')
    port = int(ca.get('global', 'port'))
    try:
        s.connect((host, port))
        s.shutdown(0)
        app.launchBrowser(host, port)
        return
    except:
        pass

    # Start threads
    myCrons = CronJobs(cherrypy.engine, ca, debug)
    myCrons.subscribe()

    # Update script
    myUpdater = Updater(cherrypy.engine)
    myUpdater.subscribe()

    # User config, use own stuff to prevent unexpected results
    cherrypy.config.update({
        'global': {
            'server.thread_pool': 10,
            'server.socket_port': int(ca.get('global', 'port')),
            'server.socket_host': ca.get('global', 'host'),
            'server.environment': ca.get('global', 'server.environment'),
            'engine.autoreload_on': ca.get('global', 'server.environment') == 'development',
            'tools.mako.collection_size': 500,
            'tools.mako.directories': os.path.join(path_base, 'app', 'views'),

            'basePath': path_base,
            'runPath': rundir,
            'cachePath': cachedir,
            'debug': debug,
            'frozen': frozen,

            # Global workers
            'config': ca,
            'updater': myUpdater,
            'cron': myCrons.threads,
            'searchers': myCrons.searchers,
            'flash': app.flash()
        }
    })

    # Static config
    conf = {
        '/': {
            'request.dispatch': Routes(),
            'tools.sessions.on': True,
            'tools.sessions.timeout': 240,

            'tools.gzip.on': True,
            'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css', 'text/javascript', 'application/javascript']
        },
        '/media':{
            'tools.staticdir.on': True,
            'tools.staticdir.root': path_base,
            'tools.staticdir.dir': "media",
            'tools.expires.on': True,
            'tools.expires.secs': 3600 * 24 * 7
        },
        '/cache':{
            'tools.staticdir.on': True,
            'tools.staticdir.root': datadir,
            'tools.staticdir.dir': "cache",
            'tools.expires.on': True,
            'tools.expires.secs': 3600 * 24 * 7
        }
    }

    # Don't use auth when password is empty
    if ca.get('global', 'password') != '':
        conf['/'].update({
            'tools.basic_auth.on': True,
            'tools.basic_auth.realm': 'Awesomeness',
            'tools.basic_auth.users': {ca.get('global', 'username'):ca.get('global', 'password')},
            'tools.basic_auth.encrypt': app.clearAuthText
        })
        cherrypy.tools.mybasic_auth = cherrypy.Tool('on_start_resource', app.basicAuth)

    # I'll do my own logging, thanks!
    #cherrypy.log.error_log.propagate = False
    #cherrypy.log.access_log.propagate = False

    #No Root controller as we provided all our own.
    cherrypy.tree.mount(root = None, config = conf)

    #HTTP Errors
    def http_error_hander(status, message, traceback, version):
        args = [status, message, traceback, version]
        return "<html><body><h1>Error %s</h1>Something unexpected has happened.</body></html>" % args[0]
    cherrypy.config.update({'error_page.default' : http_error_hander})

    # Deamonize
    if options.daemonize:
        plugins.Daemonizer(cherrypy.engine).subscribe()

    # PIDfile
    if options.pidfile:
        plugins.PIDFile(cherrypy.engine, options.pidfile).subscribe()

    # Setup the signal handler
    if hasattr(cherrypy.engine, "signal_handler"):
        cherrypy.engine.signal_handler.subscribe()
    if hasattr(cherrypy.engine, "console_control_handler"):
        cherrypy.engine.console_control_handler.subscribe()

    ## start the app
    try:
        cherrypy.engine.start()
    except:
        sys.exit(1)
    else:

        # Launch browser
        if ca.get('global', 'launchbrowser'):
            app.launchBrowser(ca.get('global', 'host'), ca.get('global', 'port'))

        cherrypy.engine.block()
Ejemplo n.º 3
0
from sqlalchemy.sql.expression import or_
from app.lib import xbmc
from app.lib import prowl
from app.lib.xbmc import XBMC
from app.lib.prowl import PROWL
from app.lib.growl import GROWL
from app.lib.notifo import Notifo
from app.lib.nma import NMA
from app.lib.twitter import Twitter
import cherrypy
import datetime
import os
import time
import urllib

log = CPLog(__name__)

class YarrCron(cronBase, rss):

    ''' Cronjob for searching for nzb/torrents '''

    lastChecked = 0
    provider = None
    sabNzbd = None
    nzbGet = None
    intervalSec = 10
    checkTheseMovies = []
    stop = False

    def run(self):
        log.info('YarrCron thread is running.')
Ejemplo n.º 4
0
from app.lib.qualities import Qualities
from app.lib.xbmc import XBMC
from app.lib.nmj import NMJ
from app.lib.plex import PLEX
from app.lib.prowl import PROWL
from app.lib.growl import GROWL
from app.lib.notifo import Notifo
from app.lib.boxcar import Boxcar
from app.lib.nma import NMA
from app.lib.twitter import Twitter
from app.lib.trakt import Trakt
import cherrypy
import json
import sys

log = CPLog(__name__)


class ConfigController(BaseController):
    @cherrypy.expose
    @cherrypy.tools.mako(filename="config/index.html")
    def index(self):
        '''
        Config form
        '''
        config = cherrypy.config.get('config')

        renamer = self.cron.get('renamer')
        replacements = {
            'cd': ' cd1',
            'cdNr': ' 1',
Ejemplo n.º 5
0
def server_start():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option('-d',
                 action="store_true",
                 dest='daemonize',
                 help="Run the server as a daemon")
    p.add_option('-q',
                 '--quiet',
                 action="store_true",
                 dest='quiet',
                 help="Don't log to console")
    p.add_option('--nolaunch',
                 action="store_true",
                 dest='nolaunch',
                 help="Don't start browser")
    p.add_option('-p',
                 '--pidfile',
                 dest='pidfile',
                 default=None,
                 help="Store the process id in the given file")
    p.add_option('--config',
                 dest='config',
                 default=None,
                 help="Path to config.ini file")
    p.add_option('--datadir',
                 dest='datadir',
                 default=None,
                 help="Path to the data directory")
    p.add_option('--port',
                 dest='port',
                 default=None,
                 help="Force webinterface to listen on this port")

    options, args = p.parse_args()

    if options.datadir:
        datadir = options.datadir

        if not os.path.isdir(datadir):
            os.makedirs(datadir)

    else:
        datadir = rundir

    datadir = os.path.abspath(datadir)

    if not os.access(datadir, os.W_OK):
        raise SystemExit("Data dir must be writeable '" + datadir + "'")

    import app.config
    app.config.DATADIR = datadir

    if options.config:
        config = options.config
    else:
        config = os.path.join(datadir, 'config.ini')

    config = os.path.abspath(config)

    if not os.access(os.path.dirname(config), os.W_OK) and not os.access(
            config, os.W_OK):
        if not os.path.exists(os.path.dirname(config)):
            os.makedirs(os.path.dirname(config))
        else:
            raise SystemExit("Directory for config file must be writeable")

    import cherrypy
    import app.config.render

    # Configure logging
    from app.config.cplog import CPLog

    # Setup logging
    debug = os.path.isfile(os.path.join(datadir, 'debug.conf'))
    log = CPLog()
    log.config(os.path.join(datadir, 'logs'), debug)

    # Create cache dir
    cachedir = os.path.join(datadir, 'cache')
    if not os.path.isdir(cachedir):
        os.mkdir(cachedir)

    # Stop logging
    if options.quiet or options.daemonize:
        cherrypy.config.update({'log.screen': False})
    else:
        cherrypy.config.update({'log.screen': True})

    # Config app
    from app.config.configApp import configApp
    ca = configApp(config)

    # Setup db
    from app.config.db import initDb
    initDb()

    from app.config.routes import setup as Routes
    from app.lib.cron import CronJobs
    from app.config.updater import Updater
    from cherrypy.process import plugins

    # setup hostaddress
    if options.port:
        port = int(options.port)
    else:
        port = int(ca.get('global', 'port'))

    # Check an see if CP is already running
    import socket
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    host = ca.get('global', 'host')
    try:
        s.connect((host, port))
        s.shutdown(0)
        if not options.nolaunch:
            app.launchBrowser(host, port)
        return
    except:
        pass

    # Start threads
    myCrons = CronJobs(cherrypy.engine, ca, debug)
    myCrons.subscribe()

    # Update script
    myUpdater = Updater(cherrypy.engine)
    myUpdater.subscribe()

    # User config, use own stuff to prevent unexpected results
    cherrypy.config.update({
        'global': {
            'server.thread_pool': 10,
            'server.socket_port': port,
            'server.socket_host': ca.get('global', 'host'),
            'server.environment': ca.get('global', 'server.environment'),
            'engine.autoreload_on':
            ca.get('global', 'server.environment') == 'development',
            'tools.mako.collection_size': 500,
            'tools.mako.directories': os.path.join(path_base, 'app', 'views'),
            'basePath': path_base,
            'runPath': rundir,
            'cachePath': cachedir,
            'debug': debug,
            'frozen': frozen,

            # Global workers
            'config': ca,
            'updater': myUpdater,
            'cron': myCrons.threads,
            'searchers': myCrons.searchers,
            'flash': app.flash()
        }
    })

    # Static config
    conf = {
        '/': {
            'request.dispatch':
            Routes(),
            'tools.sessions.on':
            True,
            'tools.sessions.timeout':
            240,
            'tools.gzip.on':
            True,
            'tools.gzip.mime_types': [
                'text/html', 'text/plain', 'text/css', 'text/javascript',
                'application/javascript'
            ]
        },
        '/media': {
            'tools.staticdir.on': True,
            'tools.staticdir.root': path_base,
            'tools.staticdir.dir': "media",
            'tools.expires.on': True,
            'tools.expires.secs': 3600 * 24 * 7
        },
        '/cache': {
            'tools.staticdir.on': True,
            'tools.staticdir.root': datadir,
            'tools.staticdir.dir': "cache",
            'tools.expires.on': True,
            'tools.expires.secs': 3600 * 24 * 7
        }
    }

    # Don't use auth when password is empty
    if ca.get('global', 'password') != '':
        conf['/'].update({
            'tools.basic_auth.on': True,
            'tools.basic_auth.realm': 'Awesomeness',
            'tools.basic_auth.users': {
                ca.get('global', 'username'): ca.get('global', 'password')
            },
            'tools.basic_auth.encrypt': app.clearAuthText
        })
        cherrypy.tools.mybasic_auth = cherrypy.Tool('on_start_resource',
                                                    app.basicAuth)

    # I'll do my own logging, thanks!
    #cherrypy.log.error_log.propagate = False
    #cherrypy.log.access_log.propagate = False

    #No Root controller as we provided all our own.
    cherrypy.tree.mount(root=None, config=conf)

    #HTTP Errors
    def http_error_hander(status, message, traceback, version):
        args = [status, message, traceback, version]
        return "<html><body><h1>Error %s</h1>Something unexpected has happened.</body></html>" % args[
            0]

    cherrypy.config.update({'error_page.default': http_error_hander})

    # Deamonize
    if options.daemonize:
        plugins.Daemonizer(cherrypy.engine).subscribe()

    # PIDfile
    if options.pidfile:
        plugins.PIDFile(cherrypy.engine, options.pidfile).subscribe()

    # Setup the signal handler
    if hasattr(cherrypy.engine, "signal_handler"):
        if not options.quiet and not options.daemonize:
            cherrypy.engine.signal_handler.set_handler(
                signal='SIGINT',
                listener=cherrypy.engine.signal_handler.bus.exit)
        cherrypy.engine.signal_handler.subscribe()
    if hasattr(cherrypy.engine, "console_control_handler"):
        cherrypy.engine.console_control_handler.subscribe()

    ## start the app
    try:
        cherrypy.engine.start()
    except:
        sys.exit(1)
    else:

        # Launch browser
        if not options.nolaunch:
            if ca.get('global', 'launchbrowser'):
                app.launchBrowser(ca.get('global', 'host'), port)

        cherrypy.engine.block()
Ejemplo n.º 6
0
from app.lib.xbmc import XBMC
from app.lib.prowl import PROWL
from app.lib.growl import GROWL
from app.lib.notifo import Notifo
from app.lib.sns import SNS
from app.lib.boxcar import Boxcar
from app.lib.nma import NMA
from app.lib.nmwp import NMWP
from app.lib.twitter import Twitter
import cherrypy
import datetime
import os
import time
import urllib

log = CPLog(__name__)


class YarrCron(cronBase, rss):
    ''' Cronjob for searching for nzb/torrents '''

    lastChecked = 0
    provider = None
    sabNzbd = None
    nzbGet = None
    intervalSec = 10
    checkTheseMovies = []
    stop = False

    def run(self):
        log.info('YarrCron thread is running.')
Ejemplo n.º 7
0
def server_start():
    from optparse import OptionParser

    p = OptionParser()
    p.add_option("-d", action="store_true", dest="daemonize", help="Run the server as a daemon")
    p.add_option("-q", "--quiet", action="store_true", dest="quiet", help="Don't log to console")
    p.add_option("-p", "--pidfile", dest="pidfile", default=None, help="Store the process id in the given file")
    p.add_option("--config", dest="config", default=None, help="Path to config.ini file")
    p.add_option("--datadir", dest="datadir", default=None, help="Path to the data directory")

    options, args = p.parse_args()

    if options.datadir:
        datadir = options.datadir

        if not os.path.isdir(datadir):
            os.makedirs(datadir)

    else:
        datadir = rundir

    datadir = os.path.abspath(datadir)

    if not os.access(datadir, os.W_OK):
        raise SystemExit("Data dir must be writeable '" + datadir + "'")

    import app.config

    app.config.DATADIR = datadir

    if options.config:
        config = options.config
    else:
        config = os.path.join(datadir, "config.ini")

    config = os.path.abspath(config)

    if not os.access(os.path.dirname(config), os.W_OK) and not os.access(config, os.W_OK):
        if not os.path.exists(os.path.dirname(config)):
            os.makedirs(os.path.dirname(config))
        else:
            raise SystemExit("Directory for config file must be writeable")

    import cherrypy
    import app.config.render

    # Configure logging
    from app.config.cplog import CPLog

    # Setup logging
    debug = os.path.isfile(os.path.join(datadir, "debug.conf"))
    log = CPLog()
    log.config(os.path.join(datadir, "logs"), debug)

    # Create cache dir
    cachedir = os.path.join(datadir, "cache")
    if not os.path.isdir(cachedir):
        os.mkdir(cachedir)

    # Stop logging
    if options.quiet or options.daemonize:
        cherrypy.config.update({"log.screen": False})

    # Config app
    from app.config.configApp import configApp

    ca = configApp(config)

    # Setup db
    from app.config.db import initDb

    initDb()

    from app.config.routes import setup as Routes
    from app.lib.cron import CronJobs
    from app.config.updater import Updater
    from cherrypy.process import plugins

    # Check an see if CP is already running
    import socket

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    host = ca.get("global", "host")
    port = int(ca.get("global", "port"))
    try:
        s.connect((host, port))
        s.shutdown(0)
        app.launchBrowser(host, port)
        return
    except:
        pass

    # Start threads
    myCrons = CronJobs(cherrypy.engine, ca, debug)
    myCrons.subscribe()

    # Update script
    myUpdater = Updater(cherrypy.engine)
    myUpdater.subscribe()

    # User config, use own stuff to prevent unexpected results
    cherrypy.config.update(
        {
            "global": {
                "server.thread_pool": 10,
                "server.socket_port": int(ca.get("global", "port")),
                "server.socket_host": ca.get("global", "host"),
                "server.environment": ca.get("global", "server.environment"),
                "engine.autoreload_on": ca.get("global", "server.environment") == "development",
                "tools.mako.collection_size": 500,
                "tools.mako.directories": os.path.join(path_base, "app", "views"),
                "basePath": path_base,
                "runPath": rundir,
                "cachePath": cachedir,
                "debug": debug,
                "frozen": frozen,
                # Global workers
                "config": ca,
                "updater": myUpdater,
                "cron": myCrons.threads,
                "searchers": myCrons.searchers,
                "flash": app.flash(),
            }
        }
    )

    # Static config
    conf = {
        "/": {
            "request.dispatch": Routes(),
            "tools.sessions.on": True,
            "tools.sessions.timeout": 240,
            "tools.gzip.on": True,
            "tools.gzip.mime_types": [
                "text/html",
                "text/plain",
                "text/css",
                "text/javascript",
                "application/javascript",
            ],
        },
        "/media": {
            "tools.staticdir.on": True,
            "tools.staticdir.root": path_base,
            "tools.staticdir.dir": "media",
            "tools.expires.on": True,
            "tools.expires.secs": 3600 * 24 * 7,
        },
        "/cache": {
            "tools.staticdir.on": True,
            "tools.staticdir.root": datadir,
            "tools.staticdir.dir": "cache",
            "tools.expires.on": True,
            "tools.expires.secs": 3600 * 24 * 7,
        },
    }

    # Don't use auth when password is empty
    if ca.get("global", "password") != "":
        conf["/"].update(
            {
                "tools.basic_auth.on": True,
                "tools.basic_auth.realm": "Awesomeness",
                "tools.basic_auth.users": {ca.get("global", "username"): ca.get("global", "password")},
                "tools.basic_auth.encrypt": app.clearAuthText,
            }
        )
        cherrypy.tools.mybasic_auth = cherrypy.Tool("on_start_resource", app.basicAuth)

    # I'll do my own logging, thanks!
    # cherrypy.log.error_log.propagate = False
    # cherrypy.log.access_log.propagate = False

    # No Root controller as we provided all our own.
    cherrypy.tree.mount(None, cherrypy.config.get("config").get("global", "urlbase"), config=conf)

    # HTTP Errors
    def http_error_hander(status, message, traceback, version):
        args = [status, message, traceback, version]
        return "<html><body><h1>Error %s</h1>Something unexpected has happened.</body></html>" % args[0]

    cherrypy.config.update({"error_page.default": http_error_hander})

    # Deamonize
    if options.daemonize:
        plugins.Daemonizer(cherrypy.engine).subscribe()

    # PIDfile
    if options.pidfile:
        plugins.PIDFile(cherrypy.engine, options.pidfile).subscribe()

    # Setup the signal handler
    if hasattr(cherrypy.engine, "signal_handler"):
        cherrypy.engine.signal_handler.subscribe()
    if hasattr(cherrypy.engine, "console_control_handler"):
        cherrypy.engine.console_control_handler.subscribe()

    ## start the app
    try:
        cherrypy.engine.start()
    except:
        sys.exit(1)
    else:

        # Launch browser
        if ca.get("global", "launchbrowser"):
            app.launchBrowser(ca.get("global", "host"), ca.get("global", "port"))

        cherrypy.engine.block()
Ejemplo n.º 8
0
from app.config.cplog import CPLog
import cherrypy
import urllib
import urllib2
import telnetlib
import re

log = CPLog(__name__)

try:
    import xml.etree.cElementTree as etree
except ImportError:
    import xml.etree.ElementTree as etree


class NMJ:

    host = ''
    database = ''
    mount = ''

    def __init__(self):
        self.enabled = self.conf('enabled')
        self.host = self.conf('host')
        self.database = self.conf('database')
        self.mount = self.conf('mount')
        pass

    def conf(self, options):
        return cherrypy.config['config'].get('NMJ', options)
Ejemplo n.º 9
0
from app.config.cplog import CPLog
import cherrypy
import urllib
import urllib2
import telnetlib
import re

log = CPLog(__name__)

try:
    import xml.etree.cElementTree as etree
except ImportError:
    import xml.etree.ElementTree as etree

class NMJ:

    host = ''
    database = ''
    mount = ''

    def __init__(self):
        self.enabled = self.conf('enabled');
        self.host = self.conf('host')
        self.database = self.conf('database')
        self.mount = self.conf('mount')
        pass

    def conf(self, options):
        return cherrypy.config['config'].get('NMJ', options)

    def auto(self, host):
Ejemplo n.º 10
0
from app.config.cplog import CPLog
import socket

from base64 import standard_b64encode
import xmlrpclib
import urllib2
import StringIO, gzip, zlib

log = CPLog(__name__)

class nzbGet():

    config = {}

    def __init__(self, config):
        self.config = config

    def conf(self, option):
        return self.config.get('Nzbget', option)

    def send(self, nzb):
        log.info("Sending '%s' to nzbGet." % nzb.name)

        if self.isDisabled():
            log.error("Config properties are not filled in correctly.")
            return False

        nzbGetXMLrpc = "http://*****:*****@%(host)s/xmlrpc"

        url = nzbGetXMLrpc % {"host": self.conf('host'), "password": self.conf('password')}
Ejemplo n.º 11
0
# Define path based on frozen state
if frozen:
    path_base = os.environ['_MEIPASS2']
    rundir = os.path.dirname(sys.executable)
    #path_base = os.path.dirname(sys.executable)
else:
    path_base = rundir

# Include paths
sys.path.insert(0, path_base)
sys.path.insert(0, os.path.join(path_base, 'library'))

# Configure logging
from app.config.cplog import CPLog
debug = os.path.isfile(os.path.join(path_base, 'debug.conf'))
log = CPLog()
log.config(os.path.join(rundir, 'logs'), debug)

# Create cache dir
cachedir = os.path.join(rundir, 'cache')
if not os.path.isdir(cachedir):
    os.mkdir(cachedir)

import cherrypy
import app.config.render
from app.config.db import initDb
from optparse import OptionParser
from app.config.configApp import configApp
from app.config.routes import setup as Routes
from app.lib.cron import CronJobs
from app.config.updater import Updater
Ejemplo n.º 12
0
from app.config.cplog import CPLog
import socket

from base64 import standard_b64encode
import xmlrpclib
import urllib2
import StringIO, gzip, zlib

log = CPLog(__name__)


class nzbGet():

    config = {}

    def __init__(self, config):
        self.config = config

    def conf(self, option):
        return self.config.get('Nzbget', option)

    def send(self, nzb):
        log.info("Sending '%s' to nzbGet." % nzb.name)

        if self.isDisabled():
            log.error("Config properties are not filled in correctly.")
            return False

        nzbGetXMLrpc = "http://*****:*****@%(host)s/xmlrpc"

        url = nzbGetXMLrpc % {
Ejemplo n.º 13
0
from app import version
from app.config.cplog import CPLog
from app.lib.provider.rss import rss
from cherrypy.process.plugins import SimplePlugin
from git.repository import LocalRepository
from imdb.parser.http.bsouplxml._bsoup import BeautifulSoup
from urllib2 import URLError
import cherrypy
import os
import re
import shutil
import tarfile
import time
import urllib2

log = CPLog(__name__)

class Updater(rss, SimplePlugin):

    git = 'git://github.com/brototyp/CouchPotato.git'
    url = 'https://github.com/brototyp/CouchPotato/tarball/german'
    downloads = 'https://github.com/brototyp/CouchPotato/downloads'
    timeout = 10
    running = False
    version = None
    updateAvailable = False
    updateVersion = None
    availableString = None
    lastCheck = 0

    def __init__(self, bus):
Ejemplo n.º 14
0
from app.config.cplog import CPLog
from cherrypy.lib.auth import check_auth
import ConfigParser
import cherrypy
import os.path
import webbrowser

log = CPLog()


def clearAuthText(mypass):
    return mypass


def basicAuth(realm, users, encrypt=None):
    if check_auth(users, encrypt):
        return
    else:
        return


def launchBrowser(host, port):

    if host == '0.0.0.0':
        host = 'localhost'

    url = 'http://%s:%d' % (host, int(port))
    try:
        webbrowser.open(url, 2, 1)
    except:
        try:
Ejemplo n.º 15
0
from app.config.cplog import CPLog
from app.lib.provider.rss import rss
from imdb.parser.http.bsouplxml._bsoup import SoupStrainer, BeautifulSoup
from string import letters, digits
from urllib import urlencode
from urllib2 import URLError
import re
import urllib2

log = CPLog(__name__)

class HdTrailers(rss):

    apiUrl = 'http://www.hd-trailers.net/movie/%s/'
    backupUrl = 'http://www.hd-trailers.net/blog/'
    providers = ['apple.ico', 'yahoo.ico', 'moviefone.ico', 'myspace.ico', 'favicon.ico']

    def __init__(self, config):
        self.config = config

    def conf(self, value):
        return self.config.get('Trailer', value)

    def find(self, movie):

        url = self.apiUrl % self.movieUrlName(movie.name)
        log.debug('Searching %s' % url)

        try:
            data = urllib2.urlopen(url, timeout = self.timeout).read()
        except (IOError, URLError), e: