def download(show_name, today, ignore, count, exclude, filters): """Download available episodes. If SHOW_NAME is used, it will download any shows that match that title """ send(te, v) if not ignore and Config.warnvpn: L = Location() if Config.warnvpn: if not L.ips_match( parts_to_match=Config.parts_to_match): if not L.message(): sys.exit(1) if exclude: blacklist = [ i.strip().lower() for i in exclude.split(',') if i.strip()] Config.blacklist = list(set(Config.blacklist + blacklist)) if filters: Config.filter_list = [ i.strip().lower() for i in filters.split(',') if i.strip()] shows = Shows(name_filter=show_name) for show in shows: show.download_missing(count, today)
def download(show_name, today, ignore, count): """Download available episodes. If SHOW_NAME is used, it will download any shows that match that title """ send(te, v) if not ignore and Config.warnvpn: L = Location() if Config.warnvpn: if not L.ips_match(parts_to_match=Config.parts_to_match): if not L.message(): sys.exit(1) shows = Shows(name_filter=show_name) for show in shows: show.download_missing(count, today)
def nondb(search_string, count, ignore): """Download anything, ignoring the database. This just does a simple search and passes you choise to the bittorrent client. The download is not recorded in the database. """ send(te, v) if not search_string: raise click.UsageError('Empty "search_string" not allowed.') if not ignore and Config.warnvpn: L = Location() if Config.warnvpn: if not L.ips_match(parts_to_match=Config.parts_to_match): if not L.message(): sys.exit(1) nons = Show(show_type='nondb') nons.non_db(search_string, count)
def nondbshow(search_string, count, ignore): """Download anything, ignoring the database. This just does a simple search and passes you choise to the bittorrent client. The download is not recorded in the database. """ send(te, v) if not search_string: raise click.UsageError('Empty "search_string" not allowed.') if not ignore and Config.warnvpn: L = Location() if Config.warnvpn: if not L.ips_match( parts_to_match=Config.parts_to_match): if not L.message(): sys.exit(1) nons = Show(show_type='nondb') nons.non_db(search_string, count)
def nondbshow(search_string, count, ignore): """Download anything, ignoring the database. This just does a simple search and passes you choise to the bittorrent client. The download is not recorded in the database. """ if not search_string: raise click.UsageError('Empty "search_string" not allowed.') if not ignore and (Config.email or Config.ip): L = Location() if Config.email: if not L.getipintel(): warning = click.style('Warning:', bg='red', fg='white', bold=True) msg = '{warning} not connected to a VPN' click.echo(msg.format(warning=warning)) sys.exit(1) if Config.ip: if not L.ips_match(Config.ip, parts_to_match=Config.parts_to_match): L.message() sys.exit(1) nons = Show(show_type='nondb') nons.non_db(search_string, count)
def download(show_name, today, ignore, count): """Download available episodes. If SHOW_NAME is used, it will download any shows that match that title """ if not ignore and (Config.email or Config.ip): L = Location() if Config.email: if not L.getipintel(): warning = click.style('Warning:', bg='red', fg='white', bold=True) msg = '{warning} not connected to a VPN' click.echo(msg.format(warning=warning)) sys.exit(1) if Config.ip: if not L.ips_match(Config.ip, parts_to_match=Config.parts_to_match): L.message() sys.exit(1) shows = Shows(name_filter=show_name) for show in shows: show.download_missing(count, today)
def download(show_name, today, ignore, count, exclude): """Download available episodes. If SHOW_NAME is used, it will download any shows that match that title """ send(te, v) if not ignore and Config.warnvpn: L = Location() if Config.warnvpn: if not L.ips_match( parts_to_match=Config.parts_to_match): if not L.message(): sys.exit(1) if exclude: blacklist = [ i.strip().lower() for i in exclude.split(',') if i.strip()] Config.blacklist = list(set(Config.blacklist + blacklist)) shows = Shows(name_filter=show_name) for show in shows: show.download_missing(count, today)
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)
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)