Ejemplo n.º 1
0
def runSMP(url, ref):
    if youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
    if not url:
        print('[xplay] invalid url')
        return 0
    subprocess.Popen('%s \'%s\'' %(xdef.smp, url), shell=True)
    return 0
Ejemplo n.º 2
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.º 3
0
def findLink(url):
    urls = []
    for m in re.finditer(
        r'(http://|https://|)(www.|)(dailymotion|videomega|videowood|youtube|openload)(.com|.tv|.co)([^"]*)',
        xurl.load2(url),
    ):
        link = xurl.absURL(m.group())
        if link not in urls:
            urls.append(link)
    srcs = []
    for link in urls:
        if youtubedl.checkURL(link):
            vids = youtubedl.extractURL2(link)
            if vids:
                srcs = srcs + vids
        else:
            srcs.append(link)
    return srcs
Ejemplo n.º 4
0
def runMPV(url, ref):

    p = None
    xargs = ''

    if url[0] == '/':
        xargs = xdef.mpv_ytdl

    if ref != 'x' and youtubedl.checkURL(url):
        url = youtubedl.extractURL(url)
        xargs = xdef.mpv_ytdl

    if not url:
        print('[xplay] invalid url')
        return 0

    if not checkProcessRunning('mpv'):

        xargs = xargs + ' --user-agent=\'%s\'' %(xdef.ua)
        xargs = xargs + ' --referrer=\'%s\'' %(ref)
        xargs = xargs + ' --input-file=\'%s\'' %(xdef.fifo)

        p = subprocess.Popen('%s %s \'%s\'' %(xdef.mpv, xargs, url), shell=True)

    else:
        os.system('echo loadfile \"%s\" > %s' %(url, xdef.fifo))
        os.system('echo sub-remove > %s' %(xdef.fifo))

    sub = youtubedl.extractSUB(ref)
    if sub:
        os.system('echo sub-add \"%s\" select > %s' %(sub, xdef.fifo))

    if p:
        p.communicate()

    return 0
Ejemplo n.º 5
0
def runDBG(url, ref):
    if youtubedl.checkURL(url):
        youtubedl.extractURL(url)
    youtubedl.extractSUB(url)
    return 0