def init():
    '''
    Initialize data for system for outside usage, including logging, config files and arguments
    '''
    global config
    cf.setup_logging()
    config = cf.parse_config()
    args = cf.create_arguments()
    # Update configurations if arguments are different
    config["base_url"] = args.base_url if args.base_url else config["base_url"]
    config["mock"] = True if args.mock else config["mock"]
    config["offline"] = True if args.offline else config["offline"]
    config["stop"] = False
예제 #2
0
# python 3 compatibility
import configuration
import DAL
import logging as log
import spider

configuration.setup_logging()
log.info("SpiderBro, two point oh!")

dal = DAL.DAL()
sbro = spider.spider(dal)

# TODO: implement cmdline args for 1 show, all shows, all shows airing this week

for show in dal.get_full_show_list():
    ga_list = sbro.find_torrents_for_show(show)
예제 #3
0
        raise e      
    finally:
        if(cur != None):
            cur.close()
        con.close()
# end function


# function - usage
#   display how to use this python script
def usage():
    print "\nUsage: importtable.py postgres|sqlite <connectstr> <tablename>\n"
# end function


logger = configuration.setup_logging()
logger.info("Init importtable.py")

if(sys.argv.__len__() < 4):
    logger.warn("Invalid arguments")
    usage()
    sys.exit(2)

try:   
    type = sys.argv[1]
    connectstr = sys.argv[2]
    tablename = sys.argv[3]
    fieldnames = extract_fieldnames(type, connectstr, tablename)
    select_star(type, connectstr, tablename, fieldnames)
except Exception as e:
    logger.error(e)