Bug 7029 - need url in play/add params for xml browse items
: need url in play/add params for xml browse items
Status: CLOSED FIXED
Product: SB Controller
Classification: Unclassified
Component: Browser
: unspecified
: Macintosh Other
: P1 normal (vote)
: 7.0
Assigned To: Ben Klaas
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-08 07:08 UTC by Ben Klaas
Modified: 2009-09-08 09:26 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
patch of what I have so far...command does not work because URL is not correct (2.31 KB, patch)
2008-02-09 21:50 UTC, Ben Klaas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Klaas 2008-02-08 07:08:35 UTC
the params to a given item in xml browse that can be played are not being sent correctly.

Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:06:34:8b",
                        ["trackinfo", "playlist", "play", "item_id:2.0.3"],
                      ],
          response => "/f24217fa/slim/request",
        },
    id => 92,
  },
]

there needs to be a URL in a request like this.

mine to fix.
Comment 1 Andy Grundman 2008-02-08 07:11:08 UTC
Note this is only for trackinfo.
Comment 2 Ben Klaas 2008-02-09 16:08:12 UTC
I changed XMLBrowser to get the URL sent as a param to the command, but it fails. Wrong cli command?

[18:03:29.7535] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:06:33:d0",
                        [
                          "trackinfo", "playlist", "play", "url:http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbum?albumId=Alb.279303&inLibrary=0",
                        ],
                      ],
          response => "/9211de9b/slim/request",
        },
    id => 15,
  },
]
[18:03:29.7544] Slim::Web::Cometd::sendHTTPResponse (637) Sending Cometd Response:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 111
Content-Type: application/json
Expires: -1

[{"error":"invalid request: Unknown in dispatch table","id":"15","channel":"/slim/request","successful":false}]

Comment 3 Andy Grundman 2008-02-09 17:19:26 UTC
Mentioned this in Campfire but putting it here as well.

The trackinfo CLI command is missing a function for 'trackinfo playlist'.  The following patch will add it.

--- Slim/Buttons/TrackInfo.pm	(revision 29028)
+++ Slim/Buttons/TrackInfo.pm	(local)
@@ -39,6 +39,11 @@
 		[ 'trackinfo', 'items', '_index', '_quantity' ],
 		[ 1, 1, 1, \&cliQuery ]
 	);
+	
+	Slim::Control::Request::addDispatch(
+		[ 'trackinfo', 'playlist', '_method' ],
+		[ 1, 1, 1, \&cliQuery ]
+	);
 
 	%functions = (
 
Comment 4 Ben Klaas 2008-02-09 18:30:03 UTC
still not quite working...the command gets sent to cliQuery but doesn't play anything...still trying to figure out why. it's hitting a part of the XMLBrowse code where it's expecting some data from a $subFeed data structure, and Data::Dump is showint $subFeed to be empty when executing the command.

Comment 5 Ben Klaas 2008-02-09 19:05:31 UTC
some debug code...

We're getting to the point where the playlist command is being executed for the url, but it doesn't play it and the playerstatus response that is sent back contains no tracks


[21:00:20.3326] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:06:33:d0",
                        [
                          "trackinfo",
                          "playlist",
                          "play",
                          "title:100th Window by Massive Attack (2003)",
                          "url:http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbum?albumId=Alb.279303&inLibrary=0",
                        ],
                      ],
          response => "/c4b7aa4b/slim/request",
        },
    id => 19,
  },
]
[21:00:20.3335] Slim::Buttons::XMLBrowser::cliQuery (1201) cliQuery(trackinfo)
[21:00:20.3338] Slim::Buttons::XMLBrowser::cliQuery (1214) Feed is already XML data!
[21:00:20.3341] Slim::Buttons::XMLBrowser::_cliQuery_done (1244) _cliQuery_done()
[21:00:20.3344] Slim::Buttons::XMLBrowser::_cliQuery_done (1626) Play an item.
[21:00:20.3349] Slim::Buttons::XMLBrowser::_cliQuery_done (1634) ------------------------
[21:00:20.3352] Slim::Buttons::XMLBrowser::_cliQuery_done (1675) ------------------------
[21:00:20.3356] Slim::Buttons::XMLBrowser::_cliQuery_done (1713) ------------------------
[21:00:20.3359] Slim::Buttons::XMLBrowser::_cliQuery_done (1714) Playing/adding all items:
http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbum?albumId=Alb.279303&inLibrary=0
[21:00:20.3362] Slim::Buttons::XMLBrowser::_cliQuery_done (1719) ------------------------
[21:00:20.3439] Slim::Web::Cometd::requestCallback (800) requestCallback got results for /c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0 / 5
[21:00:20.3442] Slim::Web::Cometd::Manager::deliver_events (209) Sending event on channel /c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0 to c4b7aa4b
[21:00:20.3453] Slim::Web::Cometd::Manager::deliver_events (223) Delivering events to c4b7aa4b:
[
  {
    channel => "/c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0",
    data => {
          # tied Tie::IxHash
          display => {
                "icon-id" => 0,
                text => ["100th Window by Massive Attack (2003)"],
                type => "song",
              },
          type => "showbriefly",
        },
    ext => { priority => "" },
    id => 5,
  },
]
[21:00:20.3757] Slim::Web::Cometd::sendHTTPResponse (644) Sending Cometd chunk:
[{"data":{"type":"showbriefly","display":{"icon-id":"0","text":["100th Window by Massive Attack (2003)"],"type":"song"}},"id":"5","channel":"/c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0","ext":{"priority":""}}]
[21:00:20.3802] Slim::Web::Cometd::handleRequest (779) Request for /c4b7aa4b/slim/request / 19 is not async
[21:00:20.3806] Slim::Web::Cometd::Manager::deliver_events (209) Sending event on channel /c4b7aa4b/slim/request to c4b7aa4b
[21:00:20.3814] Slim::Web::Cometd::Manager::deliver_events (223) Delivering events to c4b7aa4b:
[
  {
    channel => "/c4b7aa4b/slim/request",
    data => {
          # tied Tie::IxHash
        },
    ext => { priority => "" },
    id => 19,
  },
]
[21:00:20.3825] Slim::Web::Cometd::sendHTTPResponse (644) Sending Cometd chunk:
[{"data":{},"id":"19","channel":"/c4b7aa4b/slim/request","ext":{"priority":""}}]
[21:00:20.3832] Slim::Web::Cometd::sendHTTPResponse (637) Sending Cometd Response:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 73
Content-Type: application/json
Expires: -1

[{"clientId":null,"id":"19","channel":"/slim/request","successful":true}]
[21:00:20.3947] Slim::Web::Cometd::requestCallback (800) requestCallback got results for /c4b7aa4b/slim/menustatus/00:04:20:06:33:d0 / 2
[21:00:20.3953] Slim::Web::Cometd::Manager::deliver_events (209) Sending event on channel /c4b7aa4b/slim/menustatus/00:04:20:06:33:d0 to c4b7aa4b
[21:00:20.3970] Slim::Web::Cometd::Manager::deliver_events (223) Delivering events to c4b7aa4b:
[
  {
    channel => "/c4b7aa4b/slim/menustatus/00:04:20:06:33:d0",
    data => [
          "menustatus",
          [
            {
              actions => { "do" => { cmd => ["power", 0], player => 0 } },
              displayWhenOff => 1,
              id => "playerpower",
              node => "home",
              text => "Turn Off Office SB3",
              weight => 100,
            },
          ],
          "add",
          "00:04:20:06:33:d0",
        ],
    ext => { priority => "" },
    id => 2,
  },
]
[21:00:20.3976] Slim::Web::Cometd::sendHTTPResponse (644) Sending Cometd chunk:
[{"data":["menustatus",[{"actions":{"do":{"cmd":["power","0"],"player":"0"}},"text":"Turn Off Office SB3","weight":"100","displayWhenOff":"1","id":"playerpower","node":"home"}],"add","00:04:20:06:33:d0"],"id":"2","channel":"/c4b7aa4b/slim/menustatus/00:04:20:06:33:d0","ext":{"priority":""}}]
[21:00:20.6547] Slim::Web::Cometd::requestCallback (800) requestCallback got results for /c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0 / 5
[21:00:20.6550] Slim::Web::Cometd::Manager::deliver_events (209) Sending event on channel /c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0 to c4b7aa4b
[21:00:20.6561] Slim::Web::Cometd::Manager::deliver_events (223) Delivering events to c4b7aa4b:
[
  {
    channel => "/c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0",
    data => {
          # tied Tie::IxHash
          display => { text => undef },
          type => "showbriefly",
        },
    ext => { priority => "" },
    id => 5,
  },
]
[21:00:20.6566] Slim::Web::Cometd::sendHTTPResponse (644) Sending Cometd chunk:
[{"data":{"type":"showbriefly","display":{"text":null}},"id":"5","channel":"/c4b7aa4b/slim/displaystatus/00:04:20:06:33:d0","ext":{"priority":""}}]
[21:00:20.9713] Slim::Web::Cometd::requestCallback (800) requestCallback got results for /c4b7aa4b/slim/playerstatus/00:04:20:06:33:d0 / 4
[21:00:20.9716] Slim::Web::Cometd::Manager::deliver_events (209) Sending event on channel /c4b7aa4b/slim/playerstatus/00:04:20:06:33:d0 to c4b7aa4b
[21:00:20.9739] Slim::Web::Cometd::Manager::deliver_events (223) Delivering events to c4b7aa4b:
[
  {
    channel => "/c4b7aa4b/slim/playerstatus/00:04:20:06:33:d0",
    data => {
          # tied Tie::IxHash
          base => {
                actions => {
                             go => {
                                     cmd => ["songinfo"],
                                     itemsParams => "params",
                                     params => { menu => "nowhere" },
                                   },
                           },
                window  => { titleStyle => "album" },
              },
          count => 0,
          "mixer volume" => 100,
          mode => "stop",
          player_connected => 1,
          player_name => "Office SB3",
          "playlist repeat" => 2,
          "playlist shuffle" => 0,
          playlist_tracks => 0,
          power => 1,
          signalstrength => 94,
        },
    ext => { priority => "" },
    id => 4,
  },
]
Comment 6 Andy Grundman 2008-02-09 19:30:06 UTC
Hmm, the problem might be that that url param should always be the playlist URL, i.e. rhapd://..., not a Rhapsody OPML URL.  Also shouldn't there be an item_id param?
Comment 7 Ben Klaas 2008-02-09 20:23:22 UTC
now I'm sending the item_id and the playlist url instead of the OPML url (note though, it's still an http:// not a rhap:// ). Playlist command still fails.

[22:17:46.7162] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:06:33:d0",
                        [
                          "trackinfo",
                          "playlist",
                          "play",
                          "item_id:2.0.20",
                          "url:http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbumTracks?albumId=Alb.7048902",
                          "title:Unleashed by Massive Attack (2005)",
                        ],
                      ],
          response => "/426f96b5/slim/request",
        },
    id => 61,
  },
]
Comment 8 Andy Grundman 2008-02-09 21:09:18 UTC
Hmm, but it should be the rhapd://Tra.xxxxxxx.wma URL there and then I think it would work.

Track info:
[00:06:14.3580] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:10:01:6a",
                        [
                          "trackinfo",
                          "items",
                          0,
                          200,
                          "menu:menu",
                          "url:rhapd://Tra.6573284.wma",
                        ],
                      ],
          response => "/6713146f/slim/request",
        },
    id => 16,
  },
]

Artists:
00:06:58.3846] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:10:01:6a",
                        [
                          "trackinfo",
                          "items",
                          0,
                          200,
                          "item_id:2",
                          "url:rhapd://Tra.6573284.wma",
                          "menu:trackinfo",
                        ],
                      ],
          response => "/6713146f/slim/request",
        },
    id => 18,
  },
]

All Albums:
[00:07:36.2194] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:10:01:6a",
                        [
                          "trackinfo",
                          "items",
                          0,
                          200,
                          "item_id:2.0",
                          "url:rhapd://Tra.6573284.wma",
                          "menu:trackinfo",
                        ],
                      ],
          response => "/6713146f/slim/request",
        },
    id => 19,
  },
]

An album:
[00:08:42.1802] Slim::Web::Cometd::handler (145) Cometd request: [
  {
    channel => "/slim/request",
    data => {
          request  => [
                        "00:04:20:10:01:6a",
                        [
                          "trackinfo",
                          "items",
                          0,
                          200,
                          "item_id:2.0.9",
                          "url:rhapd://Tra.6573284.wma",
                          "menu:trackinfo",
                        ],
                      ],
          response => "/6713146f/slim/request",
        },
    id => 20,
  },
]
Comment 9 Ben Klaas 2008-02-09 21:13:14 UTC
but where do I get rhapd:// urls from? AFAICT, all I have available is the $item object when constructing the trackinfo command for a given item. $item have playlist and url keys, both of which are http:// urls.

Are there additional metadata available that I'm missing here?
Comment 10 Andy Grundman 2008-02-09 21:21:44 UTC
Isn't it part of the playerstatus playlist data?  That's what sets up the original trackinfo call when you drill down.  For example:

                { 
                  # tied Tie::IxHash
                  actions   => { 
                                 go => { 
                                         cmd => ["trackinfo", "items"],
                                         params => { menu => "menu", url => "rhapd://Tra.9853522.wma" },
                                       },
                               },
                  icon      => "http://image.listen.com/img/170x170/8/5/3/9/829358_170x170.jpg",
                  params    => { track_id => 11_425 },
                  text      => "Robot\nLive From Out There\nThe Pnuma Trio",
                  trackType => "radio",
                },
Comment 11 Ben Klaas 2008-02-09 21:50:33 UTC
Created attachment 2839 [details]
patch of what I have so far...command does not work because URL is not correct

When I display all the rhapsody albums for a given artist, I have metadata on each menu item. For example:

[23:48:12.8840] Data::Dump::dump (100) Warning: {
  image    => "http://image.listen.com/img/170x170/6/3/7/7/397736_170x170.jpg",
  items    => [],
  name     => "Protection by Massive Attack (1995)",
  playlist => "http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbumTracks?albumId=Alb.322083",
  type     => "playlist",
  url      => "http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbum?albumId=Alb.322083&inLibrary=0",
  value    => "http://www.beta.squeezenetwork.com/api/rhapsody/v1/opml/metadata/getAlbum?albumId=Alb.322083&inLibrary=0",
}

the values in this structure are what I am using to set the url params for the trackinfo command. I don't see a rhapsody URL anywhere for this.
Comment 12 Andy Grundman 2008-02-10 10:06:46 UTC
Sorry Ben, I think the patch is much simpler, this appears to fix it for me:

--- Slim/Buttons/XMLBrowser.pm	(revision 29034)
+++ Slim/Buttons/XMLBrowser.pm	(local)
@@ -1769,11 +1769,13 @@
 								'player' => 0,
 								'cmd' => [$query, 'playlist', 'play'],
 								'itemsParams' => 'params',
+								'params' => $params,
 							},
 							'add' => {
 								'player' => 0,
 								'cmd' => [$query, 'playlist', 'add'],
 								'itemsParams' => 'params',
+								'params' => $params,
 							},
 						},
 					};
Comment 13 Andy Grundman 2008-02-10 10:13:23 UTC
Fixed in change 17380.
Comment 14 James Richardson 2008-05-15 13:03:26 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html