예제 #1
0
파일: xplay.py 프로젝트: JiasHuang/vod
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
예제 #2
0
def getSub(url, subtitle):
    if not url or not subtitle or subtitle == 'no':
        return None
    if re.search(r'youtube.com/watch\?v=', url):
        return youtubedl.extractSUB(url, subtitle)
    return None
예제 #3
0
파일: xplay.py 프로젝트: JiasHuang/vod
def runDBG(url, ref):
    if youtubedl.checkURL(url):
        youtubedl.extractURL(url)
    youtubedl.extractSUB(url)
    return 0