Ejemplo n.º 1
0
def runOMXP(url, ref):
    if youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
    if not url:
        print('[xplay] invalid url')
        return 0
    if checkProcessRunning('omxplayer.bin'):
        omxp.setAct('stop', None)
    if re.search(r'.m3u($)', url):
        url = xurl.readLocal(url).rstrip()
        print('\n[omxp][play] '+url)
    p = subprocess.Popen('%s \'%s\' 2>&1 | tee %s' %(xdef.omxp, url, xdef.log), shell=True)
    if p:
        p.communicate()
    return 0
Ejemplo n.º 2
0
def setAct(act, val):

    if checkActVal(act, val) == False:
        print('\n[xplay][setAct] invalid command: %s %s\n' % (act, val))
        return

    if act == 'stop' and val != '#':
        if os.path.exists(xdef.playlist):
            os.remove(xdef.playlist)

    if act == 'playbackMode':
        xurl.saveLocal(xdef.playbackMode, val, 0)
        if val.lower() in ['autonext', 'loopall']:
            playing = xurl.readLocal(xdef.playing, 0)
            playlist = xurl.readLocal(xdef.playlist, 0)
            nextURL = nextLine(playing, playlist)
            if nextURL:
                if os.fork() == 0:
                    xsrc.getSource(nextURL)
        return

    player = getPlayer()
    print('\n[xplay][setAct]\n\n\t' + '%s,%s,%s' % (player, act, val))

    if player == 'mpv' and xproc.checkProcessRunning('mpv'):
        return mpv.setAct(act, val)

    if player == 'omxp' and xproc.checkProcessRunning('omxplayer.bin'):
        return omxp.setAct(act, val)

    if player == 'ffplay' and xproc.checkProcessRunning('ffplay'):
        return ffplay.setAct(act, val)
Ejemplo n.º 3
0
def setAct(act, val):

    player = getPlayer()
    print('\n[xplay]\n\n\t'+ '%s,%s,%s' %(player, act, val))

    if player == 'mpv' and checkProcessRunning('mpv'):
        return mpv.setAct(act, val)

    if player == 'omxp' and checkProcessRunning('omxplayer.bin'):
        return omxp.setAct(act, val)