コード例 #1
0
    def __init__(self, dbdata=[], show_type='current'):
        typelist = ('new', 'nondb', 'current')
        if show_type not in typelist:
            raise Exception('incorrect show type')

        if show_type == 'current':
            self._set_db_data(dbdata)
            self._get_thetvdb_series_data()
            self.search_provider = Search()
        elif show_type == 'nondb':
            self.search_provider = Search()

        self.console_columns = Config.console_columns

        self.db = DB
コード例 #2
0
ファイル: history.py プロジェクト: getecer/tv-overlord
    def download(self):
        title = 'Re-download'
        selected = self.display_list(title, download=True)

        url = selected[-1]
        search = Search()
        search.download(chosen_show=url, destination=Config.staging)
コード例 #3
0
    def download(self):
        title = 'Re-download'
        choice, data = self.display_list(title, table_type='redownload')

        selected = [i for i in data[1] if choice in i][0]

        url = selected[-1]
        search = Search()
        search.download(chosen_show=url, destination=Config.staging)
コード例 #4
0
    def __init__(self, dbdata=[], show_type='current'):
        typelist = ('new', 'nondb', 'current')
        if show_type not in typelist:
            raise Exception('incorrect show type')

        cache = Config.use_cache
        if Config.use_cache:
            # set to a dir since the default location does not work.
            cache = Config.user_dir
        self.tvapi = tvdb_api.Tvdb(apikey=Config.thetvdb_apikey, cache=cache)

        if show_type == 'current':
            self._set_db_data(dbdata)
            self._get_thetvdb_series_data()
            self.search_provider = Search()
        elif show_type == 'nondb':
            self.search_provider = Search()

        self.show_type = show_type
        self.console_columns = Config.console_columns

        self.db = DB
コード例 #5
0
def config(edit, test_se, show, create_config_name):
    """tvol's config information.

    Show information of where various files are, (config.ini,
    database) and a list of the search engines and the url's they use.
    """
    send(te, v)

    if create_config_name:
        Config.create_config(create_config_name, create=True)
        return

    if edit:
        click.edit(filename=Config.user_config)
        return

    if test_se:
        search = Search()
        search.test_each(test_se, show)
        return

    import shutil

    title = 'green'
    bold = True
    ul = True

    # file locations
    click.echo()
    click.secho('File locations:', fg=title, bold=bold, underline=ul)
    click.echo()

    click.echo('config file:     %s' % Config.user_config)
    click.echo('Database file:   %s' % Config.db_file)
    click.echo('NZB staging dir: %s' % Config.staging)
    click.echo('TV dir:          %s' % Config.tv_dir)
    click.echo('Alt client:      %s' % Config.client)
    click.echo('Magnet dir:      %s' % Config.magnet_dir)
    click.echo('Template:        %s' % Config.template)

    click.echo()
    for script in ['tvol', 'transmission_done', 'deluge_done']:
        loc = shutil.which(script)
        script = script + ':'
        click.echo('%s %s' % (script.ljust(18), loc))

    # config sets
    files = [f for f in os.listdir(Config.user_dir)
             if re.match('^.*\..*\.(sqlite3|ini)', f)]
    files.sort(key=lambda f: f.split('.')[1])
    if files:
        click.echo()
        click.secho('Config sets', fg=title, bold=bold, underline=ul)
        click.echo()
        count = 1
        for gr, items in groupby(files, key=lambda f: f.split('.')[1]):
            config_set = ', '.join(list(items))
            click.echo('%s. %s' % (count, config_set))
            count += 1

    # search engines
    click.echo()
    click.secho('Search engines:', fg=title, bold=bold, underline=ul)
    search = Search()
    engines_types = [search.torrent_engines, search.newsgroup_engines]
    for engines in engines_types:
        for engine in engines:
            click.echo()
            click.secho(engine.name, bold=True, nl=False)
            click.echo(' (%s)' % engine.shortname)
            try:
                for url in engine.provider_urls:
                    click.echo('  %s' % url)
            except AttributeError:
                # there is no provider_urls.  Most likely an nzb
                # search engine which only uses one url: engine.url.
                click.echo('  %s' % engine.url)

    # blacklisted search engines
    if Config.blacklist:
        click.echo()
        click.secho('Search engine blacklist:',
                    fg=title, bold=bold, underline=ul)
        click.echo()
        for bl in Config.blacklist:
            click.echo(bl)

    # ip addresses
    click.echo()
    click.secho('Ip address information:',
                fg=title, bold=bold, underline=ul)
    click.echo()

    l = Location()
    click.echo('Your public ip address:')
    click.secho('  %s' % l.ip, bold=True)
    if Config.warnvpn:
        click.echo()
        click.echo('Your whitelisted ip addresses:')
        whitelist = DB.get_config('ip_whitelist')
        short = '.'.join(l.ip.split('.')[:Config.parts_to_match])
        for ip in whitelist:
            color = None
            if ip.startswith(short):
                color = 'green'
            click.secho('  %s' % ip, fg=color)
コード例 #6
0
def config(edit, test_se):
    """tvol's config information.

    Show information of where various files are, (config.ini,
    database) and a list of the search engines and the url's they use.
    """

    if edit:
        click.edit(filename=Config.user_config)
        return

    if test_se:
        search = Search()
        search.test_each(test_se)
        return

    import shutil

    title = 'green'
    bold = True
    ul = True

    # file locations
    click.echo()
    click.secho('File locations:', fg=title, bold=bold, underline=ul)
    click.echo()

    click.echo('config file:     %s' % Config.user_config)
    click.echo('Database file:   %s' % Config.db_file)
    click.echo('NZB staging dir: %s' % Config.staging)
    click.echo('TV dir:          %s' % Config.tv_dir)
    click.echo('Alt client:      %s' % Config.client)
    click.echo('Magnet dir:      %s' % Config.magnet_dir)
    click.echo('Template:        %s' % Config.template)

    click.echo()
    for script in ['tvol', 'transmission_done', 'deluge_done']:
        loc = shutil.which(script)
        script = script + ':'
        click.echo('%s %s' % (script.ljust(18), loc))

    # search engines
    click.echo()
    click.secho('Search engines:', fg=title, bold=bold, underline=ul)
    search = Search()
    engines_types = [search.torrent_engines, search.newsgroup_engines]
    for engines in engines_types:
        for engine in engines:
            click.echo()
            click.secho(engine.Provider.name, bold=True, nl=False)
            click.echo(' (%s)' % engine.Provider.shortname)
            for url in engine.Provider.provider_urls:
                click.echo('  %s' % url)

    # blacklisted search engines
    if Config.blacklist:
        click.echo()
        click.secho('Search engine blacklist:',
                    fg=title,
                    bold=bold,
                    underline=ul)
        click.echo()
        for bl in Config.blacklist:
            click.echo(bl)

    # ip addresses
    click.echo()
    click.secho('Ip address information:', fg=title, bold=bold, underline=ul)
    click.echo()

    l = Location()
    click.echo('Your public ip address:')
    click.secho('  %s' % l.ip, bold=True)
    if Config.ip:
        click.echo()
        click.echo('Your whitelisted ip addresses:')
        short = '.'.join(l.ip.split('.')[:Config.parts_to_match])
        for ip in Config.ip:
            color = None
            if ip.startswith(short):
                color = 'green'
            click.secho('  %s' % ip, fg=color)