예제 #1
0
파일: views.py 프로젝트: adrianrv/dpCat
def status(request):
    # Programas externos
    avconvver = utils.avconv_version()
    meltver = utils.melt_version()
    mediainfover = utils.mediainfo_version()
    mp4boxver = utils.mp4box_version()
    exes = {
        "AVCONV": {
            "path": config.get_option("AVCONV_PATH"),
            "status": True if avconvver else False,
            "version": avconvver,
        },
        "MELT": {"path": config.get_option("MELT_PATH"), "status": True if meltver else False, "version": meltver},
        "crontab": {
            "path": config.get_option("CRONTAB_PATH"),
            "status": utils.is_exec(config.get_option("CRONTAB_PATH")),
            "version": "N/A",
        },
        "mediainfo": {
            "path": config.get_option("MEDIAINFO_PATH"),
            "status": True if mediainfover else False,
            "version": mediainfover,
        },
        "MP4Box": {
            "path": config.get_option("MP4BOX_PATH"),
            "status": True if mp4boxver else False,
            "version": mp4boxver,
        },
    }

    # Directorios
    dirs = dict()
    for i in [("library", "VIDEO_LIBRARY_PATH"), ("input", "VIDEO_INPUT_PATH"), ("previews", "PREVIEWS_PATH")]:
        data = {"path": config.get_option(i[1])}
        if utils.check_dir(data["path"]):
            df = utils.df(data["path"])
            data["info"] = {"total": df[0], "used": df[1], "left": df[2], "perc": df[3], "mount": df[4]}
        dirs[i[0]] = data

    # Tareas Programadas
    if request.method == "POST":
        if "status_process" in request.POST:
            if request.POST["status_process"] == "1":
                crontab.stop("procesar_video")
                messages.warning(request, "Tareas programadas de codificación desactivadas")
            else:
                crontab.start("procesar_video")
                messages.success(request, "Tareas programadas de codificacion activadas")
        if "status_publish" in request.POST:
            if request.POST["status_publish"] == "1":
                crontab.stop("publicar_video")
                messages.warning(request, "Tareas programadas de publicación desactivadas")
            else:
                crontab.start("publicar_video")
                messages.success(request, "Tareas programadas de publicación activadas")
    cron = {"process": crontab.status("procesar_video"), "publish": crontab.status("publicar_video")}

    return render_to_response(
        "section-status.html", {"exes": exes, "dirs": dirs, "cron": cron}, context_instance=RequestContext(request)
    )
예제 #2
0
파일: views.py 프로젝트: pchinea/dpCat
def status(request):
    # Programas externos
    ffmpegver = utils.ffmpeg_version()
    meltver = utils.melt_version()
    mediainfover = utils.mediainfo_version()
    exes = {
        'FFMPEG'  : {
            'path'    : config.get_option('FFMPEG_PATH'),
            'status'  : True if ffmpegver else False,
            'version' : ffmpegver,
        },
        'MELT'    : {
            'path'    : config.get_option('MELT_PATH'),
            'status'  : True if meltver else False,
            'version' : meltver,
        },
        'crontab' : {
            'path'    : config.get_option('CRONTAB_PATH'),
            'status'  : utils.is_exec(config.get_option('CRONTAB_PATH')),
            'version' : 'N/A',
        },
        'mediainfo'    : {
            'path'    : config.get_option('MEDIAINFO_PATH'),
            'status'  : True if mediainfover else False,
            'version' : mediainfover,
        },
    }
    
    # Directorios
    dirs = dict()
    for i in [('library', 'VIDEO_LIBRARY_PATH'), ('input', 'VIDEO_INPUT_PATH'), ('previews', 'PREVIEWS_PATH')]:
        data = { 'path' : config.get_option(i[1]) }
        if utils.check_dir(data['path']):
            df = utils.df(data['path'])
            data['info'] = {
                'total' : df[0],
                'used'  : df[1],
                'left'  : df[2],
                'perc'  : df[3],
                'mount' : df[4]
            }
        dirs[i[0]] = data

    # Tareas Programadas
    if request.method == 'POST':
        if request.POST['status'] == '1':
            crontab.stop()
            messages.warning(request, 'Tareas programadas desactivadas')
        else:
            crontab.start()
            messages.success(request, 'Tareas programadas activadas')
    cron = crontab.status()

    return render_to_response("postproduccion/section-status.html", { 'exes' : exes, 'dirs' : dirs, 'cron' : cron }, context_instance=RequestContext(request))
예제 #3
0
파일: views.py 프로젝트: Madh93/dpCat
def status(request):
    # Programas externos
    avconvver = utils.avconv_version()
    meltver = utils.melt_version()
    mediainfover = utils.mediainfo_version()
    mp4boxver = utils.mp4box_version()
    exiftoolver = utils.exiftool_version()
    exes = {
        'AVCONV'  : {
            'path'    : config.get_option('AVCONV_PATH'),
            'status'  : True if avconvver else False,
            'version' : avconvver,
        },
        'MELT'    : {
            'path'    : config.get_option('MELT_PATH'),
            'status'  : True if meltver else False,
            'version' : meltver,
        },
        'crontab' : {
            'path'    : config.get_option('CRONTAB_PATH'),
            'status'  : utils.is_exec(config.get_option('CRONTAB_PATH')),
            'version' : 'N/A',
        },
        'mediainfo'    : {
            'path'    : config.get_option('MEDIAINFO_PATH'),
            'status'  : True if mediainfover else False,
            'version' : mediainfover,
        },
        'MP4Box'    : {
            'path'    : config.get_option('MP4BOX_PATH'),
            'status'  : True if mp4boxver else False,
            'version' : mp4boxver,
        },
        'exiftool'    : {
            'path'    : config.get_option('EXIFTOOL_PATH'),
            'status'  : True if exiftoolver else False,
            'version' : exiftoolver,
        },
    }

    # Directorios
    dirs = dict()
    for i in [('library', 'VIDEO_LIBRARY_PATH'), ('input', 'VIDEO_INPUT_PATH'), ('previews', 'PREVIEWS_PATH')]:
        data = { 'path' : config.get_option(i[1]) }
        if utils.check_dir(data['path']):
            df = utils.df(data['path'])
            data['info'] = {
                'total' : df[0],
                'used'  : df[1],
                'left'  : df[2],
                'perc'  : df[3],
                'mount' : df[4]
            }
        dirs[i[0]] = data

    # Tareas Programadas
    if request.method == 'POST':
        if 'status_process' in request.POST:
            if request.POST['status_process'] == '1':
                crontab.stop('procesar_video')
                messages.warning(request, 'Tareas programadas de codificación desactivadas')
            else:
                crontab.start('procesar_video')
                messages.success(request, 'Tareas programadas de codificacion activadas')
        if 'status_publish' in request.POST:
            if request.POST['status_publish'] == '1':
                crontab.stop('publicar_video')
                messages.warning(request, 'Tareas programadas de publicación desactivadas')
            else:
                crontab.start('publicar_video')
                messages.success(request, 'Tareas programadas de publicación activadas')
    cron = { 'process' : crontab.status('procesar_video'), 'publish' : crontab.status('publicar_video') }

    # Información de la versión
    dpcatinfo = utils.dpcat_info()
    version = [
        ['Versión', dpcatinfo['version']],
        ['Rama', dpcatinfo['branch']],
        ['Commit', dpcatinfo['commit']],
        ['Repositorio', dpcatinfo['url']],
        ['Fecha', dpcatinfo['date']],
        ['Autor', dpcatinfo['author']],
        ['Mensaje', dpcatinfo['message']]
    ]

    return render_to_response("postproduccion/section-status.html", { 'exes' : exes, 'dirs' : dirs, 'cron' : cron, 'version' : version }, context_instance=RequestContext(request))