Python xbmc.PLAYLIST_VIDEO Examples

The following are 12 code examples of xbmc.PLAYLIST_VIDEO(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmc , or try the search function .
Example #1
Source File: addon.py    From plugin.video.sparkle with GNU General Public License v3.0 6 votes vote down vote up
def get_video_playlist(self, new=False):
        '''
        Convenience method to return a video :class:`xbmc.Playlist` object.
        
        .. seealso::
        
            :meth:`get_playlist`
        
        Kwargs:
            new (bool): If ``False`` (default), get the current video 
            :class:`xbmc.Playlist` object. If ``True`` then return a new blank
            video :class:`xbmc.Playlist`.
            
        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        self.get_playlist(xbmc.PLAYLIST_VIDEO, new) 
Example #2
Source File: plugintools.py    From tvalacarta with GNU General Public License v3.0 6 votes vote down vote up
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist) 
Example #3
Source File: plugintools.py    From tvalacarta with GNU General Public License v3.0 6 votes vote down vote up
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist) 
Example #4
Source File: plugintools.py    From pelisalacarta-ce with GNU General Public License v3.0 6 votes vote down vote up
def direct_play(url):
    _log("direct_play ["+url+"]")

    title = ""

    try:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=url)
    except:
        xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
    xlistitem.setInfo( "video", { "Title": title } )

    playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
    playlist.clear()
    playlist.add( url, xlistitem )

    player_type = xbmc.PLAYER_CORE_AUTO
    xbmcPlayer = xbmc.Player( player_type )
    xbmcPlayer.play(playlist) 
Example #5
Source File: addon.py    From filmkodi with Apache License 2.0 6 votes vote down vote up
def get_video_playlist(self, new=False):
        '''
        Convenience method to return a video :class:`xbmc.Playlist` object.
        
        .. seealso::
        
            :meth:`get_playlist`
        
        Kwargs:
            new (bool): If ``False`` (default), get the current video 
            :class:`xbmc.Playlist` object. If ``True`` then return a new blank
            video :class:`xbmc.Playlist`.
            
        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        self.get_playlist(xbmc.PLAYLIST_VIDEO, new) 
Example #6
Source File: addon.py    From filmkodi with Apache License 2.0 6 votes vote down vote up
def get_video_playlist(self, new=False):
        '''
        Convenience method to return a video :class:`xbmc.Playlist` object.

        .. seealso::

            :meth:`get_playlist`

        Kwargs:
            new (bool): If ``False`` (default), get the current video
            :class:`xbmc.Playlist` object. If ``True`` then return a new blank
            video :class:`xbmc.Playlist`.

        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        self.get_playlist(xbmc.PLAYLIST_VIDEO, new) 
Example #7
Source File: addon.py    From plugin.video.sparkle with GNU General Public License v3.0 5 votes vote down vote up
def get_playlist(self, pl_type, new=False):
        '''
        Return a :class:`xbmc.Playlist` object of the specified type.
        
        The available playlist types are defined in the :mod:`xbmc` module and 
        are currently as follows::
        
            xbmc.PLAYLIST_MUSIC = 0
            xbmc.PLAYLIST_VIDEO = 1
            
        .. seealso::
            
            :meth:`get_music_playlist`, :meth:`get_video_playlist`
            
        Args:
            pl_type (int): The type of playlist to get.
            
            new (bool): If ``False`` (default), get the current 
            :class:`xbmc.Playlist` object of the type specified. If ``True`` 
            then return a new blank :class:`xbmc.Playlist`.

        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        pl = xbmc.PlayList(pl_type)
        if new:
            pl.clear()
        return pl 
Example #8
Source File: playitem.py    From service.upnext with GNU General Public License v2.0 5 votes vote down vote up
def get_next(self):
        playlist = PlayList(PLAYLIST_VIDEO)
        position = playlist.getposition()
        # A playlist with only one element has no next item and PlayList().getposition() starts counting from zero
        if playlist.size() > 1 and position < (playlist.size() - 1):
            return self.api.get_next_in_playlist(position)
        return False 
Example #9
Source File: pushhandler.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def playMedia(url,title='',thumb='',description='',playlist_type=xbmc.PLAYLIST_VIDEO):
    common.log('Play media: ' + url)

    li = xbmcgui.ListItem(label=title,label2=description,iconImage=thumb,thumbnailImage=thumb)
    li.setPath(url)
    li.setInfo('video',{'title':title,'tagline':description})
    pl = xbmc.PlayList(playlist_type)
    pl.clear()
    pl.add(url,li)
    xbmc.Player().play(pl) 
Example #10
Source File: addon.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def get_playlist(self, pl_type, new=False):
        '''
        Return a :class:`xbmc.Playlist` object of the specified type.
        
        The available playlist types are defined in the :mod:`xbmc` module and 
        are currently as follows::
        
            xbmc.PLAYLIST_MUSIC = 0
            xbmc.PLAYLIST_VIDEO = 1
            
        .. seealso::
            
            :meth:`get_music_playlist`, :meth:`get_video_playlist`
            
        Args:
            pl_type (int): The type of playlist to get.
            
            new (bool): If ``False`` (default), get the current 
            :class:`xbmc.Playlist` object of the type specified. If ``True`` 
            then return a new blank :class:`xbmc.Playlist`.

        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        pl = xbmc.PlayList(pl_type)
        if new:
            pl.clear()
        return pl 
Example #11
Source File: addon.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def get_playlist(self, pl_type, new=False):
        '''
        Return a :class:`xbmc.Playlist` object of the specified type.

        The available playlist types are defined in the :mod:`xbmc` module and
        are currently as follows::

            xbmc.PLAYLIST_MUSIC = 0
            xbmc.PLAYLIST_VIDEO = 1

        .. seealso::

            :meth:`get_music_playlist`, :meth:`get_video_playlist`

        Args:
            pl_type (int): The type of playlist to get.

            new (bool): If ``False`` (default), get the current
            :class:`xbmc.Playlist` object of the type specified. If ``True``
            then return a new blank :class:`xbmc.Playlist`.

        Returns:
            A :class:`xbmc.Playlist` object.
        '''
        pl = xbmc.PlayList(pl_type)
        if new:
            pl.clear()
        return pl 
Example #12
Source File: pushhandler.py    From xbmc.service.pushbullet with GNU General Public License v3.0 4 votes vote down vote up
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(common.localise(32091),vlist)
                    if idx < 0: return
                    vid.selectStream(idx)
                playMedia(vid.streamURL(),vid.title,vid.thumbnail,vid.description)
                return True
        if canPlayURL(url):
            handleURL(url)
            return True
        media = getURLMediaType(url)
        if media == 'video' or media == 'audio':
            url += '|' + urllib.urlencode({'User-Agent':getURLUserAgent(url)})
            playMedia(url,playlist_type='video' and xbmc.PLAYLIST_VIDEO or xbmc.PLAYLIST_MUSIC)
            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/'):
            playMedia(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':
        cmd = 'XBMC.RunScript({0},MAP,{1},None,)'.format(common.__addonid__,urllib.quote(data.get('address','')))
        xbmc.executebuiltin(cmd)
        return True

    return False