Bug 6699 - Adding XMLBrowser items to favorites always sets type="audio"
: Adding XMLBrowser items to favorites always sets type="audio"
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: XML
: 7.0
: Macintosh Other
: P2 normal (vote)
: ---
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-21 10:27 UTC by Andy Grundman
Modified: 2008-12-18 11:12 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Grundman 2008-01-21 10:27:40 UTC
Even though you can add any XMLBrowser menu to favorites, they are always saved to favorites.opml as type="audio" so they don't browse properly.
Comment 1 Andy Grundman 2008-01-21 10:30:40 UTC
Triode: This bit of code in OpmlFavorites.pm is the culprit I think, should we not just keep the same type as the original item?

	if ($parser) {

		$entry->{'parser'} = $parser;
		$entry->{'type'}   = $type if $type;

	} elsif ($url !~ /\.opml$/) {

		$entry->{'type'} = 'audio';
	};
Comment 2 Andy Grundman 2008-01-21 10:37:31 UTC
OK, this patch fixes it for at least the case of adding a playlist (i.e. an LMA concert), but the problem is that adding menu items without a type (i.e. most menus that contain other menus) still get set as type="audio".  Perhaps the web code should not let you add items without a type to favorites.

--- Slim/Plugin/Favorites/OpmlFavorites.pm	(revision 27475)
+++ Slim/Plugin/Favorites/OpmlFavorites.pm	(local)
@@ -160,18 +160,14 @@
 	my $entry = {
 		'text' => $title,
 		'URL'  => $url,
+		'type' => $type || 'audio',
 	};
 
 	if ($parser) {
 
 		$entry->{'parser'} = $parser;
-		$entry->{'type'}   = $type if $type;
+	}
 
-	} elsif ($url !~ /\.opml$/) {
-
-		$entry->{'type'} = 'audio';
-	};
-
 	# add it to end of top level
 	push @{$class->toplevel}, $entry;
 
Comment 3 Adrian Smith 2008-01-21 10:56:06 UTC
I'm missing something Andy - I can already add menu levels from staff picks and alien to favorites as they are .opml urls - I think your patch will break this!

For refered opml files the current code should not set a type - what do LMA concerts look like.
Comment 4 Andy Grundman 2008-01-21 11:05:18 UTC
But look at all the SN services, none of those use URLs that end in ".opml" so it breaks there.  Try adding the "Recent Additions" menu from LMA and you'll see what I mean.  Also the same thing happens with Radiotime.

The OPML SN returns looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<opml version="1.1">
  <head title="Live Music Archive">
    <expansionState></expansionState>
  </head>
  <body>
    <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/artists" text="Artists" />
    <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/recent" text="Recent Additions" />
    <outline text="Search">
      <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/search?type=creator&amp;q={QUERY}" text="Search by Artist" type="search" />
      <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/search?type=date&amp;q={QUERY}" text="Search by Date" type="search" />
      <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/search?type=location&amp;q={QUERY}" text="Search by Location" type="search" />
      <outline URL="http://www.squeezenetwork.com:3000/api/lma/v1/opml/search?type=title&amp;q={QUERY}" text="Search by Track" type="search" />
    </outline>
  </body>
</opml>
Comment 5 Andy Grundman 2008-01-21 11:35:04 UTC
Fixed in change 16533.  Still needs some cleanup on the SN side.
Comment 6 Chris Owens 2008-03-07 09:03:27 UTC
This bug is being closed since it was resolved for a version which is now released!  Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html

If you are still seeing this bug, please re-open it and we will consider it for a future release.