Kodi Community Forum

Full Version: [REQUEST] NPR (National Public Radio) Internet Radio Plugin?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a plugin that would allow me to listen to the various streaming NPR shows on XBMC?
I would like to *bump* this thread.

All new NPR content (2005 or newer) plays in the "NPR Player", which completely obfuscates the URL of the actual stream.

For content from 2003-2005, I can play the WMA stream by clicking the link, then viewing the source in the web page and pasting it into a .strm file.

Any chance of a script or plugin for this?

I guess it would be pretty complicated, as it would have to have a decent search facility.

However, I guess a rudimentary and working "hackish" way of doing it would be to have the user enter the story ID that they'd already looked up on the web, as in this link:

http://www.npr.org/templates/story/story...d=92325702

this appears to be where the magic is:
http://www.npr.org/templates/javascript/...wsStory.js

Thanks,

-Wes
I've been trying to stream a local NPR station and can't seem to work out a path that works.

The station home page is http://www.michiganradio.org/

I've tried the MP3 stream at:
http://umtv-live.rs.itd.umich.edu/wuom/miradio32k.m3u
and
http://ummedia12.rs.itd.umich.edu:8004/listen.pls

I've also tried the Windows media stream at:
http://umtv-live.rs.itd.umich.edu/wuom/m...ercept.asx

If anyone has any suggestions I'd appreciate the help.
All,

Could I help someone develop a National Public Radio plugin similar to LiveListenEu? I was listening to some BBC News this morning through LiveListen and while that's wonderful it would be great to have a similar plugin for NPR affiliates here in the states.

Would it be as simple as taking the LiveListen code and dropping in the NPR steaming web addresses?

Sorry, don't know the first thing about code but I love my XBMC and I'm looking for an easy plugin project to try my hand at development.

Anyone care to be my mentor/advisor?

Brian
I think this is a great idea. I am an NPR addict in my car. I don't listen to radio much in my living room but their iphone app is amazing.

You should definitely try your hand at this and post any problems you are having in the python development forum.
Would also love to see an NPR plugin!
I woke up this morning and wanted to get NPR streaming on my XBMC install. I was surprised that an add-on wasn't already available!

Thankfully, there is a consistent, 24-hour streaming link (maybe it didn't exist in 2007 when this thread was started):
http://npr.ic.llnwd.net/stream/npr_live24

The above link works nicely in VLC player. However, I wanted it in a seamless XBMC interface. I wrapped it up in a very simple add-on for XBMC, using the ShoutCast add-on as a template.

I have only tested this add-on with Ubuntu 10.10 with Dharma RC2.

Since the Forum doesn't support file attachments [sigh] and I'm too lazy to sign up for the Add-on developer mailing list / Git repository, here's a direct download link:

http://xbmcnpr.googlecode.com/files/audio.NPR.zip

Install instructions:
  1. Download the attached audio.NPR.zip file to your Home folder.
  2. Navigate to: Settings --> Add-ons --> Install from Zip File
  3. Navigate to your Home folder and select audio.NPR.zip
  4. A pop-up should indicate that the add-on was installed correctly
  5. Navigate to: Music --> Files --> Music Add-ons
  6. Click the link to NPR. It should start playing immediately.
    Update 12/4/10: Script now loads the Visualisation window after it begins playing the stream. Just hit "Stop" to make it stop playing.
Hi Fisslefink!

Thank you very much for you plugin! I use it daily! I liked it so much, in fact, that I decided to add to it by added a bunch more stations (19 additional stations at last count). I still have a bit more to add (I'm using a list of Top 20 NPR stations listed here: http://www.slideshare.net/nprresearch/th...o-stations).

I'd like to give this back when I'm done. Interested?

Also, if anyone has any requests, I'd be happy to add them to the list. If so, please provide the following information:
  1. Call Letters
  2. Frequency
  3. Location (City, State)
  4. Content Type (if other than "News/Talk," e.g., "Classical," "Jazz," etc.)
  5. XBMC-Compatible URL (typically to a *.pls or *.m3u)

Thanks!
I like it web! Any chance I can get it just as you have it? (You have it running on Dharma right?)
Since I don't have anywhere to host the zip file, I thought I'd try to just to inline it here. There are only 2 files you need to modify from the original Fisslefink release: strings.xml and default.py.

I refactored the code a bit to make it easier to add/remove stations. Hopefully, the comments in the code and data file will be sufficient for anyone to make modifications.

I got a little carried away and added a few stations after the NPR stations because I like them. Obviously, it will be easy for you to snip them from the list. Big Grin

Hope this works for you,

Ron

P.S.: The spaces in the pathnames are not mine. But, I can't seem to stop them from being inserted! Sad
---------------------------------------------------------------------
C:\Users\<username>\AppData\Roaming\XBMC\addons\plugin.audio.npr\resources\language\English\strings.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>    
    <!--General-->
    <!-- Note:  The string id's must be contiguous and match up with -->
    <!--        the URLs in the streamUrls array in default.py (line 75). -->
    <string id="30090">Live stream from Washington, DC</string>
    <string id="30091">All Songs Considered 24-hour stream</string>
    <string id="30092">KPBS (89.5Mhz, San Diego, CA)</string>
    <string id="30093">KPCC (89.3Mhz, Pasadena, CA)</string>
    <string id="30094">KCSM (91.1Mhz, San Mateo, CA)(Jazz)</string>
    <string id="30095">KQED (88.5Mhz, San Francisco, CA)</string>
    <string id="30096">KUSC (91.5Mhz, Los Angeles, CA)(Classical)</string>
    <string id="30097">KNYC-FM (93.9Mhz, New York, NY)</string>
    <string id="30098">KNYC-AM (820Khz, New York, NY)</string>
    <string id="30099">WAMU (88.5Mhz, Washington D.C.)</string>
    <string id="30100">WQXR (105.9Mhz, New York City, NY)(Classical)</string>
    <string id="30101">WETA (90.9Mhz, Arlington, VA)(Classical)</string>
    <string id="30102">WBEZ (91.5Mhz, Chicago, IL)</string>
    <string id="30103">WBUR (90.9Mhz, Boston, MA)</string>
    <string id="30104">KCRW (89.9Mhz, Santa Monica, CA)(music)</string>
    <string id="30105">KCRW (89.9Mhz, Santa Monica, CA)(live)</string>
    <string id="30106">KCRW (89.9Mhz, Santa Monica, CA)(news)</string>
    <string id="30107">WHYY (90.9Mhz, Philadelphia, PA)</string>
    <string id="30108">WABE (90.1Mhz, Atlanta, GA)</string>
    <string id="30109">WABE (90.1Mhz, Atlanta, GA)(classical)</string>
    <string id="30110">WABE (90.1Mhz, Atlanta, GA)(news)</string>
    <string id="30111">Minnesota Public Radio(classical)</string>
    <string id="30112">Minnesota Public Radio(news)</string>
    <string id="30113">Cinemix(soundtrack)</string>
    <string id="30114">FilmRadio(soundtrack)</string>
    <string id="30115">RadioCinema(soundtrack)</string>
    <string id="30116">Radiowax(Jazz fusion)</string>
    <string id="30117">Groove Salad(mp3)(Electronic Ambient)</string>
    <string id="30118">Groove Salad(aac)(Electronic Ambient)</string>
    <string id="30119">Drone Zone(Electronic Ambient)</string>
    <string id="30120">Acoustic Alternative(Acoustic, Unplugged, Raw)</string>
    <string id="30121">Loudcaster(Oil City Blues Radio)</string>
</strings>

C:\Users\<username>\AppData\Roaming\XBMC\addons\plugin.audio.npr\default.py:
Code:
#/*
# *      Copyright (C) Fisslefink
# *
# *
# *  This Program is free software; you can redistribute it and/or modify
# *  it under the terms of the GNU General Public License as published by
# *  the Free Software Foundation; either version 2, or (at your option)
# *  any later version.
# *
# *  This Program is distributed in the hope that it will be useful,
# *  but WITHOUT ANY WARRANTY; without even the implied warranty of
# *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# *  GNU General Public License for more details.
# *
# *  You should have received a copy of the GNU General Public License
# *  along with this program; see the file COPYING.  If not, write to
# *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# *  http://www.gnu.org/copyleft/gpl.html
# *
# */

import string,xbmc,xbmcaddon,xbmcplugin,xbmcgui

__XBMC_Revision__ = xbmc.getInfoLabel('System.BuildVersion')
__settings__      = xbmcaddon.Addon(id='plugin.audio.npr')
__language__      = __settings__.getLocalizedString
__version__       = __settings__.getAddonInfo('version')
__cwd__           = __settings__.getAddonInfo('path')
__addonname__    = "NPR"
__addonid__      = "plugin.audio.npr"
__author__        = "Fisslefink"


firstStringId=30090

def PLAY(url):
  xbmc.Player().play(url)
                  
def get_params():
        param=[]
        paramstring=sys.argv[2]
        if len(paramstring)>=2:
                params=sys.argv[2]
                cleanedparams=params.replace('?','')
                if (params[len(params)-1]=='/'):
                        params=params[0:len(params)-2]
                pairsofparams=cleanedparams.split('&')
                param={}
                for i in range(len(pairsofparams)):
                        splitparams={}
                        splitparams=pairsofparams[i].split('=')
                        if (len(splitparams))==2:
                                param[splitparams[0]]=splitparams[1]
                                
        return param

def AddMenuItem(pluginName, streamHandleString, streamIndex):
    u=pluginName+"?stream="+str(streamIndex+1)
    liz=xbmcgui.ListItem(__language__(firstStringId+streamIndex), iconImage="DefaultPlaylist.png", thumbnailImage="")
    xbmcplugin.addDirectoryItem(handle=int(streamHandleString),url=u,listitem=liz,isFolder=False)


params=get_params()
stream=None

try:
        stream=int(params["stream"])
except:
        pass
try:
        firstrun=(int(sys.argv[1]) == 0)
except:
        pass

# Note:   You must update the string table in ./resources/language/English/strings.xml
#         in parallel with changes to this array.
# Note 2: Don't forget to put a comma at the end of each quoted string.
#         (The last one doesn't really need one.)
streamUrls=[
    "http://npr.ic.llnwd.net/stream/npr_live24",
    "http://sc9.sjc.llnw.net:80/stream/npr_music2",
    "http://kpbs.streamguys.tv",
    "http://kpcc.streamguys.com",
    "http://www.abacast.com/media/pls/kcsm/kcsm-kcsm-sc64.pls",
    "http://www.kqed.org/radio/listen/kqedradio.m3u",
    "http://kuscstream.org/mp3/kusc128.m3u",
    "http://www.wnyc.org/stream/wnyc-fm939/mp3.pls",
    "http://www.wnyc.org/stream/wnyc-am820/mp3.pls",
    "http://wamu.org/streams/live/1/live.pls",
    "http://www.wqxr.org/stream/wqxr/mp3.pls",
    "http://stream.weta.org:8000/listen.pls",
    "http://wbez.ic.llnwd.net/stream/wbez_91_5_fm.pls",
    "http://audio.wbur.org/stream/live_mp3.m3u",
    "http://media.kcrw.com/live/kcrwmusic.pls",
    "http://media.kcrw.com/live/kcrwlive.pls",
    "http://media.kcrw.com/live/kcrwnews.pls",
    "http://207.245.67.204/listen.pls",
    "http://pba-ice.streamguys.org/wabe.m3u",
    "http://pba-ice.streamguys.org/classical.m3u",
    "http://pba-ice.streamguys.org/news.m3u",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377716",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377212",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=614375",
    "http://www.laut.fm/filmradio",
    "http://streaming.radionomy.com:8000/RadioCinema",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=713478",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1325107",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1263408",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1325240",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1267084",
    "http://yp.shoutcast.com/sbin/tunein-station.pls?id=506307",
    ]

if stream==None:
    # Build Menu
    for streamIndex in range(len(streamUrls)) :
        AddMenuItem( sys.argv[0], sys.argv[1], streamIndex );

    xbmcplugin.endOfDirectory(int(sys.argv[1]))

else:
    print "Playing stream "+str(stream)+": "+__language__(firstStringId+int(str(stream))-1)
    print "-->URL: "+streamUrls[stream-1]
    PLAY( streamUrls[stream-1] )
Can someone rehost the zip file please? The http://xbmcnpr.googlecode.com/files/audio.NPR.zip link seems to be broken..