Very simple webradio plugin

Newbie needs help on basic stuff
Hi to all,

I have been reading in here for quite a while now, but I have reached two ends by now:
- the end of my "knowledge"
- the end of my patiente.

To quickly get you (who can hopefully help me out) on the train:
I am a bad programmer, have never been good at it. But after trying around with webradio playlists in itunes (which btw plex does not recognize as music which is why the itunes plugin does not automatically show up), and other plugins I decided to write my own SIMPLE plugin where I can add all the webradio-stations I want to listen.
It should be veeeery simple, really, no big menu structure. Just when starting the plugin the list with the stations (6 stations for now) should show up and the next click should already start the music.

As a start I was using the documentation I found in the Dev Manual and the tool to generate the basic structure.
After some experimenting I even already got it to work, but when I added more stations (with the thumbs) the plugin does not show up again in plex.
Now trying to go back step by step I (think) have got to the point where it should go, but nope.

Now my questions:
- in which log-file I can best see where to look for the error?
- Can anybody check my code and maybe directly tell me what I have been doing wrong? Again: the first list coming up after start should already have the streams to select.
- Or does maybe somebody know, why an imported webradio list into itunes is not showing up in the itunes plugin (if it would, I would not need to write that plugin).

Here is my code (I did not remove the coments):

MUSIC_PREFIX = "/music/webstream"<br />
<br />
NAME = L('Webstream')<br />
<br />
# these filenames reference the example files in<br />
# the Contents/Resources/ folder in the bundle<br />
<br />
ART  = 'art-default.jpg'<br />
ICON = 'icon-default.png'<br />
EINSLIVE = '1live_190.png'<br />
#FRITZ = 'fritz.png'<br />
#RADIOBERLIN = 'radioberlin.png'<br />
#MDRJUMP = 'mdrjump.jpg'<br />
#FFH = 'ffh.png'<br />
#SPUTNIK = 'sputnik.png'<br />
<br />
####################################################################################################<br />
<br />
def Start():<br />
<br />
    ## make this plugin show up in the 'Music' section<br />
    ## in Plex. The L() function pulls the string out of the strings<br />
    ## file in the Contents/Strings/ folder in the bundle<br />
    ## see also:<br />
    ##  http://dev.plexapp.com/docs/mod_Plugin.html<br />
    ##  http://dev.plexapp.com/docs/Bundle.html#the-strings-directory<br />
    <br />
    Plugin.AddPrefixHandler(MUSIC_PREFIX, MusicMainMenu, NAME, ICON, ART)<br />
    Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
    Plugin.AddViewGroup("List", viewMode="List", mediaType="items")<br />
<br />
    ## set some defaults so that you don't have to<br />
    ## pass these parameters to these object types<br />
    ## every single time<br />
    ## see also:<br />
    ##  http://dev.plexapp.com/docs/Objects.html<br />
<br />
    MediaContainer.title1 = NAME<br />
    MediaContainer.viewGroup = "List"<br />
    MediaContainer.art = R(ART)<br />
    DirectoryItem.thumb = R(ICON)<br />
    VideoItem.thumb = R(ICON)<br />
<br />
    HTTP.CacheTime = CACHE_1HOUR<br />
<br />
#### the rest of these are user created functions and<br />
#### are not reserved by the plugin framework.<br />
#### see: http://dev.plexapp.com/docs/Functions.html for<br />
#### a list of reserved functions above<br />
<br />
#########################################################################<br />
<br />
# Example main menu referenced in the Start() method<br />
# for the 'Music' prefix handler<br />
#<br />
<br />
def MusicMainMenu():<br />
<br />
    # Container acting sort of like a folder on<br />
    # a file system containing other things like<br />
    # "sub-folders", videos, music, etc<br />
    # see:<br />
    #  http://dev.plexapp.com/docs/Objects.html#MediaContainer<br />
<br />
    dir = MediaContainer(mediaType='music')<br />
<br />
    # see:<br />
    #  http://dev.plexapp.com/docs/Objects.html#DirectoryItem<br />
    #  http://dev.plexapp.com/docs/Objects.html#function-objects<br />
    <br />
     dir.Append(TrackItem('http://www.einslive.de/multimedia/livestream/channel_einslive.m3u', title="1Live", thumb=R(EINSLIVE)))<br />
<br />
#    dir.Append(<br />
#	TrackItem('http://www.fritz.de/live.m3u',<br />
#		title="RBB Fritz",<br />
#		thumb=R(FRITZ)))   <br />
#     dir.Append(<br />
#	TrackItem('http://www.radioberlin.de/live.m3u',<br />
#		title="Radio Berlin",<br />
#		thumb=R(RADIOBERLIN)))   <br />
#     dir.Append(<br />
#	TrackItem('http://www.jumpradio.de/static/webchannel/#jump_live_channel_high.m3u',<br />
#		title="MDR Jump",<br />
#		thumb=none)) <br />
#     dir.Append(<br />
#	TrackItem('http://www.sputnik.de/m3u/live.hi.m3u',<br />
#		title="MDR Sputnik",<br />
#		thumb=R(SPUTNIK)))      <br />
#     dir.Append(<br />
#	TrackItem('http://edge.live.mp3.mdn.newmedia.nacamar.net/radioffh/#livestream.mp3.m3u',<br />
#		title="FFH",<br />
#		thumb=R(FFH))) <br />
return dir<br />




Any help is highly appreciated.
Thanks in advance

Hi Pepe,

A work around I’ve used is installing the shoutcast plugin and “stream to me” plugin. Then once I had found the radio stations I wanted I just added them to Plex’s favourites menu.



You can do this by highlighting the sation you want and accessing the context menu (C on the keyboard, I don’t remember how on an apple remote) and selecting “Add to favourites”. The benifit is there is at least 2 less levels of menus you have to work through to access your favourite radio.

thanks for your reply.

I do have shoutcast plugin installed already, but the stations I would like to listrn are not listed there.

Also I am frankly a bit curious about what I’ve been doing wrong in the code.



/pepe

Sorry for posting it here but i’m intrested in building a radio plug in for dubstep.fm, but all i have is a .pls. Can this be used by Plex?

unfortunately i can not answer your q.

but may be you are a better programmer than I am and can answer mine? :wink:



Nice, thank you :)

Hi flow,

correct I am german, but we can continue to write in english so other non-germans may benefit from some things mentioned here?! ;-)
Thanks for the link, I will certainly have a look.
Just one question to my code:
what is the reference for the position of the "return dir"?
And, is my (simple) structure of directly jumping into the music list ok?

.<br />
.<br />
.<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")<br />
<br />
def MusicMainMenu():<br />
<br />
    dir = MediaContainer(mediaType='music')<br />
    <br />
     dir.Append(TrackItem('http://www.einslive.de/multimedia/livestream/channel_einslive.m3u', title="1Live", thumb=R(EINSLIVE)))<br />
return dir



Thanks again.

THanks. This is helpful. I was working on developing a RadioParadise HD (www.radioparadise.com/rphd.php) plugin. Did ‘successfully’ insert a stream, (music) but haven’t been able to modifiy for “video”(or photo?)



Any suggestions ? I’m very much a newbie.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.