dailypodcasts -> daily-podcasts
I also added code to sort by pubDate so negative limits are treated as positive
I permanently disabled the plugin as a standalone plugin. The plugin is still there, but only run when a MediaItem id points to the plugin
I do podcasts every day, mainly to keep up with my sports teams. I modified zoster's quick and dirty files to do podcasts like I like them.
Podcasts are not uniform so I was able to modify each feed to my liking with an xml file. The xml file limits the fetch to the number of files per day. Some podcast titles don't have the feed name in the item titles so I added header and footer to the xml to append them to the podcast title.
- Code: Select all
<?php
$myMediaItems[] = array(
'id' => 'umsp://plugins/dailypodcasts?feed_list=/boot/sportspods.xml',
'parentID' => '0',
'restricted' => '1',
'dc:title' => 'Sports Podcasts',
'upnp:class' => 'object.container',
);
$myMediaItems[] = array(
'id' => 'umsp://plugins/dailypodcasts?feed_list=/boot/pubradiopods.xml',
'parentID' => '0',
'restricted' => '1',
'dc:title' => 'Public Radio Podcasts',
'upnp:class' => 'object.container',
);
?>
My xml files are on the ext3 stick which is mounted on /boot.
/boot/sportspods.xml:
- Code: Select all
<?xml version="1.0"?>
<list>
<item>
<description>The Dan Patrick Show</description>
<url>http://rss.cnn.com/services/podcasting/danpatrick/rss.xml</url>
<limit>-3</limit>
</item>
<item>
<description>Patrick Reusse on am1500 KSTP</description>
<url>http://rss.1500espn.com/ondemand/reusse</url>
<limit>2</limit>
</item>
<item>
<description>Saturday Morning SportsTalk on am1500 KSTP</description>
<url>http://rss.1500espn.com/ondemand/satsportstalk</url>
<limit>2</limit>
</item>
<item>
<description>Sunday Morning SportsTalk on am1500 KSTP</description>
<url>http://rss.1500espn.com/ondemand/sunsportstalk</url>
<limit>1</limit>
</item>
<item>
<description>Weekday SportsTalk on am1500 KSTP</description>
<url>http://rss.1500espn.com/ondemand/sportstalk</url>
<limit>2</limit>
</item>
<item>
<description>Dan Barreiro KFAN AM 1130</description>
<url>http://www.kfan.com/podcast/KFAN_Barreiro.xml</url>
<limit>-3</limit>
<header>Dan Barreiro </header>
</item>
<item>
<description>Purple on Demand Vikings</description>
<url>http://www.kfan.com/podcast/KFAN_Vikings.xml</url>
<limit>4</limit>
<header>Purple on Demand Vikings </header>
</item>
<item>
<description>Joe Soucheray and Garage Logic on am1500 KSTP</description>
<url>http://rss.1500espn.com/ondemand/garagelogic</url>
<limit>2</limit>
</item>
<item>
<description>Best of Mike and Mike</description>
<url>http://sports.espn.go.com/espnradio/podcast/feeds/itunes/podCast?id=2445552</url>
<limit>1</limit>
</item>
</list>
/boot/pubradiopods.xm
- Code: Select all
<?xml version="1.0"?>
<list>
<item>
<description>Car Talk</description>
<url>http://www.npr.org/rss/podcast.php?id=510208</url>
<limit>1</limit>
</item>
<item>
<description>The Splendid Table</description>
<url>http://americanpublicmedia.publicradio.org/podcasts/xml/splendid_table/kitchen_questions.xml</url>
<limit>1</limit>
</item>
<item>
<description>This American Life</description>
<url>http://feeds.thisamericanlife.org/talpodcast</url>
<limit>1</limit>
<header>This American Life </header>
</item>
<item>
<description>Science Friday</description>
<url>http://www.npr.org/rss/podcast.php?id=510221</url>
<limit>10</limit>
<header>>Science Friday </header> </item>
<item>
<description>Wait Wait Don't Tell Me</description>
<url>http://www.npr.org/rss/podcast.php?id=35</url>
<limit>1</limit>
</item>
</list>
Not quick, but maybe dirty /etc/umsp/plugins/dailypodcasts.php:
- Code: Select all
<?php
function _pluginMain($prmQuery) {
$queryData = array();
parse_str($prmQuery, $queryData);
if ($queryData['feed_url'] !='') {
$items = _pluginItemList($queryData['feed_url'], 64, '', '');
return $items;
} # end if
if ($queryData['feed_list'] !='') {
$items = _pluginFeedList($queryData['feed_list']);
return $items;
} # end if
} # end function
function _pluginItemList($prmFeedUrl, $prmMax, $prmHeader, $prmFooter, $prmImage) {
# Nodes are currently only parsed by name not parent.
#
$newFeed = array(
'genre' => 'Podcast', #feed category
'albumArtURI' => '', #feed image
'album' => '', #feed title
);
$reader = new XMLReader();
$feedXML = file_get_contents($prmFeedUrl);
$reader->XML($feedXML);
$retMediaItems = array();
$max = $prmMax;
$image = '';
if($max<0){$max = 0 - $max;};
while (($max>0) and $reader->read()){
if (($reader->nodeType == XMLReader::ELEMENT) && ($reader->localName == 'image')) {
$newFeed['albumArtURI'] = $reader->getAttribute('href');
if ($newFeed['albumArtURI'] == ''){
do {
$reader->read();
if($reader->localName == 'url') {
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newFeed['albumArtURI'] = $reader->value;
} # end if
}
} while (!(($reader->nodeType == XMLReader::END_ELEMENT) && ($reader->localName == 'image')));
}
}
if (($reader->nodeType == XMLReader::ELEMENT) && ($reader->localName == 'item')) {
$newItem = array();
#
# Read item nodes until end
#
do {
$reader->read();
switch ($reader->localName) {
case 'pubDate':
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newItem['artist'] = $reader->value;
} # end if
break;
case 'guid':
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newItem['id'] = $reader->value;
} # end if
break;
case 'title':
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newItem['title'] = $prmHeader . $reader->value . $prmFooter;
} # end if
break;
case 'enclosure':
$newItem['url'] = $reader->getAttribute('url');
$newItem['type'] = $reader->getAttribute('type');
break;
} # end switch
} while (!(($reader->nodeType == XMLReader::END_ELEMENT) && ($reader->localName == 'item')));
#
# New feed item parsed. Now add as media item:
#
$itemType = explode('/', $newItem['type'], 2);
switch (strtolower($itemType[0])) {
case 'video':
$upnpClass = 'object.item.videoItem';
break;
case 'audio':
$upnpClass = 'object.item.audioItem';
break;
case 'image':
$upnpClass = 'object.item.imageItem';
break;
default:
# default to video item ?
$upnpClass = 'object.item.videoItem';
} # end switch
$MediaItem = array (
'id' => 'umsp://plugins/podcasts?' . $newItem['id'],
'dc:title' => $newItem['title'],
'res' => $newItem['url'],
'upnp:class' => $upnpClass,
'protocolInfo' => 'http-get:*:' . $newItem['type'] . ':*',
'upnp:artist' => $newItem['artist'], #artist = pubDate
'upnp:albumArtURI' => $newFeed['albumArtURI'],
'upnp:genre' => $newFeed['genre'],
'upnp:album' => $newFeed['album'],
);
if($prmMax<0){
array_unshift($retMediaItems, $MediaItem);
} else {
array_push($retMediaItems, $MediaItem);
}
$max--;
} # end if
if (($reader->nodeType == XMLReader::ELEMENT) && ($reader->localName == 'title')) {
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newFeed['album'] = $reader->value;
} # end if
}
if (($reader->nodeType == XMLReader::ELEMENT) && ($reader->localName == 'category')) {
$reader->read();
if ($reader->nodeType == XMLReader::TEXT) {
$newFeed['genre'] = $reader->value;
} # end if
}
} #end while
return $retMediaItems;
} # end function
function _pluginFeedList($prmFeedList) {
# Nodes are currently only parsed by name not parent.
#
$listreader = new XMLReader();
$feedlistXML = file_get_contents($prmFeedList);
$listreader->XML($feedlistXML);
$retListItems = array();
while ($listreader->read()) {
if (($listreader->nodeType == XMLReader::ELEMENT) && ($listreader->localName == 'item')) {
$footer = '';
$header = '';
$newItem = array();
#
# Read item nodes until end
#
do {
$listreader->read();
switch ($listreader->localName) {
case 'image':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$image = $listreader->value;
} # end if
break;
case 'header':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$header = $listreader->value;
} # end if
break;
case 'footer':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$footer = $listreader->value;
} # end if
break;
case 'description':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$description = $listreader->value;
} # end if
break;
case 'url':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$url = utf8_decode($listreader->value);
} # end if
break;
case 'limit':
$listreader->read();
if ($listreader->nodeType == XMLReader::TEXT) {
$limit = (int)utf8_decode($listreader->value);
} # end if
break;
} # end switch
} while (!(($listreader->nodeType == XMLReader::END_ELEMENT) && ($listreader->localName == 'item')));
#
# New feed item parsed. Now add as media item(make playlist oldest first):
#
$ListItem = _pluginItemList($url, $limit, $header, $footer, $image);
if($ListItem != ''){
$retListItems = array_merge($retListItems, $ListItem);
}
} # end if
} #end while
return $retListItems;
} # end function
?>
It was really fun making my podcasts like I like them. I hope others like my way. too.

