예제 #1
0
파일: tasks.py 프로젝트: Signez/dradis2
def end_record(element_id=None, studio_id=None, recorder=None):
    if element_id:
        current_element = PlaylistElement.query.get(element_id)

        if not current_element:
            return error_message("bad_argument")

        studio = current_element.playlist.studio
    elif studio_id:
        studio = Studio.query.get(studio_id)
    else:
        return error_message("bad_argument")

    if not isinstance(studio, Studio) or recorder not in ("gold", "show"):
        return error_message("bad_argument")

    recorder_name = "{}_recorder_{}".format(studio.slug, recorder)

    if liq.send_command("{}.status".format(recorder_name)) != "off":
        liq.send_command("{}.stop".format(recorder_name))
    else:
        logger.warn("Recorder {} was already off!".format(recorder_name))

    if element_id:
        # noinspection PyUnboundLocalVariable
        current_element.mark_as_done()
        studio.jukebox.curpos += 1

    studio.mark_as_changed()
    db.session.commit()

    return ok()
예제 #2
0
def skip(studio_id, element_id):
    studio = Studio.query.get(studio_id)
    element = PlaylistElement.query.get(element_id)

    if not isinstance(studio, Studio):
        return error_message("bad_argument")

    current_element = studio.jukebox.current_element

    if current_element != element:
        return error_message(
            "bad_argument",
            "This playlist element is not the current element anymore.")

    liq.send_command("{}_jukebox_stereo.skip".format(studio.slug))
    current_element.mark_as_done(skipped=True)

    studio.jukebox.curpos += 1
    studio.jukebox.mark_as_changed()
    studio.mark_as_changed()

    db.session.commit()

    play_current_element.delay(studio.id)

    return ok()
예제 #3
0
def end_record(element_id=None, studio_id=None, recorder=None):
    if element_id:
        current_element = PlaylistElement.query.get(element_id)

        if not current_element:
            return error_message("bad_argument")

        studio = current_element.playlist.studio
    elif studio_id:
        studio = Studio.query.get(studio_id)
    else:
        return error_message("bad_argument")

    if not isinstance(studio, Studio) or recorder not in ("gold", "show"):
        return error_message("bad_argument")

    recorder_name = "{}_recorder_{}".format(studio.slug, recorder)

    if liq.send_command("{}.status".format(recorder_name)) != "off":
        liq.send_command("{}.stop".format(recorder_name))
    else:
        logger.warn("Recorder {} was already off!".format(recorder_name))

    if element_id:
        # noinspection PyUnboundLocalVariable
        current_element.mark_as_done()
        studio.jukebox.curpos += 1

    studio.mark_as_changed()
    db.session.commit()

    return ok()
예제 #4
0
파일: tasks.py 프로젝트: Signez/dradis2
def skip(studio_id, element_id):
    studio = Studio.query.get(studio_id)
    element = PlaylistElement.query.get(element_id)

    if not isinstance(studio, Studio):
        return error_message("bad_argument")

    current_element = studio.jukebox.current_element

    if current_element != element:
        return error_message("bad_argument", "This playlist element is not the current element anymore.")

    liq.send_command("{}_jukebox_stereo.skip".format(studio.slug))
    current_element.mark_as_done(skipped=True)

    studio.jukebox.curpos += 1
    studio.jukebox.mark_as_changed()
    studio.mark_as_changed()

    db.session.commit()

    play_current_element.delay(studio.id)

    return ok()
예제 #5
0
파일: status.py 프로젝트: Signez/dradis2
def send_command(command):
    return liq.send_command(command)
예제 #6
0
파일: tasks.py 프로젝트: Signez/dradis2
def flush_bed(studio):
    liq.send_command(u'{}.skip'.format(studio.bed_liqname))
    # Twice: it may be already ready for looping
    liq.send_command(u'{}.skip'.format(studio.bed_liqname))

    studio.bed_on_air_since = None
예제 #7
0
파일: tasks.py 프로젝트: Signez/dradis2
def load_media(uid, media, liquidname):
    logger.warning(u"Loading media on {}, uid={}, mid={}, filename={}".format(liquidname, uid, media.id, media.filename))
    liq.send_command(u'{}.push annotate:dradis_uid="{}":{}'.format(liquidname, uid, media.path))
예제 #8
0
def flush_bed(studio):
    liq.send_command(u'{}.skip'.format(studio.bed_liqname))
    # Twice: it may be already ready for looping
    liq.send_command(u'{}.skip'.format(studio.bed_liqname))

    studio.bed_on_air_since = None
예제 #9
0
def load_media(uid, media, liquidname):
    logger.warning(u"Loading media on {}, uid={}, mid={}, filename={}".format(
        liquidname, uid, media.id, media.filename))
    liq.send_command(u'{}.push annotate:dradis_uid="{}":{}'.format(
        liquidname, uid, media.path))
예제 #10
0
파일: status.py 프로젝트: Signez/dradis2
def send_command(command):
    return liq.send_command(command)