Exemple #1
0
def get_plugin_thumbnail(image):

    # support user supplied .png files
    userpng = os.path.join(iplayer.get_thumb_dir(), xbmc.getSkinDir(), image + '.png')
    if os.path.isfile(userpng):
        return userpng
    userpng = os.path.join(iplayer.get_thumb_dir(), image + '.png')
    if os.path.isfile(userpng):
        return userpng

    return None
Exemple #2
0
def get_plugin_thumbnail(image):

    # support user supplied .png files
    userpng = os.path.join(iplayer.get_thumb_dir(), xbmc.getSkinDir(), image + '.png')
    if os.path.isfile(userpng):
        return userpng
    userpng = os.path.join(iplayer.get_thumb_dir(), image + '.png')
    if os.path.isfile(userpng):
        return userpng
    
    return None
Exemple #3
0
def list_channels():
    handle = int(sys.argv[1])
    xbmcplugin.addSortMethod(handle=handle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

    channels = sorted(live_tv_channels.items(), key=itemgetter(1))
    for id, (sort, stream_id, label, thumb) in channels:
        url = make_url(channel = id)
        listitem = xbmcgui.ListItem(label=label)
        listitem.setIconImage('defaultVideo.png')
        listitem.setThumbnailImage(os.path.join(get_thumb_dir(), thumb))        
        ok = xbmcplugin.addDirectoryItem(
            handle = handle, 
            url = url,
            listitem = listitem,
            isFolder = False,
        )

    xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
Exemple #4
0
def list_channels():
    handle = int(sys.argv[1])
    xbmcplugin.addSortMethod(handle=handle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

    channels = sorted(live_tv_channels.items(), key=itemgetter(1))
    for id, (sort, stream_id, label, thumb) in channels:
        url = make_url(channel = id)
        listitem = xbmcgui.ListItem(label=label)
        listitem.setIconImage('defaultVideo.png')
        listitem.setThumbnailImage(os.path.join(get_thumb_dir(), thumb))        
        ok = xbmcplugin.addDirectoryItem(
            handle = handle, 
            url = url,
            listitem = listitem,
            isFolder = False,
        )

    xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
Exemple #5
0
def play_stream(channel, bitrate, showDialog):
    bitrate = int(bitrate)
    # check to see if bbcthree/cbbc or bbcfour/cbeebies is on the air?    
    if channel == 'bbc_three' or channel == 'bbc_four' or channel == 'cbeebies' or channel == 'cbbc':
        surl = 'http://www.bbc.co.uk/iplayer/tv/'+channel
        cstr = httpget(surl)
        off_air_message = re.compile('<h2 class="off-air">.+?</span>(.+?)</a></h2>').findall(cstr)
        if off_air_message:
            pDialog = xbmcgui.Dialog()
            pDialog.ok('IPlayer', 'Channel is currently Off Air')
            return

    provider = get_provider()
    
    # check for red button usage
    if channel == 'bbc_redbutton':
        pDialog = xbmcgui.Dialog()
        if not pDialog.yesno("BBC Red Button Live Stream", "This will only work when the stream is broadcasting.", "If it is not on, xbmc may retry indefinately (crash)", "Do you want to try anyway?"):
            return

    url = fetch_stream_info(channel, bitrate, provider)

    if url == "":
        Dialog = xbmcgui.Dialog()
        pDialog.ok('IPlayer', "Sorry, stream is currently unavailable")

    if showDialog:
        pDialog = xbmcgui.DialogProgress()
        pDialog.create('IPlayer', 'Loading live stream info')
        xbmc.sleep(50)

    if showDialog: pDialog.update(50, 'Starting Stream')
    # build listitem to display whilst playing
    (sort, stream_id, label, thumb) = live_tv_channels[channel]
    listitem = xbmcgui.ListItem(label = label + ' - Live')
    listitem.setIconImage('defaultVideo.png')
    listitem.setThumbnailImage(os.path.join(get_thumb_dir(), thumb))

    play = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    play.clear()
    play.add(url,listitem)
    player = xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER)
    player.play(play)
    if showDialog: pDialog.close()
Exemple #6
0
def play_stream(channel, bitrate, showDialog):
    bitrate = int(bitrate)
    # check to see if bbcthree/cbbc or bbcfour/cbeebies is on the air?    
    if channel == 'bbc_three' or channel == 'bbc_four' or channel == 'cbeebies' or channel == 'cbbc':
        surl = 'http://www.bbc.co.uk/iplayer/tv/'+channel
        cstr = httpget(surl)
        off_air_message = re.compile('<h2 class="off-air">.+?</span>(.+?)</a></h2>').findall(cstr)
        if off_air_message:
            pDialog = xbmcgui.Dialog()
            pDialog.ok('IPlayer', 'Channel is currently Off Air')
            return

    provider = get_provider()
    
    # check for red button usage
    if channel == 'bbc_redbutton':
        pDialog = xbmcgui.Dialog()
        if not pDialog.yesno("BBC Red Button Live Stream", "This will only work when the stream is broadcasting.", "If it is not on, xbmc may retry indefinately (crash)", "Do you want to try anyway?"):
            return

    url = fetch_stream_info(channel, bitrate, provider)

    if url == "":
        pDialog = xbmcgui.Dialog()
        pDialog.ok('IPlayer', "Sorry, stream is currently unavailable")

    if showDialog:
        pDialog = xbmcgui.DialogProgress()
        pDialog.create('IPlayer', 'Loading live stream info')
        xbmc.sleep(50)

    if showDialog: pDialog.update(50, 'Starting Stream')
    # build listitem to display whilst playing
    (sort, stream_id, label, thumb) = live_tv_channels[channel]
    listitem = xbmcgui.ListItem(label = label + ' - Live')
    listitem.setIconImage('defaultVideo.png')
    listitem.setThumbnailImage(os.path.join(get_thumb_dir(), thumb))

    play = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    play.clear()
    play.add(url,listitem)
    player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
    player.play(play)
    if showDialog: pDialog.close()
Exemple #7
0
def get_feed_thumbnail(feed):
    thumbfn = ''
    if not feed or not feed.channel: return ''

    # support user supplied .png files
    userpng = get_plugin_thumbnail(feed.channel)
    if userpng: return userpng
    
    # check for a preconfigured logo
    if iplayer.stations.channels_logos.has_key(feed.channel):
        url = iplayer.stations.channels_logos[feed.channel]
        if url == None:
            url = os.path.join(iplayer.get_thumb_dir(), 'bbc_local_radio.png')
        return url
        
    # national TV and Radio stations have easy to find online logos
    if feed.tvradio == 'radio':
        url = "http://www.bbc.co.uk/iplayer/img/radio/%s.gif" % feed.channel
    else:
        url = "http://www.bbc.co.uk/iplayer/img/tv/%s.jpg" % feed.channel
        
    return url
Exemple #8
0
def get_feed_thumbnail(feed):
    thumbfn = ''
    if not feed or not feed.channel: return ''

    # support user supplied .png files
    userpng = get_plugin_thumbnail(feed.channel)
    if userpng: return userpng

    # check for a preconfigured logo
    if iplayer.stations.channels_logos.has_key(feed.channel):
        url = iplayer.stations.channels_logos[feed.channel]
        if url == None:
            url = os.path.join(iplayer.get_thumb_dir(), 'bbc_local_radio.png')
        return url

    # national TV and Radio stations have easy to find online logos
    if feed.tvradio == 'radio':
        url = "http://www.bbc.co.uk/iplayer/img/radio/%s.gif" % feed.channel
    else:
        url = "http://www.bbc.co.uk/iplayer/img/tv/%s.jpg" % feed.channel

    return url