Ejemplo n.º 1
0
def del_plugin(plugin_name):
    lst = list_plugins()
    try:
        lst.remove(plugin_name)
        config.set_option('PUBLICATION_PLUGINS', json.dumps(lst))
    except ValueError:
        pass
Ejemplo n.º 2
0
Archivo: log.py Proyecto: pchinea/dpCat
def _register_entry():
    lock.acquire()
    current = int(config.get_option('CURRENT_LOG_SIZE')) if config.get_option('CURRENT_LOG_SIZE') else 0
    if current >= int(config.get_option('LOG_MAX_LINES')):
        _logrotate()
        current = 1
    else:
        current += 1
    config.set_option('CURRENT_LOG_SIZE', current)
    lock.release()
Ejemplo n.º 3
0
def config_settings(request):
    if request.method == 'POST':
        form = ConfigForm(request.POST)
        if form.is_valid():
            for i in form.base_fields.keys():
                config.set_option(i.upper(), form.cleaned_data[i])
            messages.success(request, 'Configuración guardada')
    else:
        initial_data = dict()
        for i in ConfigForm.base_fields.keys():
            initial_data[i] = config.get_option(i.upper())
        form = ConfigForm(initial_data)
    return render_to_response("postproduccion/section-config.html", { 'form' : form }, context_instance=RequestContext(request))
Ejemplo n.º 4
0
def config_plugin(request):
    if request.method == 'POST':
        form = ConfigForm(request.POST)
        if form.is_valid():
            for i in form.base_fields.keys():
                config.set_option("YT_PUBLISHER_%s" % i.upper(), form.cleaned_data[i])
            messages.success(request, 'Configuración guardada')
    else:
        initial_data = dict()
        for i in ConfigForm.base_fields.keys():
            initial_data[i] = config.get_option("YT_PUBLISHER_%s" % i.upper())
        form = ConfigForm(initial = initial_data)
    auth_state = Storage().get() is not None
    return render_to_response("yt_publisher/yt-section-config-plugin.html", { 'form' : form, 'auth_state' : auth_state }, context_instance=RequestContext(request))
Ejemplo n.º 5
0
def config_plugin(request):
    # Por ahora asumimos que se usará sólo el clipbucket.
    plugin_name = utils.list_plugins()[0]
    plugin = __import__(plugin_name)
    if request.method == 'POST':
        form = plugin.ConfigForm(request.POST)
        if form.is_valid():
            for i in form.base_fields.keys():
                config.set_option("%s_%s" %(plugin_name.upper(), i.upper()), form.cleaned_data[i])
            messages.success(request, 'Configuración guardada')
    else:
        initial_data = dict()
        for i in plugin.ConfigForm.base_fields.keys():
            initial_data[i] = config.get_option("%s_%s" %(plugin_name.upper(), i.upper()))
        form = plugin.ConfigForm(initial = initial_data)
    return render_to_response("postproduccion/section-config.html", { 'form' : form }, context_instance=RequestContext(request))
Ejemplo n.º 6
0
def config_settings(request, mail=False):
    ClassForm = ConfigMailForm if mail else ConfigForm
    if request.method == "POST":
        form = ClassForm(request.POST)
        if form.is_valid():
            for i in form.base_fields.keys():
                config.set_option(i.upper(), form.cleaned_data[i])
            messages.success(request, "Configuración guardada")
    else:
        initial_data = dict()
        for i in ClassForm.base_fields.keys():
            initial_data[i] = config.get_option(i.upper())
        form = ClassForm(initial_data)
    return render_to_response(
        "section-config.html", {"form": form, "mail": mail}, context_instance=RequestContext(request)
    )
Ejemplo n.º 7
0
def set_default_settings():
    defaults = [
        [ 'MAX_ENCODING_TASKS', 5 ],
        [ 'MELT_PATH' ,          which('melt') ], 
        [ 'FFMPEG_PATH',         which('ffmpeg') ],
        [ 'CRONTAB_PATH',        which('crontab') ],
        [ 'MEDIAINFO_PATH',      which('mediainfo') ],
        [ 'MAX_PREVIEW_WIDTH',   400 ],
        [ 'MAX_PREVIEW_HEIGHT',  300 ],
        [ 'VIDEO_LIBRARY_PATH',  '/home/adminudv/videos/videoteca/' ],
        [ 'VIDEO_INPUT_PATH' ,   '/home/adminudv/videos/' ],
        [ 'PREVIEWS_PATH' ,      '/home/adminudv/videos/previews/' ],
        [ 'TOKEN_VALID_DAYS' ,   7 ],
        [ 'SITE_URL' ,           'http://127.0.0.1:8000' ],
        [ 'LOG_MAX_LINES',       1000 ],
        [ 'MAX_NUM_LOGFILES',    6 ],
        [ 'PUBLICATION_PLUGINS', '["cb_publisher"]' ],
    ]

    for op in defaults:
        config.get_option(op[0]) or config.set_option(op[0], op[1])
Ejemplo n.º 8
0
def set_default_settings():
    defaults = [
        [ 'MAX_ENCODING_TASKS', 5 ],
        [ 'MELT_PATH' ,          which('melt') ], 
        [ 'AVCONV_PATH',         which('avconv') ],
        [ 'MP4BOX_PATH',         which('MP4Box') ],
        [ 'CRONTAB_PATH',        which('crontab') ],
        [ 'MEDIAINFO_PATH',      which('mediainfo') ],
        [ 'MAX_PREVIEW_WIDTH',   400 ],
        [ 'MAX_PREVIEW_HEIGHT',  300 ],
        [ 'VIDEO_LIBRARY_PATH',  '/home/adminudv/videos/videoteca/' ],
        [ 'VIDEO_INPUT_PATH' ,   '/home/adminudv/videos/' ],
        [ 'PREVIEWS_PATH' ,      '/home/adminudv/videos/previews/' ],
        [ 'TOKEN_VALID_DAYS' ,   7 ],
        [ 'SITE_URL' ,           'http://127.0.0.1:8000' ],
        [ 'LOG_MAX_LINES',       1000 ],
        [ 'MAX_NUM_LOGFILES',    6 ],
        [ 'RETURN_EMAIL',        '*****@*****.**' ],
    ]

    for op in defaults:
        config.get_option(op[0]) or config.set_option(op[0], op[1])
Ejemplo n.º 9
0
from configuracion import config
from postproduccion.utils import which

defaults = [
    [ 'CB_PUBLISHER_CLIPBUCKET_PATH', '/var/www/clipbucket' ],
    [ 'CB_PUBLISHER_USERNAME' ,       'dpcat' ], 
    [ 'CB_PUBLISHER_PASSWORD',        'dpcat1234' ],
    [ 'CB_PUBLISHER_PHP_PATH',        which('php') ],
]

for op in defaults:
    config.get_option(op[0]) or config.set_option(op[0], op[1])

from cb_publisher.forms import ConfigForm, PublishingForm
from cb_publisher.functions import execute_upload as publish
Ejemplo n.º 10
0
def add_plugin(plugin_name):
    lst = list_plugins()
    lst.append(plugin_name)
    config.set_option('PUBLICATION_PLUGINS', json.dumps(lst))
Ejemplo n.º 11
0
 def locked_put(self, credentials):
     config.set_option(self.__STORAGE_OPTION_KEY__, base64.b64encode(pickle.dumps(credentials)))