Beispiel #1
0
def file_create(request):
    if request.method == 'POST':
        #do save
        files = request.POST['files'].splitlines()
        import_files(files)
        
        return HttpResponseRedirect(reverse('pilm.views.file_index'))
    else: 
        return HttpResponse(_("invalid request."))
Beispiel #2
0
    # Make a global logging object.
    log = logging.getLogger()
    log.setLevel(logging.DEBUG)
    h = logging.StreamHandler()
    f = logging.Formatter("%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)s")
    h.setFormatter(f)
    log.addHandler(h)

    # reset DB
    try:
        os.remove("pilm.db")
    except OSError:
        log.info("ignore missing file: pilm.db")
    from django.core.management import call_command

    call_command("syncdb", interactive=False)

    # import file list
    log.info("importing file list...")
    from pilm.tasks import import_files

    files = open("list.txt", "r").readlines()
    import_files(files, thread=False)

    # query films from IMDB
    log.info("querying movies...")
    from pilm.tasks import query_all_new

    query_all_new(thread=False)