예제 #1
0
def main(options, logger=None):
    if logger == None:
        logger = Logger("download.log", "download.py", True, True)
    else:
        logger.context = "download.py"
    try:
        query = utils.getQuery()
        logger.context = "download.py"
        if __name__ == "__main__":
            utils.log_header(logger, DESCRIPTION,
                             options.get("verbose", False))

        logger.debug("Options:", options.get("verbose", False))
        for i in options:
            logger.debug(i + ": " + str(options[i]),
                         options.get("verbose", False))
        download_query(query, options, logger)

        # move all downloaded videos in videos directory
        repoDir = utils.repoPath()
        fs = os.listdir(repoDir)
        for f in fs:
            if utils.is_video(f):
                os.rename(f, "videos/" + f)
        logger.success("All files downloaded.",
                       not options.get("silent", False))
    except Exception as e:
        logger.handle_exception(e)
        raise e
예제 #2
0
파일: app.py 프로젝트: MGRiv/google-ish
def answer(query):
    s = utils.getQuery(query)
    return render_template("answer.html",ans=s)
예제 #3
0
def getQuery(request):
    """Return formatted query for sessions."""
    return utils.getQuery(request, models.Session)
예제 #4
0
def getQuery(request):
    """Return formatted query for conferences."""
    return utils.getQuery(request, models.Conference)