Пример #1
0
def manage(request):
    archive_dirs = list_directory(settings.ARCHIVE_LOCATION)
    incoming_dirs = list_directory(settings.INCOMING_LOCATION)
    diva_dirs = list_directory(settings.DIVA_LOCATION)

    incoming_to_archive = check_difference(incoming_dirs, archive_dirs)
    archive_to_diva = check_difference(archive_dirs, diva_dirs)
    diva_redo = check_intersection(archive_dirs, diva_dirs)

    incoming_to_archive.sort(key=alphanum_key)
    archive_to_diva.sort(key=alphanum_key)
    diva_redo.sort(key=alphanum_key)

    data = {
        'to_archive': incoming_to_archive,
        'to_diva': archive_to_diva,
        'diva_redo': diva_redo
    }

    return render(request, 'main/manage.html', data)
Пример #2
0
def home(request):
    archive_dirs = list_directory(settings.ARCHIVE_LOCATION)
    diva_dirs = list_directory(settings.DIVA_LOCATION)

    archive_in_progress = []
    for d in archive_dirs:
        full_path = os.path.join(settings.ARCHIVE_LOCATION, d)
        if os.path.exists(os.path.join(full_path, ".work_in_progress")):
            archive_in_progress.append(d)

    diva_in_progress = []
    for d in diva_dirs:
        full_path = os.path.join(settings.DIVA_LOCATION, d)
        if os.path.exists(os.path.join(full_path, ".diva_conversion_in_progress")):
            diva_in_progress.append(d)

    data = {
        "archive_in_progress": archive_in_progress,
        "diva_in_progress": diva_in_progress
    }
    return render(request, "main/home.html", data)