Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 59

Thread: iPeng and YT

  1. #11
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,982
    This reminds me of the issue I'm seeing with the Random Albums: sometimes the menu returned by LMS wouldn't be the same as before. In the case of Random Albums this because it is supposed to return a random list, of course. But in your case: make sure the menu you return is "always" the same. Obviously a search can change. But do you eg. cache search results? You'd only have to cache it long enough for the menu to be triggered. Assuming people don't stay on the search result list all the time, caching results for a minute or two might make sense.
    Michael

    http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo

  2. #12
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,376
    Hm, could you please post such a long log (the full one as above) of a query that does _not_ work.?

    I'm still confused about what works and what doesn't, to be honest. You write:

    Quote Originally Posted by philippe_44 View Post
    It's not that they don't work but the query sent to YT is wrong when LMS returns you a contextmenu. The item_id are something like X.Y and not X_query.Y. And it does that when it has received a query from iPeng like
    Yes, I can see that.
    Unfortunately it's the part I cannot reproduce, when I try this in my setup (tried both of my test servers) I _always_ have a "X_query.Y" type of ID.

    The other difference I see is around the "search => ..." term.
    These seem to be the queries that DON'T work but again, I never see this.

    Code:
    [18-01-07 17:13:36.8923] Slim::Control::XMLBrowser::cliQuery (47) {
      _index => 0,
      _quantity => 100,
      cachesearch => 1,
      item_id => 2,
      menu => "youtube",
      search => "essai",
      useContextMenu => 1,
      userInterfaceIdiom => "iPeng",
      "xmlbrowserPlayControl" => 14,		
    }
    The problem seems to be the use of xmlBrowerPlayControl.
    That's just a parameter iPeng passes back if it's provided in the menu. iPeng doesn't know anything about this parameter and leaves it as it is.

    See below such "wrong" context menu data (see 2.14 for item_id)
    Yes, I've seen these in your original logs above but I can't see them in any of the menu definitions (that's missing from the original logs above, you only provided the full log for the working example) and I can't reproduce it.

    So when you send a "play" (one of the potential actions), then the params are wrong, they are missing the search value (essai in my case).
    With "search value" you mean the one that is part of the ID, not the "search = ..." value, right? Because I believe the latter is the version that does not work.

    But when xmlbrowserPlayControl is not used by iPeng (which is the case for short press or when nothing plays) then the query sent to XMLBrowse makes it rebuild by himself the crumbs so the context menu is then valid
    iPeng shouldn't modify that paramater but handle it back as it is supplied.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  3. #13
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    3,754
    Quote Originally Posted by pippin View Post
    Hm, could you please post such a long log (the full one as above) of a query that does _not_ work.?

    iPeng shouldn't modify that paramater but handle it back as it is supplied.
    Here is a long log. In fact, LMS returns a menu like that
    Code:
     data => {
                base      => {
                               actions => {
                                     add => {
                                           cmd => ["youtube", "playlist", "add"],
                                           itemsParams => "params",
                                           params => { menu => "youtube" },
                                           player => 0,
                                         },
                                     "add-hold" => {
                                           cmd => ["youtube", "playlist", "insert"],
                                           itemsParams => "params",
                                           params => 'fix',
                                           player => 0,
                                         },
                                     go => { cmd => ["youtube", "items"], itemsParams => "params", params => 'fix' },
                                     more => {
                                           cmd => ["youtube", "items"],
                                           itemsParams => "params",
                                           params => 'fix',
                                           player => 0,
                                           window => { isContextMenu => 1 },
                                         },
                                     play => {
                                           cmd => ["youtube", "playlist", "play"],
                                           itemsParams => "params",
                                           nextWindow => "nowPlaying",
                                           params => 'fix',
                                           player => 0,
                                         },
                                     playControl => {
                                           cmd => ["youtube", "items"],
                                           itemsParams => "playControlParams",
                                           params => {
                                                 _index => 0,
                                                 _quantity => 100,
                                                 cachesearch => 1,
                                                 item_id => 2,
                                                 menu => "youtube",
                                                 search => "essai",
                                                 useContextMenu => 1,
                                                 userInterfaceIdiom => "iPeng",
                                               },
                                           player => 0,
                                           window => { isContextMenu => 1 },
                                         },
                count     => 200,
                item_loop => [
                               {
                                 icon   => "plugins/YouTube/html/images/youtube.png",
                                 params => { isContextMenu => 1, item_id => "2_essai.0" },
                                 text   => "All tracks",
                                 type   => "playlist",
                               },
                               {
                                 goAction => "playControl",
                                 icon => "/imageproxy/https%3A%2F%2Fi.ytimg.com%2Fvi%2FyYrD2HwVyGU%2Fdefault.jpg/image.jpg",
                                 params => { isContextMenu => 1, item_id => "2_essai.1" },
                                 playControlParams => { "xmlbrowserPlayControl" => 1 },
                                 presetParams => {
                                       favorites_title => "2017 Bugatti Chiron [ESSAI] : nos impressions au volant de l'hypercar de 1500 ch",
                                       favorites_type => "audio",
                                       favorites_url => "youtube://www.youtube.com/v/yYrD2HwVyGU",
                                       icon => "/imageproxy/https%3A%2F%2Fi.ytimg.com%2Fvi%2FyYrD2HwVyGU%2Fdefault.jpg/image.jpg",
                                     },
                                 text => "2017 Bugatti Chiron [ESSAI] : nos impressions au volant de l'hypercar de 1500 ch",
                                 type => "audio",
    which have the "xmlbrowserPlaControl" parameters as well a a correct item_id in "params" in the items loop but what iPeng seems to do is taking the playControl parameters from the "action' and add the PlayControlParams from the item, which contains the "xmlBrowserPlayControl" and then we're lost
    Code:
      {
        channel => "/slim/request",
        data => {
              request  => [
                            "bb:bb:6d:3a:11:57",
                            [
                              "youtube",
                              "items",
                              0,
                              100,
                              "search:essai",
                              "_index:0",
                              "cachesearch:1",
                              "_quantity:100",
                              "menu:youtube",
                              "useContextMenu:1",
                              "userInterfaceIdiom:iPeng",
                              "xmlbrowserPlayControl:10",
                              "item_id:2",
                            ],
                          ],
              response => "/e4e4b0d2/slim/request",
            },
        id => 228,
      },
    Attached Files Attached Files
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  4. #14
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,376
    The snippet you are quoting is incomplete (it has „fix“ items which are items that were not completed at the time of logging. You will find the complete definition in the unformatted lump below the formatted stuff).

    I’ll have a look when I’m done setting up my new computer, aka tomorrow or so.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  5. #15
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    3,754
    Quote Originally Posted by pippin View Post
    The snippet you are quoting is incomplete (it has „fix“ items which are items that were not completed at the time of logging. You will find the complete definition in the unformatted lump below the formatted stuff).

    I’ll have a look when I’m done setting up my new computer, aka tomorrow or so.
    I did an extract to avoid a too long message - the attached file should be complete (at least the JSON payloads, except when there are 100 items in wich case I just kept a few)
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  6. #16
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,376
    Ok. I dug into it while waiting for the 20 hours or so to migrate my computer....

    I think what happens here is that iPeng uses the „playControl“ parameters because the „goAction = playControl“, so the Server tells it to do that.

    Now ... since all of this is undocumented stuff I’m not 100% sure whether iPeng should instead use BOTH parameter sets but since it works with pretty much all other menus and setting default actions is quite common I somehow doubt that, it should break a lot more things.

    Not sure, again, but I believe the „playControl“ action is what is being used if „defeat destructive TTP“ is configured because on a Squeezebox that brings up a similar menu as in iPeng but with a server roundtrip.

    Do you have a chance to try this on a Controller or SqueezePlay Squeezebox (or maybe just JiveLight or SqueezePlay)?
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  7. #17
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    3,754
    Quote Originally Posted by pippin View Post
    Ok. I dug into it while waiting for the 20 hours or so to migrate my computer....

    I think what happens here is that iPeng uses the „playControl“ parameters because the „goAction = playControl“, so the Server tells it to do that.

    Now ... since all of this is undocumented stuff I’m not 100% sure whether iPeng should instead use BOTH parameter sets but since it works with pretty much all other menus and setting default actions is quite common I somehow doubt that, it should break a lot more things.

    Not sure, again, but I believe the „playControl“ action is what is being used if „defeat destructive TTP“ is configured because on a Squeezebox that brings up a similar menu as in iPeng but with a server roundtrip.

    Do you have a chance to try this on a Controller or SqueezePlay Squeezebox (or maybe just JiveLight or SqueezePlay)?
    This is definitely linked to defeat destructive TTP. When disabled, the problem does not happen and you can see why in XMLBrows.pm, around line 1250
    Code:
                                                      elsif ( $touchToPlay ) {
    							if (!$defeatDestructiveTouchToPlay) {
    								$itemParams->{'touchToPlay'} = "$id"; # stringify, make sure it's a string
    								$itemParams->{'touchToPlaySingle'} = 1 if !$item->{'playall'};
    								
    								# not currently supported by 7.5 client
    								$hash{'goAction'} = 'play'; 
    								
    								$hash{'style'} = 'itemplay';
    							} else {
    								# not currently supported by 7.5 client
    								$hash{'goAction'} = 'playControl'; 
    								$hash{'playControlParams'} = {xmlbrowserPlayControl=>"$itemIndex"};
    							}
    						}
    						else {
    							$allTouchToPlay = 0;
    						}
    the $itemIndex is purely a number and so it does not take into account the crumbs/search that lead there

    But this code is so hairy that I don't know what should be done.

    [edit]: I would tend to believe that this could be corrected by this, knowing that playControlParams only appears here in whole LMS code
    Code:
                                                            } else {
    								# not currently supported by 7.5 client
    								$hash{'goAction'} = 'playControl'; 
    
    								$hash{'playControlParams'} = {xmlbrowserPlayControl=>"$id"};
    							}
    [edit3] WRONG ==> [edit2]: proven to work, but no idea if this is a bug in LMS or doing that has side effcts - need a higher opinion
    I'll take that back, this is not correct - xmlbrowserPlayControl must be a numeric value. Well, the problem is around here but at that point I don't know the solution
    Last edited by philippe_44; 2018-01-08 at 19:37.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  8. #18
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    3,754
    I can also confirm that the duet remote suffers from the same issue
    Last edited by philippe_44; 2018-01-08 at 19:37.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  9. #19
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    3,754
    Quote Originally Posted by mherger View Post
    This reminds me of the issue I'm seeing with the Random Albums: sometimes the menu returned by LMS wouldn't be the same as before. In the case of Random Albums this because it is supposed to return a random list, of course. But in your case: make sure the menu you return is "always" the same. Obviously a search can change. But do you eg. cache search results? You'd only have to cache it long enough for the menu to be triggered. Assuming people don't stay on the search result list all the time, caching results for a minute or two might make sense.
    I'm not sure where caching should happen and what to cache. When "defeatDTTP" is set, LMS inserts in its reponse an "xmlbrowserPlayControl" as here XMLBrowser#1250
    Code:
                                            	elsif ( $touchToPlay ) {
    							if (!$defeatDestructiveTouchToPlay) {
    								$itemParams->{'touchToPlay'} = "$id"; # stringify, make sure it's a string
    								$itemParams->{'touchToPlaySingle'} = 1 if !$item->{'playall'};
    								
    								# not currently supported by 7.5 client
    								$hash{'goAction'} = 'play'; 
    								
    								$hash{'style'} = 'itemplay';
    							} else {
    								# not currently supported by 7.5 client
    								$hash{'goAction'} = 'playControl'; 
    								$hash{'playControlParams'} = {xmlbrowserPlayControl=>"$id"};
    							}
    						}
    						else {
    							$allTouchToPlay = 0;
    						}
    So xmlbrowsePlayControl is a numeric value of the leaf in the menu. Then when the client uses this response to do the play, the following code is executed (XMLBrowse#800)
    Code:
    		if ($menuMode && defined $xmlbrowserPlayControl) {
    
    			$totalCount = 0;
    			my $i = $xmlbrowserPlayControl - $subFeed->{'offset'};
    			if ($i < 0 || $i > $count) {
    				$log->error("Requested item index $xmlbrowserPlayControl out of range: ",
    					$subFeed->{'offset'}, '..', $subFeed->{'offset'} + $count -1);
    			} else {
    				my $item = $items->[$i];
    				for my $eachmenu (@{ 
    					_playlistControlContextMenu({
    						request     => $request,
    						query       => $query,
    						item        => $item,
    						subFeed     => $subFeed,
    						noFavorites => 1,
    						subItemId   => $xmlbrowserPlayControl,
    						playalbum   => 1,	# Allways add play-all item
    					})
    				})
    				{
    					$request->setResultLoopHash('item_loop', $totalCount, $eachmenu);
    					$totalCount++;
    				}
    				
    			}
    			$request->addResult('offset', 0);
    		}
    Because subItemId is set, the playlistControlContextMenu builds an item_id in the form of X.Y, not X_[search].Y

    So when the next request comes to play item_id X.Y, then the [search] context is lost. As far ar the YT plugin is concerned, all I receive are request to search (they are all cached of course), but here I receive a request with an empty [search] question, I don't have any idea of another context I could use.

    You can see this in that exchange
    Code:
    [18-01-08 09:04:44.0263] Slim::Control::XMLBrowser::cliQuery (46) cliQuery(youtube)
    [18-01-08 09:04:44.0271] Slim::Control::XMLBrowser::cliQuery (47) {
      _index => 0,
      _quantity => 100,
      cachesearch => 1,
      item_id => 2,
      menu => "youtube",
      search => "essai",
      useContextMenu => 1,
      userInterfaceIdiom => "iPeng",
      "xmlbrowserPlayControl" => 10,
    }
    [18-01-08 09:04:44.0275] Slim::Control::XMLBrowser::cliQuery (192) Fetching OPML from coderef Plugins::YouTube::Plugin::toplevel
    ...
    [18-01-08 09:04:44.0398] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to e4e4b0d2:
    [
      {
        channel => "/e4e4b0d2/slim/request",
        data => {
              count     => 3,
              item_loop => [
                             {
                               actions => {
                                            go => {
                                                    cmd => ["youtube", "playlist", "add"],
                                                    nextWindow => "parentNoRefresh",
                                                    params => { item_id => "2.10", menu => 1 },
                                                    player => 0,
                                                  },
                                          },
                               style   => "item_add",
                               text    => "Ajouter \xE0 la fin",
                             },
                             {
                               actions => {
                                            go => {
                                                    cmd => ["youtube", "playlist", "insert"],
                                                    nextWindow => "parentNoRefresh",
                                                    params => { item_id => "2.10", menu => 1 },
                                                    player => 0,
                                                  },
                                          },
                               style   => "item_insert",
                               text    => "Lire \xE0 la suite",
                             },
                             {
                               actions => {
                                            go => {
                                                    cmd => ["youtube", "playlist", "play"],
                                                    nextWindow => "nowPlaying",
                                                    params => { item_id => "2.10", menu => 1 },
                                                    player => 0,
                                                  },
                                          },
                               style   => "item_play",
                               text    => "Lecture",
                             },
                           ],
              offset    => 0,
              window    => { windowStyle => "text_list" },
            },
        ext => { priority => "" },
        id => 228,
      },
    ]
    [18-01-08 09:04:44.9045] Slim::Web::Cometd::sendHTTPResponse (731) Sending Cometd chunk (192.168.2.157:50425):
    [{"data":{"type":"showbriefly","display":{"text":["Connecting...",""],"duration":"500","type":"song"}},"id":"67","channel":"/e4e4b0d2/slim/displaystatus/bb:bb:6d:3a:11:57","ext":{"priority":""}}]
    [18-01-08 09:04:45.0035] Slim::Web::Cometd::requestCallback (926) requestCallback got results for /e4e4b0d2/slim/displaystatus/bb:bb:6d:3a:11:57 / 67
    [18-01-08 09:04:45.1687] Slim::Web::Cometd::handler (150) Cometd request (192.168.2.157:50432): [
      {
        channel => "/slim/request",
        data => {
              request  => [
                            "bb:bb:6d:3a:11:57",
                            [
                              "youtube",
                              "playlist",
                              "play",
                              "userInterfaceIdiom:iPeng",
                              "useContextMenu:1",
                              "item_id:2.10",
                              "menu:1",
                            ],
                          ],
              response => "/e4e4b0d2/slim/request",
            },
        id => 229,
      },
    ]
    It seems to me that when receiving a query with xmlBrowserPlayControl set, LMS should do something different in what it answers the requester, i.e. not build a context menu with item_id set to X.Y or "remember" that X.Y refers to something X_[search] that has already been searched and return it from its own fetched/cached information - anyway, this one is really complicated for and the XMLBrowse code if a mountain of permutation and combination
    Last edited by philippe_44; 2018-01-08 at 20:07.
    LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5

  10. #20
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,982

    iPeng and YT

    > I'm not sure where caching should happen and what to cache. When

    LMS (XMLBrowser) does not simply access the menu node as given in some
    ID. It often needs to drill down from the top of the navigation tree to
    the leave you want. You'll have to make sure that the path to that place
    does not change between calls. Eg. don't re-run the search, but make
    sure you're using the same results as when you reached the search
    results list before. That's where you'd need to apply some caching.

    --

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •