Audio Stream and disappear InfoLabels
#1
Hi. I try to play radio stream like this:

Code:
playList = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
playList.clear()
listItem = xbmcgui.ListItem(Title, iconImage=Icon, thumbnailImage=Icon)
listItem.setInfo( 'Music', infoLabels={'Title': Title})
playList.add(URL, listItem)
xbmc.Player().play(playList)

I set Title, but when stream start playing after three seconds all infoLabels disappear. My guess is that XBMC retrieves them from the file stream in which the tags are empty. How do I stop getting tags from the stream?
Reply
#2
I'm having the same problem. The infolabels I've set in my python code just disappear. I'm using the tracknumber, title, and duration fields of the builtin list control. The tracklist I'm displaying is in a WindowDialogXML, using the built in list control with id 51. Here's some screenshots. There is no metadata in the audio stream I'm playing. Anyone have any suggestions?


Image

Image

Code:
def get_album_tracklist(self, album_list, pos, albumdialog):
        x = 0
        for item in album_list[pos]["tracks"]:
            newlistitem = xbmcgui.ListItem(path=album_list[pos]["tracks"][x]["previewURL"])
            newlistitem.setInfo('music', { 'tracknumber':   int(album_list[pos]["tracks"][x]["trackIndex"]),
                                           'title':         album_list[pos]["tracks"][x]["name"],
                                           'duration':      int(album_list[pos]["tracks"][x]["playbackSeconds"])
                                           })
            albumdialog.addItem(newlistitem)
            x += 1
        print "Added "+str(x)+"tracks to list"
Reply
#3
Are there required fields for listitems? I'm wondering if the fact that I don't have anything set for the ListItem.Label or Label2 is affecting anything....

-Jerimiah
Reply
#4
Okay, I figured it out. I was using a single listitem for both the control list and then as the listitem I sent directly to my player instance. I believe that XBMC wants to automatically replace the static fields I set in the listitem with infotags pulled from the source. In my case, this is a stream with no infotags at all, so I just get blank spaces.

My workaround is to maintain separate lists for display and playback. From my track list source, I build two listitems for each track.

1) One is for the ControlList in the windowxml and is just used for display. I'm using a made-up url for the required 'file' attribute, and then using setinfo for the track title, index, and length. This listitem gets added to the ControlList.
2) The other listitem is for a playlist object. This lisitem contains the real URL for the file I want to stream, but no other info. Here's the code block for that:

Code:
        for item in album_list[pos]["tracks"]:
            newlistitem = xbmcgui.ListItem(path="http://dummyurl.org")
            newlistitem.setInfo('music', { 'tracknumber':   int(album_list[pos]["tracks"][x]["trackIndex"]),
                                           'title':         album_list[pos]["tracks"][x]["name"],
                                           'duration':      int(album_list[pos]["tracks"][x]["playbackSeconds"])
                                           })
            albumdialog.addItem(newlistitem)
            self.playlist.add(album_list[pos]["tracks"][x]["previewURL"], listitem=xbmcgui.ListItem(''))
            x += 1
        print "Added "+str(x)+"tracks to list"

Now both lists are separate but can be easily synced up. For example, I have trapped the 'onSelect' event for the listcontrol so I can see which track was selected, then send that ID to the player so it can play the right track in the playlist object, like so:

Code:
            elif self.getFocusId() == 51:
                print "Clicked on track # "+str(self.getCurrentListPosition()+1)
                self.myPlayer.playselected(self.getCurrentListPosition())

I have the (+1) in the print statement to offset the list id's, which start at 0 rather than 1, of course. Internally, it is unnecessary.

Hope this helps someone else out, too!
Reply

Logout Mark Read Team Forum Stats Members Help
Audio Stream and disappear InfoLabels0