def display_list(self, title, download=False): sqldata = self.sqldata records = [] if download: data = [[ title, ['Date downloaded', 'Show name, episode', 'Magnet link'], [16, 25, 0], ['<', '<', '<'] ]] for i in sqldata: records.append([ self.format_date(i[0]), self.episode(i[1], i[4], i[5]), i[9], i[9] ]) else: data = [[ title, ['Date downloaded', 'Show name, episode', 'Local file'], [16, 25, 0], ['<', '<', '<'] ]] for i in sqldata: records.append([ self.format_date(i[0]), self.episode(i[1], i[4], i[5]), self.exists(i[2]), i[3] ]) data.append(records) tbl = ConsoleTable(data) tbl.set_count(None) tbl.is_postdownload = True torrent_hash = tbl.generate() selected = [i for i in data[1] if torrent_hash in i][0] return selected
def _ask(self, shows, season, episode, display_count, nondb=False, date_search=None): click.echo() if not shows[1]: # use ljust to cover over the progressbar click.secho('No results found.'.ljust(Config.console_columns)) click.echo(' ' * Config.console_columns) return 'skip' if date_search: show_title = '%s %s' % (self.db_name, date_search) elif season and episode: show_title = '%s %s' % (self.db_name, self.se_ep(season, episode)) else: show_title = '%s' % shows[0][0][0] table_type = 'nondb' if nondb else 'download' tbl = ConsoleTable(shows, table_type=table_type) tbl.set_title(show_title) tbl.set_count(display_count) show_to_dl = tbl.generate() # save data to Tracking tracking = Tracking() if show_to_dl not in ['skip', 'skip_rest', 'mark']: nondbshow = True if self.show_type == 'nondb' else False tracking.save(self.db_name, season, episode, shows, show_to_dl, nondbshow=nondbshow) return show_to_dl
def display_list(self, title, table_type): sqldata = self.sqldata records = [] if table_type == 'redownload': data = [ [ title, ['Date downloaded', 'Show name, episode', 'Magnet link'], [16, 25, 0], ['<', '<', '<'] ] ] for i in sqldata: records.append([ self.format_date(i[0]), self.episode(i[1], i[4], i[5]), i[9], i[9]] ) elif table_type == 'copy': data = [ [ title, ['Date downloaded', 'Show name, episode', 'Source file'], [16, 25, 0], ['<', '<', '<'] ] ] for i in sqldata: records.append([ self.format_date(i[0]), self.episode(i[1], i[4], i[5]), self.exists(i[2]), i[3]] ) data.append(records) tbl = ConsoleTable(data, table_type) tbl.set_count(None) result = tbl.generate() return (result, data)
def _ask(self, shows, season, episode, display_count, nondb=False): click.echo() if not shows[1]: # use ljust to cover over the progressbar click.secho('No results found.'.ljust(Config.console_columns)) return 'skip' if season and episode: show_title = '%s %s' % (self.db_name, self.se_ep(season, episode)) else: show_title = '%s' % shows[0][0][0] tbl = ConsoleTable(shows, nondb=nondb) tbl.set_title(show_title) tbl.set_count(display_count) show_to_dl = tbl.generate() # save data to Tracking tracking = Tracking() if show_to_dl not in ['skip', 'skip_rest', 'mark']: tracking.save(self.db_name, season, episode, shows, show_to_dl) return show_to_dl
seeds, self.shortname, magnet ]) # return without trying any more urls, this one has data. return show_data # return the empty show_data empty array return show_data if __name__ == '__main__': from tvoverlord.consoletable import ConsoleTable # some simple tests p = Provider() data = p.search('game of thrones', season=6, episode=6) results = [ [ "wazup?", ['A', 'b', 'c', 'd'], [0, 10, 12, 10], ['<', '<', '<', '<'], ], data ] pp(results) click.echo(len(results)) c = ConsoleTable(results) c.generate()
title = show['title'] seeds = show['seeds'] magnet = hash2magnet(show['hash'], title) show_data.append( [title, size, date, seeds, self.shortname, magnet]) # return without trying any more urls, this one has data. return show_data # return the empty show_data empty array return show_data if __name__ == '__main__': from tvoverlord.consoletable import ConsoleTable # some simple tests p = Provider() data = p.search('game of thrones', season=6, episode=6) results = [[ "wazup?", ['A', 'b', 'c', 'd'], [0, 10, 12, 10], ['<', '<', '<', '<'], ], data] pp(results) click.echo(len(results)) c = ConsoleTable(results) c.generate()