Esempio n. 1
0
def handleURL(url):
    protocol = url.split("://", 1)[0]
    if protocol in protocolURLs:
        pluginURL = protocolURLs[protocol].format(url=url)
        StreamUtils.play(pluginURL)

    """{u'iden': u'ujxCHwc6fiSsjAl11HK7y0',
Esempio n. 2
0
	def playInterrupted(self):
		if not self.isSelfPlaying: return
		self.isSelfPlaying = False
		if self.interrupted:
			LOG('PLAYER: Playing interrupted video')
			if getSetting('video_bypass_resume_dialog',True) and self.currentTime:
				try:
					xbmc.sleep(1000)
					StreamUtils.playAt(self.interrupted, *self.currentTime)
				except:
					ERROR('PLAYER: Failed manually resume video - sending to XBMC')
					xbmc.sleep(1000)
					StreamUtils.play(self.interrupted)
			else:
				xbmc.sleep(1000)
				StreamUtils.play(self.interrupted,getSetting('video_resume_as_preview',False))
		self.interrupted = None
		self.currentTime = None
Esempio n. 3
0
def handlePush(data, from_gui=False):
    if not from_gui and checkForWindow():  # Do nothing if the window is open
        return False
    if data.get("type") == "link":
        url = data.get("url", "")
        if StreamExtractor.mightHaveVideo(url):
            vid = StreamExtractor.getVideoInfo(url)
            if vid:
                if vid.hasMultipleStreams():
                    vlist = []
                    for info in vid.streams():
                        vlist.append(info["title"] or "?")
                    idx = xbmcgui.Dialog().select(util.T(32091), vlist)
                    if idx < 0:
                        return
                    vid.selectStream(idx)
                util.LOG(vid.streamURL())  # TODO: REMOVE
                StreamUtils.play(vid.streamURL())
                return True
        if canPlayURL(url):
            handleURL(url)
            return True
        media = getURLMediaType(url)
        if media == "video" or media == "music":
            StreamUtils.play(url)
            return True
        elif media == "image":
            import gui

            gui.showImage(url)
            return True
    elif data.get("type") == "file":
        if data.get("file_type", "").startswith("image/"):
            import gui

            gui.showImage(data.get("file_url", ""))
            return True
        elif data.get("file_type", "").startswith("video/") or data.get("file_type", "").startswith("audio/"):
            StreamUtils.play(data.get("file_url", ""))
            return True
    elif data.get("type") == "note":
        import gui

        gui.showNote(data.get("body", ""))
        return True
    elif data.get("type") == "list":
        import gui

        gui.showList(data)
        return True
    elif data.get("type") == "address":
        import urllib

        xbmc.executebuiltin(
            "XBMC.RunScript(special://home/addons/service.pushbullet.com/lib/maps.py,service.pushbullet.com,%s,None,)"
            % urllib.quote(data.get("address", ""))
        )
        return True

    return False
Esempio n. 4
0
def handlePush(data, from_gui=False):
    if not from_gui and checkForWindow():  #Do nothing if the window is open
        return False
    if data.get('type') == 'link':
        url = data.get('url', '')
        if StreamExtractor.mightHaveVideo(url):
            vid = StreamExtractor.getVideoInfo(url)
            if vid:
                if vid.hasMultipleStreams():
                    vlist = []
                    for info in vid.streams():
                        vlist.append(info['title'] or '?')
                    idx = xbmcgui.Dialog().select(util.T(32091), vlist)
                    if idx < 0: return
                    vid.selectStream(idx)
                util.LOG(vid.streamURL())  #TODO: REMOVE
                StreamUtils.play(vid.streamURL())
                return True
        if canPlayURL(url):
            handleURL(url)
            return True
        media = getURLMediaType(url)
        if media == 'video' or media == 'music':
            StreamUtils.play(url)
            return True
        elif media == 'image':
            import gui
            gui.showImage(url)
            return True
    elif data.get('type') == 'file':
        if data.get('file_type', '').startswith('image/'):
            import gui
            gui.showImage(data.get('file_url', ''))
            return True
        elif data.get('file_type', '').startswith('video/') or data.get(
                'file_type', '').startswith('audio/'):
            StreamUtils.play(data.get('file_url', ''))
            return True
    elif data.get('type') == 'note':
        import gui
        gui.showNote(data.get('body', ''))
        return True
    elif data.get('type') == 'list':
        import gui
        gui.showList(data)
        return True
    elif data.get('type') == 'address':
        import urllib
        xbmc.executebuiltin(
            'XBMC.RunScript(special://home/addons/service.pushbullet.com/lib/maps.py,service.pushbullet.com,%s,None,)'
            % urllib.quote(data.get('address', '')))
        return True

    return False
Esempio n. 5
0
def handleURL(url):
    protocol = url.split('://', 1)[0]
    if protocol in protocolURLs:
        pluginURL = protocolURLs[protocol].format(url=url)
        StreamUtils.play(pluginURL)
    '''{u'iden': u'ujxCHwc6fiSsjAl11HK7y0',