[Slim-Checkins] r12608 - in /trunk/server/Slim: Buttons/XMLBrowser.pm Formats/XML.pm Plugin/Favorites/Plugin.pm Web/XMLBrowser.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Sun Aug 19 04:07:40 PDT 2007
Author: adrian
Date: Sun Aug 19 04:07:39 2007
New Revision: 12608
URL: http://svn.slimdevices.com?rev=12608&view=rev
Log:
Bug: N/A
Description: small additons to xmlbrowser to impove ability to fetch
and display information streams:
- web/cli/button - allow subfeed to replace current entry (avoiding
extra menu when subfeed is used to add description for current entry
- button - display description in opml mode (aligns with cli/web)
- feed hash may set cachetime to allow default to be modified
Modified:
trunk/server/Slim/Buttons/XMLBrowser.pm
trunk/server/Slim/Formats/XML.pm
trunk/server/Slim/Plugin/Favorites/Plugin.pm
trunk/server/Slim/Web/XMLBrowser.pm
Modified: trunk/server/Slim/Buttons/XMLBrowser.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/XMLBrowser.pm?rev=12608&r1=12607&r2=12608&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/XMLBrowser.pm (original)
+++ trunk/server/Slim/Buttons/XMLBrowser.pm Sun Aug 19 04:07:39 2007
@@ -348,18 +348,26 @@
$client->execute( \@p );
}
- # Push staight into remotetrackinfo if a playlist of one was returned
- if ($params->{'item'}->{'type'} && $params->{'item'}->{'type'} eq 'playlist' && scalar @{ $opml->{'items'} || [] } == 1) {
+ # Push staight into remotetrackinfo if asked to replace item or a playlist of one was returned
+ if ($params->{'item'}->{'type'} && $params->{'item'}->{'type'} =~ /^(replace|playlist)$/ && scalar @{ $opml->{'items'} || [] } == 1) {
my $item = $opml->{'items'}[0];
my $title = $item->{'name'} || $item->{'title'};
+ my $url = $item->{'url'};
+
my %params = (
- 'url' => $item->{'url'},
- 'title' => $title,
- 'header' => fitTitle( $client, $title),
+ 'url' => $url,
+ 'title' => $title,
+ 'header' => fitTitle($client, $title),
);
+ if (!defined $url) {
+ $params{'hideTitle'} = 1;
+ $params{'hideURL'} = 1;
+ }
+
if ($item->{'description'}) {
- $params{'details'} = [ $item->{'description'} ];
+ my ($curline, @lines) = _breakItemIntoLines( $client, $item );
+ $params{'details'} = \@lines;
}
return Slim::Buttons::Common::pushModeLeft($client, 'remotetrackinfo', \%params);
@@ -434,10 +442,15 @@
my $hasItems = ( ref $item->{'items'} eq 'ARRAY' ) ? scalar @{$item->{'items'}} : 0;
my $isAudio = ($item->{'type'} && $item->{'type'} eq 'audio') ? 1 : 0;
- my $itemURL = $item->{'url'} || $item->{'value'};
+ my $itemURL = $item->{'url'};
my $title = $item->{'name'} || $item->{'title'};
my $parser = $item->{'parser'};
+ # Set itemURL to value, but only if value was not created from the name above
+ if (!defined $itemURL && $item->{'value'} && $item->{'value'} ne $item->{'name'}) {
+ $itemURL = $item->{'value'};
+ }
+
# Allow text-only items that RadioTime uses
if ( $item->{'type'} && $item->{'type'} eq 'text' ) {
undef $itemURL;
@@ -534,6 +547,11 @@
);
}
+ elsif (hasDescription($item)) {
+
+ displayItemDescription($client, $item);
+
+ }
else {
$client->bumpRight();
@@ -1464,9 +1482,12 @@
$subFeed = $subFeed->{'items'}->[$i];
}
- if ($subFeed->{'type'} && $subFeed->{'type'} eq 'playlist' && scalar @{ $feed->{'items'} } == 1) {
- # in the case of a playlist of one update previous entry
+ if ($subFeed->{'type'} && $subFeed->{'type'} =~ /^(replace|playlist)$/ && scalar @{ $feed->{'items'} } == 1) {
+ # in the case of a replacable menu or playlist of one update previous entry to avoid new menu level
my $item = $feed->{'items'}[0];
+ if ($subFeed->{'type'} eq 'replace') {
+ delete $subFeed->{'url'};
+ }
for my $key (keys %$item) {
$subFeed->{ $key } = $item->{ $key };
}
@@ -1481,7 +1502,7 @@
# parent url of 'NONE' should not be recached as we are being passed a preparsed hash
# re-cache the parsed XML to include the sub-feed
my $cache = Slim::Utils::Cache->new();
- my $expires = $Slim::Formats::XML::XML_CACHE_TIME;
+ my $expires = $feed->{'cachetime'} || $Slim::Formats::XML::XML_CACHE_TIME;
$log->info("Re-caching parsed XML for $expires seconds.");
Modified: trunk/server/Slim/Formats/XML.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Formats/XML.pm?rev=12608&r1=12607&r2=12608&view=diff
==============================================================================
--- trunk/server/Slim/Formats/XML.pm (original)
+++ trunk/server/Slim/Formats/XML.pm Sun Aug 19 04:07:39 2007
@@ -229,11 +229,12 @@
# Cache the parsed XML
if ( Slim::Utils::Misc::shouldCacheURL( $http->url ) ) {
- my $cache = Slim::Utils::Cache->new();
-
- $log->info("Caching parsed XML for $XML_CACHE_TIME seconds");
-
- $cache->set( $http->url() . '_parsedXML', $feed, $XML_CACHE_TIME );
+ my $cache = Slim::Utils::Cache->new();
+ my $expires = $feed->{'cachetime'} || $XML_CACHE_TIME;
+
+ $log->info("Caching parsed XML for $expires seconds");
+
+ $cache->set( $http->url() . '_parsedXML', $feed, $expires );
}
else {
Modified: trunk/server/Slim/Plugin/Favorites/Plugin.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Favorites/Plugin.pm?rev=12608&r1=12607&r2=12608&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Favorites/Plugin.pm (original)
+++ trunk/server/Slim/Plugin/Favorites/Plugin.pm Sun Aug 19 04:07:39 2007
@@ -338,7 +338,7 @@
$entry->{'URL'} = $params->{'entryurl'};
- if ($params->{'entryurl'} =~ /\.opml$/) {
+ if ($params->{'entryurl'} =~ /\.(opml|xml|rss)$/) {
delete $entry->{'type'};
} else {
$entry->{'type'} = 'audio';
Modified: trunk/server/Slim/Web/XMLBrowser.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/XMLBrowser.pm?rev=12608&r1=12607&r2=12608&view=diff
==============================================================================
--- trunk/server/Slim/Web/XMLBrowser.pm (original)
+++ trunk/server/Slim/Web/XMLBrowser.pm Sun Aug 19 04:07:39 2007
@@ -371,9 +371,12 @@
$subFeed = $subFeed->{'items'}->[$i];
}
- if ($subFeed->{'type'} && $subFeed->{'type'} eq 'playlist' && scalar @{ $feed->{'items'} } == 1) {
- # in the case of a playlist of one update previous entry
+ if ($subFeed->{'type'} && $subFeed->{'type'} =~ /^(replace|playlist)$/ && scalar @{ $feed->{'items'} } == 1) {
+ # in the case of a replace entry or playlist of one update previous entry to avoid adding a new menu level
my $item = $feed->{'items'}[0];
+ if ($subFeed->{'type'} eq 'replace') {
+ delete $subFeed->{'url'};
+ }
for my $key (keys %$item) {
$subFeed->{ $key } = $item->{ $key };
}
@@ -396,7 +399,7 @@
# parentURL of 'NONE' indicates we were called with preparsed hash which should not be cached
# re-cache the parsed XML to include the sub-feed
my $cache = Slim::Utils::Cache->new();
- my $expires = $Slim::Formats::XML::XML_CACHE_TIME;
+ my $expires = $feed->{'cachetime'} || $Slim::Formats::XML::XML_CACHE_TIME;
$log->info("Re-caching parsed XML for $expires seconds.");
More information about the checkins
mailing list