def xmltv_configure(cmd): # Import if cmd == '__import__': print ' Enter file path:', conf.set('xmltv_import_path', sys.stdin.readline().strip()) # TODO: validation # Pass to command else: from subprocess import Popen, PIPE # TODO: should check config is supported? proc = Popen([cmd, '--configure']) proc.wait()
def configure(): from pyepg.main import get_select print '' print 'XMLTV Configuration:' print '-' * 60 # Find available grabbers grabbers = xmltv_grabbers() keys = ['__import__'] keys.extend(grabbers.keys()) # Select grabber idx = get_select('Select XMLTV grabber:', keys) conf.set('xmltv_grabber', keys[idx]) # Configure the grabber xmltv_configure(keys[idx])
def xmltv ( opts, args ): # XMLTV capabilities xmltv_caps = [ 'baseline', 'config', 'exmltv' ] xmltv_desc = 'XMLTV compatible wrapper for PyEPG' # Capabilities if opts.capabilities: for c in xmltv_caps: print c sys.exit(0) # Description if opts.description: print xmltv_desc sys.exit(0) # Run conf.set('formatter', 'xmltv') grab(opts, args)
def xmltv(opts, args): # XMLTV capabilities xmltv_caps = ['baseline', 'config', 'exmltv'] xmltv_desc = 'XMLTV compatible wrapper for PyEPG' # Capabilities if opts.capabilities: for c in xmltv_caps: print c sys.exit(0) # Description if opts.description: print xmltv_desc sys.exit(0) # Run conf.set('formatter', 'xmltv') grab(opts, args)
def configure (): print '' print 'Atlas Configuration' print '-' * 60 # API key apikey = conf.get('atlas_apikey', '') print '' print 'API Key [%s]: ' % apikey, apikey = sys.stdin.readline().strip() if apikey: conf.set('atlas_apikey', apikey) # Publishers to be used p_pubs = [ 'bbc.co.uk', 'five.tv', 'channel4.com', 'itv.com', 'tvblob.com' ] s_pubs = [ 'pressassociation.com' ] conf.set('atlas_primary_publishers', conf.get('atlas_primary_publishers', p_pubs)) conf.set('atlas_secondary_publishers', conf.get('atlas_secondary_publishers', s_pubs)) # Hidden settings conf.set('atlas_channel_chunk', conf.get('atlas_channel_chunk', 32)) conf.set('atlas_time_chunk', conf.get('atlas_time_chunk', 86400))
def configure(): print '' print 'Atlas Configuration' print '-' * 60 # API key apikey = conf.get('atlas_apikey', '') print '' print 'API Key [%s]: ' % apikey, apikey = sys.stdin.readline().strip() if apikey: conf.set('atlas_apikey', apikey) # Publishers to be used p_pubs = ['bbc.co.uk', 'five.tv', 'channel4.com', 'itv.com', 'tvblob.com'] s_pubs = ['pressassociation.com'] conf.set('atlas_primary_publishers', conf.get('atlas_primary_publishers', p_pubs)) conf.set('atlas_secondary_publishers', conf.get('atlas_secondary_publishers', s_pubs)) # Hidden settings conf.set('atlas_channel_chunk', conf.get('atlas_channel_chunk', 32)) conf.set('atlas_time_chunk', conf.get('atlas_time_chunk', 86400))
def configure(opts, args, conf_path=None): # # Global # print 'System Configuration' print '-' * 60 # Number of days to grab days = conf.get('days', 7) while True: print 'Days to grab [%d]: ' % days, t = sys.stdin.readline().strip() if not t: break try: days = int(t) break except: pass conf.set('days', days) # Postcode print '\nPostcode (for regional TV) [%s]: ' % conf.get('postcode', ''), pc = sys.stdin.readline().strip() if pc: conf.set('postcode', pc) # # Grabber # grabbers = get_grabbers() if not grabbers: log.error('no grabbers available') sys.exit(1) options = map(lambda x: x[0], grabbers) idx = get_select('\nSelect grabber:', options) grabber = grabbers[idx][1] conf.set('grabber', grabbers[idx][0]) print '' print 'Grabber: %s' % grabbers[idx][0] # # Formatter # formatters = get_formatters() if not formatters: log.error('no formatters available') sys.exit(1) options = map(lambda x: x[0], formatters) idx = get_select('\nSelect formatter:', options) formatter = formatters[idx][1] conf.set('formatter', formatters[idx][0]) print '' print 'Formatter: %s' % formatters[idx][0] # # Grabber/Formatter config # if hasattr(grabber, 'configure'): grabber.configure() if hasattr(formatter, 'configure'): formatter.configure() # # Channels # channels = [] print '' print 'Channel Configuration' print '-' * 60 # Get packages packages = grabber.packages() options = [] options.extend(['Skip']) options.extend(map(lambda x: x.title(), packages)) idx = get_select('Select Platform:', options) # Platform if idx: idx = idx - 1 package = packages[idx] conf.set('package', package.id()) # Exclusions a = None while a not in ['y', 'n', 'yes', 'no']: print '\nWould you like to add exclusions (y/n)? ', a = sys.stdin.readline().strip().lower() # Get if a in ['y', 'yes']: for c in package.channels(): a = None while a not in ['y', 'n', 'yes', 'no']: print '\n %s (y/n)? ' % c.title, a = sys.stdin.readline().strip().lower() if a in ['y', 'yes']: channels.append(c.title) # Store channels = [] for c in package.channels(): channels.append(c.uri) conf.set('channel[]', channels) # # Output summary and get confirmation # # TODO # # Save # conf.save()
def configure ( opts, args, conf_path = None ): # # Global # print 'System Configuration' print '-' * 60 # Number of days to grab days = conf.get('days', 7) while True: print 'Days to grab [%d]: ' % days, t = sys.stdin.readline().strip() if not t: break try: days = int(t) break except: pass conf.set('days', days) # Postcode print '\nPostcode (for regional TV) [%s]: ' % conf.get('postcode', ''), pc = sys.stdin.readline().strip() if pc: conf.set('postcode', pc) # # Grabber # grabbers = get_grabbers() if not grabbers: log.error('no grabbers available') sys.exit(1) options = map(lambda x: x[0], grabbers) idx = get_select('\nSelect grabber:', options) grabber = grabbers[idx][1] conf.set('grabber', grabbers[idx][0]) print '' print 'Grabber: %s' % grabbers[idx][0] # # Formatter # formatters = get_formatters() if not formatters: log.error('no formatters available') sys.exit(1) options = map(lambda x: x[0], formatters) idx = get_select('\nSelect formatter:', options) formatter = formatters[idx][1] conf.set('formatter', formatters[idx][0]) print '' print 'Formatter: %s' % formatters[idx][0] # # Grabber/Formatter config # if hasattr(grabber, 'configure'): grabber.configure() if hasattr(formatter, 'configure'): formatter.configure() # # Channels # channels = [] print '' print 'Channel Configuration' print '-' * 60 # Get packages packages = grabber.packages() options = [] options.extend(['Skip']) options.extend(map(lambda x: x.title(), packages)) idx = get_select('Select Platform:', options) # Platform if idx: idx = idx - 1 package = packages[idx] conf.set('package', package.id()) # Exclusions a = None while a not in [ 'y', 'n', 'yes', 'no' ]: print '\nWould you like to add exclusions (y/n)? ', a = sys.stdin.readline().strip().lower() # Get if a in [ 'y', 'yes' ]: for c in package.channels(): a = None while a not in [ 'y', 'n', 'yes', 'no' ]: print '\n %s (y/n)? ' % c.title, a = sys.stdin.readline().strip().lower() if a in [ 'y', 'yes' ]: channels.append(c.title) # Store channels = [] for c in package.channels(): channels.append(c.uri) conf.set('channel[]', channels) # # Output summary and get confirmation # # TODO # # Save # conf.save()