Ejemplo n.º 1
0
def downloadyoutube(file, ffdir=""):
    debug("Start downloadyoutube")
    # if FFmpeg is defined use it also at youtube-dl
    if not ffdir == "":
        YDStreamExtractor.overrideParam('ffmpeg_location', ffdir)

    # download video
    YDStreamExtractor.overrideParam('preferedformat', "avi")
    vid = YDStreamExtractor.getVideoInfo(file, quality=2)
    with YDStreamUtils.DownloadProgress(
    ) as prog:  # this creates a progress dialog interface ready to use
        try:
            YDStreamExtractor.setOutputCallback(prog)
            result = YDStreamExtractor.downloadVideo(vid, folder)
            if result:
                full_path_to_file = result.filepath
            elif result.status != 'canceled':
                error_message = result.message
        finally:
            YDStreamExtractor.setOutputCallback(None)
Ejemplo n.º 2
0
def resolveURLFile(path):
    import YDStreamExtractor as StreamExtractor

    StreamExtractor.overrideParam('noplaylist', True)
    StreamExtractor.generateBlacklist(('.*:(?:user|channel|search)$', '(?i)generic.*'))

    import xbmcvfs
    f = xbmcvfs.File(path, 'r')
    try:
        url = f.read().strip()
    except:
        kodiutil.ERROR()
        return
    finally:
        f.close()

    vid = StreamExtractor.getVideoInfo(url)

    if not vid:
        return None

    return vid.streamURL()
Ejemplo n.º 3
0
def resolveURLFile(path):
    import YDStreamExtractor as StreamExtractor

    StreamExtractor.overrideParam('noplaylist', True)
    StreamExtractor.generateBlacklist(
        ('.*:(?:user|channel|search)$', '(?i)generic.*'))

    import xbmcvfs
    f = xbmcvfs.File(path, 'r')
    try:
        url = f.read().strip()
    except:
        kodiutil.ERROR()
        return
    finally:
        f.close()

    vid = StreamExtractor.getVideoInfo(url)

    if not vid:
        return None

    return vid.streamURL()
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
import xbmc, xbmcgui
import urllib
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
import common

StreamExtractor.overrideParam('noplaylist',True)
StreamExtractor.generateBlacklist(('.*:(?:user|channel|search)$','(?i)generic.*'))

def getURLMediaType(url):
    if url.startswith('http'):
        videoTypes = xbmc.getSupportedMedia('video')
        musicTypes = xbmc.getSupportedMedia('music')
        imageTypes = xbmc.getSupportedMedia('picture')
        ext = url.rsplit('.',1)[-1]
        if ext in videoTypes:
            return 'video'
        elif ext in musicTypes:
            return 'audio'
        elif ext in imageTypes:
            return 'image'
    return protocolMediaType(url)

def canHandle(data):
    if data.get('type') == 'link':
        url = data.get('url','')
        if StreamExtractor.mightHaveVideo(url): return 'video'
        mediaType = getURLMediaType(url)
        if mediaType: return mediaType
        return canPlayURL(url) and 'video' or None
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
import xbmc, xbmcgui
import urllib
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
import common

StreamExtractor.overrideParam("noplaylist", True)
StreamExtractor.generateBlacklist((".*:(?:user|channel|search)$", "(?i)generic.*"))


def getURLMediaType(url):
    if url.startswith("http"):
        videoTypes = xbmc.getSupportedMedia("video")
        musicTypes = xbmc.getSupportedMedia("music")
        imageTypes = xbmc.getSupportedMedia("picture")
        ext = url.rsplit(".", 1)[-1]
        if ext in videoTypes:
            return "video"
        elif ext in musicTypes:
            return "audio"
        elif ext in imageTypes:
            return "image"
    return protocolMediaType(url)


def canHandle(data):
    if data.get("type") == "link":
        url = data.get("url", "")
        if StreamExtractor.mightHaveVideo(url):
            return "video"
Ejemplo n.º 6
0
 listitem = xbmcgui.ListItem(path=path)
 listitem.setInfo(type="Video", infoLabels={"Title": title})
 kodi_player.play(path,listitem)
 time.sleep(10)
 videoda=0
 while videoda==0 :
  try:
    file=kodi_player.getPlayingFile()
    debug("-----> "+file)
    if not file=="":
      videoda=1
  except:
    pass 
 debug("Start Download")
 debug("FILE :"+file)
 YDStreamExtractor.overrideParam('ffmpeg_location',ffmpg)
 YDStreamExtractor.overrideParam('preferedformat',"avi") 
 #YDStreamExtractor.overrideParam('title',title) 
 vid = YDStreamExtractor.getVideoInfo(file,quality=int(quality)) 
 #kodi_player.stop()
 with YDStreamUtils.DownloadProgress() as prog: #This gives a progress dialog interface ready to use
    try:
        YDStreamExtractor.setOutputCallback(prog)
        result = YDStreamExtractor.downloadVideo(vid,folder)
        if result:
            #success
            full_path_to_file = result.filepath
        elif result.status != 'canceled':
            #download failed
            error_message = result.message
    finally:
# -*- coding: utf-8 -*-
import xbmc, xbmcgui
import urllib
import YDStreamExtractor as StreamExtractor
import YDStreamUtils as StreamUtils
import common

StreamExtractor.overrideParam('noplaylist',True)
StreamExtractor.generateBlacklist(('.*:(?:user|channel|search)$','(?i)generic.*'))

def getURLMediaType(url):
    if url.startswith('http'):
        videoTypes = xbmc.getSupportedMedia('video')
        musicTypes = xbmc.getSupportedMedia('music')
        imageTypes = xbmc.getSupportedMedia('picture')
        ext = url.rsplit('.',1)[-1]
        if ext in videoTypes:
            return 'video'
        elif ext in musicTypes:
            return 'audio'
        elif ext in imageTypes:
            return 'image'
    return protocolMediaType(url)

def canHandle(data):
    if data.get('type') == 'link':
        url = data.get('url','')
        if StreamExtractor.mightHaveVideo(url): return 'video'
        mediaType = getURLMediaType(url)
        if mediaType: return mediaType
        return canPlayURL(url) and 'video' or None