Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with 'artistinfo' CLI command #1298

Closed
maniac103 opened this issue Jan 15, 2025 · 12 comments · Fixed by #1300
Closed

Issues with 'artistinfo' CLI command #1298

maniac103 opened this issue Jan 15, 2025 · 12 comments · Fixed by #1300

Comments

@maniac103
Copy link
Contributor

maniac103 commented Jan 15, 2025

I am developing (yet) another Android client for LMS based on Slimbrowse/Jive protocol/cometd and am facing a caching issue with the artistinfo CLI command, invoked via My music -> Album artists -> (menu action) -> Artist info.

In the app, when moving between slimbrowse pages, I first fetch the first item of the target page to see whether it's a slider or text box, then switch to actual paging in case it's a normal list. This apparently creates a caching issue with artistinfo.

The command flow basically looks like this when opening the context menu and going through Browse -> My music -> Albums:

# Fetch context menu
01-15 12:34:26.480  9037  9074 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","2147483647","useContextMenu:1","menu:1","artist_id:30029","xmlBrowseInterimCM:1"]],"response":"/cfc067aa/slim/request/6"},"id":21}]
# 'Preview' for artist info page
01-15 12:34:29.346  9037  9074 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","1","useContextMenu:1","item_id:4","menu:artistinfo"]],"response":"/cfc067aa/slim/request/7"},"id":22}]
# Artist info page
01-15 12:34:29.409  9037  9077 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","300","useContextMenu:1","item_id:4","menu:artistinfo"]],"response":"/cfc067aa/slim/request/8"},"id":23}]
# 'Preview' for Browse page
01-15 12:34:32.428  9037  9077 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","1","useContextMenu:1","menu:artistinfo","item_id:4.3"]],"response":"/cfc067aa/slim/request/9"},"id":24}]
# Browse page
01-15 12:34:32.488  9037  9077 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","300","useContextMenu:1","menu:artistinfo","item_id:4.3"]],"response":"/cfc067aa/slim/request/10"},"id":25}]
# 'Preview' for My music page
01-15 12:34:33.645  9037  9077 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","1","useContextMenu:1","item_id:4.3.0","menu:artistinfo"]],"response":"/cfc067aa/slim/request/11"},"id":26}]
# My Music page
01-15 12:34:33.706  9037  9077 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","300","useContextMenu:1","item_id:4.3.0","menu:artistinfo"]],"response":"/cfc067aa/slim/request/12"},"id":27}]
# 'Preview' for albums page
01-15 12:34:36.546  9037  9073 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","1","useContextMenu:1","menu:artistinfo","item_id:4.3.0.1"]],"response":"/cfc067aa/slim/request/13"},"id":28}]
# Albums page
01-15 12:34:36.638  9037  9076 D CometdClient: [{"channel":"/slim/request","clientId":"cfc067aa","data":{"request":["b8:ae:ed:7c:ce:d4",["artistinfo","items","0","300","useContextMenu:1","menu:artistinfo","item_id:4.3.0.1"]],"response":"/cfc067aa/slim/request/14"},"id":29}]

The problem here is that the last call gives me incomplete results, which looks something like this (partial response):

   ...snip...
    "item_loop": [
        {
            "commonParams": {
                "album_id": 7629,
                "performance": ""
            },
            "type": "playlist",
            "text": "Das Phantom der Oper: Die Höhepunkte der Hamburger Aufführung\nAndrew Lloyd Webber",
            "presetParams": {
                "favorites_title": "Das Phantom der Oper: Die Höhepunkte der Hamburger Aufführung",
                "favorites_url": "db:album.title=Das%20Phantom%20der%20Oper%3A%20Die%20H%C3%B6hepunkte%20der%20Hamburger%20Auff%C3%BChrung&contributor.name=Andrew%20Lloyd%20Webber",
                "favorites_type": "playlist",
                "icon": "music/f8f8a285/cover"
            },
            "icon-id": "f8f8a285",
            "icon": "music/f8f8a285/cover"
        },
        {
            "text": "Alle Titel",
            "actions": {
                "go": {
                    "cmd": [
                        "browselibrary",
                        "items"
                    ],
                    "params": {
                        "menu": 1,
                        "menuStyle": "menuStyle:allSongs",
                        "sort": "albumtrack",
                        "search": "sql=(albums.titlesearch LIKE 'A HA%' OR albums.titlesearch LIKE '% A HA%')",
                        "mode": "tracks"
                    },
                    "player": 0
                },
                "add": {
                    "player": 0,
                    "params": {
                        "menu": 1,
                        "menuStyle": "menuStyle:allSongs",
                        "sort": "albumtrack",
                        "search": "sql=(albums.titlesearch LIKE 'A HA%' OR albums.titlesearch LIKE '% A HA%')",
                        "mode": "tracks"
                    },
                    "cmd": [
                        "browselibrary",
                        "playlist",
                        "add"
                    ]
                },
                "more": {
                    "cmd": [
                        "browselibrary",
                        "items"
                    ],
                    "params": {
                        "menu": 1,
                        "item_id": 289,
                        "mode": "albums",
                        "search": "a-ha"
                    },
                    "player": 0,
                    "window": {
                        "isContextMenu": 1
                    }
                },
                "play": {
                    "cmd": [
                        "browselibrary",
                        "playlist",
                        "play"
                    ],
                    "params": {
                        "menu": 1,
                        "menuStyle": "menuStyle:allSongs",
                        "sort": "albumtrack",
                        "search": "sql=(albums.titlesearch LIKE 'A HA%' OR albums.titlesearch LIKE '% A HA%')",
                        "mode": "tracks"
                    },
                    "player": 0,
                    "nextWindow": "nowPlaying"
                },
                "add-hold": {
                    "cmd": [
                        "browselibrary",
                        "playlist",
                        "insert"
                    ],
                    "params": {
                        "menu": 1,
                        "menuStyle": "menuStyle:allSongs",
                        "sort": "albumtrack",
                        "search": "sql=(albums.titlesearch LIKE 'A HA%' OR albums.titlesearch LIKE '% A HA%')",
                        "mode": "tracks"
                    },
                    "player": 0
                }
            },
            "icon-id": "html/images/albums.png",
            "type": "playlist"
        },
        {
            "text": "",
            "actions": {
                "go": {
                    "cmd": [
                        "artistinfo",
                        "items"
                    ],
                    "params": {
                        "item_id": "4.3.0.1.2"
                    }
                }
            },
            "commonParams": {
                "album_id": null,
                "performance": null
            },
            "addAction": "go"
        },
        {
            "addAction": "go",
            "commonParams": {
                "album_id": null,
                "performance": null
            },
            "actions": {
                "go": {
                    "cmd": [
                        "artistinfo",
                        "items"
                    ],
                    "params": {
                        "item_id": "4.3.0.1.3"
                    }
                }
            },
            "text": ""
        },
    ...snip...
    ],
    "count": 290,
   ...snip...

One item is 'valid' (-> #1297), then there's 'All albums', then 288 invalid empty items follow, so the issue is two fold:

  • I requested 300 items, but only got 1 valid one, likely due to caching
  • The response contains invalid (empty/dummy) items

The first problem can be worked around by not doing this 'preview' request (or do it sufficiently large, which is what I am doing, but I've seen broken paths (that I can't remember right now :-( ) even with that workaround in place. In any case, the server shouldn't send those invalid entries (which I've seen also with Squeeze Ctrl), though.

Another broken case (maybe related, maybe not, I can open a separate issue for that if desired): Albums -> context menu for album -> artist info -> browse -> my music -> albums yields 0 results, which should be impossible given the path taken.

@michaelherger
Copy link
Member

I'm a little confused by what you're doing. artistinfo isn't the way to get an album list. I only happens to do so in most cases. If you want an artist's albums, you should use the albums query with the artist_id instead.

Please include LMS logs, look a the SQL your queries generates to understand what might be wrong.

Don't get me wrong, I'm really trying to be helpful. If you're doing something several other parties have done before, and you have a problem, while the others don't, it's likely something about your approach is different. In such cases it's more helpful to ask for help in the forums (https://forums.lyrion.org), than to jump to conclusions and submit bug reports.

@maniac103
Copy link
Contributor Author

What I'm doing is the same thing as other Android client apps are doing: opening a cometd connection, asking the server for the home menu (menu command) and following slimbrowse from there. I didn't say I fetch albums using artistinfo, but instead I said I'm fetching an album artist list, choose some artist from there, look at its more action (which points to the artistinfo command) to show the context menu and follow slimbrowse from there.

I'm also not alone (as in you're doing something several other parties have done before, and you have a problem, while the others don't), as I can replicate multiple broken cases of the 'open artist context menu -> artist info -> browse ...' case using (at least) Squeeze Ctrl or Squeezer. Maybe I'm the first one to care, but does really that change things?

What is special about my case, and what this report is about, is the double request (first with page size 1, then with page size 300). My observation is that if this kind of access is broken (as described above), that's why I opened the bug report. Are you saying I shall just deal with it and work around the brokenness in the client?

@michaelherger
Copy link
Member

I tried to reproduce the issue. I copied/pasted your command, replaced with IDs to fit mine:

{"id":0,"params":["",["artistinfo", "items", "0", "100", "artist_id:864","useContextMenu:1","menu:1","xmlBrowseInterimCM:1"]],"method":"slim.request"}
{"id":0,"params":["",["artistinfo","items","0","1","useContextMenu:1","item_id:1","menu:artistinfo"]],"method":"slim.request"}
{"id":0,"params":["",["artistinfo","items","0","10","useContextMenu:1","item_id:1","menu:artistinfo"]],"method":"slim.request"}

The first would return the menu items for the artist ("Add to Favs", "On TIDAL"). The second would return the first element of the artist's TIDAL entry. The third would return that artist entry, plus other items from that menu like artist playlists, albums, songs. Nothing unexpected. And only five entries, not 10. No invalid entries.

Could you provide a shell or perl or python script or something where I'd only have to replace the artist ID and the server IP to test the same series of queries?

@maniac103
Copy link
Contributor Author

Albums -> context menu for album -> artist info -> browse -> my music -> albums yields 0 results, which should be impossible given the path taken.

BTW: This happens as soon as one disables full text search plugin. It looks like the server side (all of the above navigation is generated server side, and should be reproducible on any Jive device - it certain does repro in SqueezePlay) has the same expectation as I had in #1297 ... so that's clearly broken.

@maniac103
Copy link
Contributor Author

Could you provide a shell or perl or python script or something where I'd only have to replace the artist ID and the server IP to test the same series of queries?

I can try ... can you give me a starting point for that? IOW, what did you use? I think it needs to be some cometd based client to keep the same connection to trigger this case ... or is keeping the connection ID also possible with separate HTTP connections?

@michaelherger
Copy link
Member

Albums -> context menu for album -> artist info -> browse -> my music -> albums

I can't follow this path: once in the artist I don't have a "Browse" menu item. I'd immediately have their albums, plus links to music services. Can you do a screencast or something from a player UI (squeezeplay)?

I used Postman to copy/paste your commands starting with the first one (and artist ID adjusted to something I have). Cometd or JSON/RPC hopefully won't make any difference. I obviously tested the latter. See https://lyrion.org/reference/cli/using-the-cli/#jsonrpcjs for how to use JSON/RPC.

@maniac103
Copy link
Contributor Author

I can't follow this path: once in the artist I don't have a "Browse" menu item. I'd immediately have their albums, plus links to music services. Can you do a screencast or something from a player UI (squeezeplay)?

Sure:
Bildschirmaufnahme_20250115_152541.webm

@michaelherger
Copy link
Member

Oh, I think that's a menu of the Music and Artist Information plugin. Are you using it?

@maniac103
Copy link
Contributor Author

Cometd or JSON/RPC hopefully won't make any difference.

I'm not sure. As mentioned, this line caches the XML feed by connection (ID), as far as I can tell with the intention of reusing it. Calling jsonrpc.js twice yields different connection IDs, as I just verified using a debug output line:

[25-01-15 15:31:50.1404] Slim::Menu::ArtistInfo::cliQuery (325) caching feed for Slim::Web::HTTP::ClientConn=GLOB(0x56503abda1d8)
[25-01-15 15:31:53.7933] Slim::Menu::ArtistInfo::cliQuery (325) caching feed for Slim::Web::HTTP::ClientConn=GLOB(0x56503801c1b0)

In my understanding this caching is the actual issue, because it doesn't take the paging parameters into account, so the offset=0/size=1 case is cached and later reused for the offset=0/size=300 case. I tried to fix this using a trivial approach:

--- Menu/ArtistInfo.pm  2025-01-15 15:43:51.448795198 +0100
+++ Menu/ArtistInfo.pm.new  2025-01-15 15:43:20.688538241 +0100
@@ -267,7 +267,7 @@
 
 # keep a very small cache of feeds to allow browsing into a artist info feed
 # we will be called again without $url or $artistId when browsing into the feed
-tie my %cachedFeed, 'Tie::Cache::LRU', 2;
+tie my %cachedFeed, 'Tie::Cache::LRU', 20;
 
 sub cliQuery {
        main::DEBUGLOG && $log->is_debug && $log->debug('cliQuery');
@@ -297,6 +297,7 @@
        my $menuContext    = $request->getParam('context') || 'normal';
        my $playlist_index = defined( $request->getParam('playlist_index') ) ?  $request->getParam('playlist_index') : undef;
        my $connectionId   = $request->connectionID || '';
+       my $cacheKey = "$connectionId:$index:$quantity";
 
        my $tags = {
                menuMode      => $menuMode,
@@ -314,15 +315,16 @@
                my $artist = Slim::Schema->find( Contributor => $artistId );
                $feed     = Slim::Menu::ArtistInfo->menu( $client, $artist->url, $artist, $tags );
        }
-       elsif ( $cachedFeed{ $connectionId } ) {
-               $feed = $cachedFeed{ $connectionId };
+       elsif ( $cachedFeed{ $cacheKey } ) {
+               $feed = $cachedFeed{ $cacheKey };
        }
        else {
                $request->setStatusBadParams();
                return;
        }
 
-       $cachedFeed{ $connectionId } = $feed if $feed;
+       $log->error("caching feed for $cacheKey");
+       $cachedFeed{ $cacheKey } = $feed if $feed;
 
        Slim::Control::XMLBrowser::cliQuery( 'artistinfo', $feed, $request );
 }

... but I got 'Bad params' response with that, so there's probably more to it that I don't follow.

@maniac103
Copy link
Contributor Author

maniac103 commented Jan 15, 2025

Oh, I think that's a menu of the Music and Artist Information plugin. Are you using it?

Yes, I do (but wasn't aware :-/ ) ... so please pardon me mixing it up with the sufficiently similar ArtistInfo.pm :-(
(And BTW, thanks a lot for it, the artist images alone make browsing the library much nicer!)

OK, so now (if I understand correctly) this menu basically is a global search with search terms pre-filled. Still, some caching seems to come into play here, since while I do two requests, only one DB query seems to happen:

[25-01-15 16:04:23.0127] Slim::Web::Cometd::handler (152) Cometd request (192.168.100.203:60892): [
  {
    channel => "/slim/request",
    clientId => "53d7f6d2",
    data => {
          request  => [
                        "b8:ae:ed:7c:ce:d4",
                        [
                          "artistinfo",
                          "items",
                          0,
                          1,
                          "useContextMenu:1",
                          "menu:artistinfo",
                          "item_id:4.3.0.1",
                        ],
                      ],
          response => "/53d7f6d2/slim/request/115",
        },
    id => 73,
  },
]
[25-01-15 16:04:23.0162] Slim::Plugin::FullTextSearch::Plugin::createHelperTable (294) Fulltext search query (album): INSERT INTO albumsSearch SELECT SUBSTR(fulltext.id, 33) AS id, FULLTEXTWEIGHT(matchinfo(fulltext)) AS fulltextweight FROM fulltext WHERE fulltext MATCH 'type:album alphaville*' 
[25-01-15 16:04:23.0225] Slim::Control::Queries::albumsQuery (738) Albums query: SELECT albums.artwork AS 'albums.artwork', albums.compilation AS 'albums.compilation', albums.contributor AS 'albums.contributor', albums.disc AS 'albums.disc', albums.discc AS 'albums.discc', albums.extid AS 'albums.extid', albums.id AS 'albums.id', albums.title AS 'albums.title', albums.titlesearch AS 'albums.titlesearch', albums.titlesort AS 'albums.titlesort', albums.year AS 'albums.year', contributors.name AS 'contributors.name' FROM albumsSearch, albums JOIN contributors ON contributors.id = albums.contributor WHERE albums.id = albumsSearch.id GROUP BY albums.id ORDER BY albumsSearch.fulltextweight DESC, LENGTH(albums.titlesearch) LIMIT ?,?  / [0, 1]
[25-01-15 16:04:23.0269] Slim::Web::Cometd::handleRequest (918) Request for /53d7f6d2/slim/request/115 / 73 is not async
[25-01-15 16:04:23.0273] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /53d7f6d2/slim/request/115 to 53d7f6d2
[25-01-15 16:04:23.0341] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 53d7f6d2:
[
  {
    channel => "/53d7f6d2/slim/request/115",
    data => {
          # tied Tie::IxHash
          base      => {
                         actions => {
                               add => {
                                     cmd => ["playlistcontrol"],
                                     itemsParams => "commonParams",
                                     params => { cmd => "add", menu => 1 },
                                     player => 0,
                                   },
                               "add-hold" => {
                                     cmd => ["playlistcontrol"],
                                     itemsParams => "commonParams",
                                     params => { cmd => "insert", menu => 1 },
                                     player => 0,
                                   },
                               go => {
                                     cmd => ["browselibrary", "items"],
                                     itemsParams => "commonParams",
                                     params => { menu => 1, mode => "tracks" },
                                     player => 0,
                                   },
                               more => {
                                     cmd => ["albuminfo", "items"],
                                     itemsParams => "commonParams",
                                     params => { menu => 1 },
                                     player => 0,
                                     window => { isContextMenu => 1 },
                                   },
                               play => {
                                     cmd => ["playlistcontrol"],
                                     itemsParams => "commonParams",
                                     nextWindow => "nowPlaying",
                                     params => { cmd => "load", menu => 1 },
                                     player => 0,
                                   },
                               playControl => {
                                     cmd => ["artistinfo", "items"],
                                     itemsParams => "playControlParams",
                                     params => {
                                           # tied Tie::IxHash
                                           _index => 0,
                                           _quantity => 1,
                                           item_id => "4.3.0.1",
                                           menu => "artistinfo",
                                           useContextMenu => 1,
                                         },
                                     player => 0,
                                     window => { isContextMenu => 1 },
                                   },
                               "set-preset-0" => {
                                     cmd => ["jivefavorites", "set_preset", "key:0"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-1" => {
                                     cmd => ["jivefavorites", "set_preset", "key:1"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-2" => {
                                     cmd => ["jivefavorites", "set_preset", "key:2"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-3" => {
                                     cmd => ["jivefavorites", "set_preset", "key:3"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-4" => {
                                     cmd => ["jivefavorites", "set_preset", "key:4"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-5" => {
                                     cmd => ["jivefavorites", "set_preset", "key:5"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-6" => {
                                     cmd => ["jivefavorites", "set_preset", "key:6"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-7" => {
                                     cmd => ["jivefavorites", "set_preset", "key:7"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-8" => {
                                     cmd => ["jivefavorites", "set_preset", "key:8"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                               "set-preset-9" => {
                                     cmd => ["jivefavorites", "set_preset", "key:9"],
                                     itemsParams => "presetParams",
                                     player => 0,
                                   },
                             },
                       },
          count     => 7,
          item_loop => [
                         {
                           commonParams => { album_id => 6875, performance => "" },
                           icon => "music/59ce03be/cover",
                           "icon-id" => "59ce03be",
                           presetParams => {
                                 favorites_title => "Eternally Yours",
                                 favorites_type => "playlist",
                                 favorites_url => "db:album.title=Eternally%20Yours&contributor.name=Alphaville",
                                 icon => "music/59ce03be/cover",
                               },
                           text => "Eternally Yours (Disk 1 von 2)\nAlphaville",
                           type => "playlist",
                         },
                       ],
          offset    => 0,
          title     => "Alben",
          window    => { windowStyle => "icon_list" },
        },
    ext => { priority => "" },
    id => 73,
  },
]
[25-01-15 16:04:23.0352] Slim::Web::Cometd::sendHTTPResponse (746) Sending Cometd chunk (192.168.100.203:60886):
[{"channel":"/53d7f6d2/slim/request/115","id":"73","ext":{"priority":""},"data":{"offset":0,"title":"Alben","base":{"actions":{"playControl":{"player":"0","itemsParams":"playControlParams","window":{"isContextMenu":"1"},"params":{"_index":"0","_quantity":"1","useContextMenu":"1","menu":"artistinfo","item_id":"4.3.0.1"},"cmd":["artistinfo","items"]},"add-hold":{"player":"0","itemsParams":"commonParams","params":{"menu":"1","cmd":"insert"},"cmd":["playlistcontrol"]},"play":{"cmd":["playlistcontrol"],"player":"0","itemsParams":"commonParams","nextWindow":"nowPlaying","params":{"menu":"1","cmd":"load"}},"set-preset-8":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:8"]},"set-preset-0":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:0"]},"set-preset-2":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:2"]},"go":{"player":"0","params":{"menu":"1","mode":"tracks"},"itemsParams":"commonParams","cmd":["browselibrary","items"]},"set-preset-7":{"cmd":["jivefavorites","set_preset","key:7"],"player":"0","itemsParams":"presetParams"},"set-preset-5":{"cmd":["jivefavorites","set_preset","key:5"],"player":"0","itemsParams":"presetParams"},"set-preset-1":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:1"]},"set-preset-9":{"cmd":["jivefavorites","set_preset","key:9"],"itemsParams":"presetParams","player":"0"},"set-preset-3":{"cmd":["jivefavorites","set_preset","key:3"],"itemsParams":"presetParams","player":"0"},"set-preset-6":{"cmd":["jivefavorites","set_preset","key:6"],"player":"0","itemsParams":"presetParams"},"add":{"player":"0","itemsParams":"commonParams","params":{"cmd":"add","menu":"1"},"cmd":["playlistcontrol"]},"more":{"cmd":["albuminfo","items"],"player":"0","window":{"isContextMenu":"1"},"itemsParams":"commonParams","params":{"menu":"1"}},"set-preset-4":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:4"]}}},"item_loop":[{"presetParams":{"icon":"music/59ce03be/cover","favorites_type":"playlist","favorites_title":"Eternally Yours","favorites_url":"db:album.title=Eternally%20Yours&contributor.name=Alphaville"},"icon":"music/59ce03be/cover","commonParams":{"album_id":"6875","performance":""},"type":"playlist","text":"Eternally Yours (Disk 1 von 2)\nAlphaville","icon-id":"59ce03be"}],"count":7,"window":{"windowStyle":"icon_list"}}}]
[25-01-15 16:04:23.0360] Slim::Web::Cometd::sendHTTPResponse (740) Sending Cometd response (192.168.100.203:60892):
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Length: 79
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.0257818698883057

[{"channel":"/slim/request","id":"73","clientId":"53d7f6d2","successful":true}]
[25-01-15 16:04:23.1145] Slim::Web::Cometd::handler (152) Cometd request (192.168.100.203:60892): [
  {
    channel => "/slim/request",
    clientId => "53d7f6d2",
    data => {
          request  => [
                        "b8:ae:ed:7c:ce:d4",
                        [
                          "artistinfo",
                          "items",
                          0,
                          300,
                          "useContextMenu:1",
                          "menu:artistinfo",
                          "item_id:4.3.0.1",
                        ],
                      ],
          response => "/53d7f6d2/slim/request/116",
        },
    id => 74,
  },
]
[25-01-15 16:04:23.1171] Slim::Web::Cometd::handleRequest (918) Request for /53d7f6d2/slim/request/116 / 74 is not async
[25-01-15 16:04:23.1175] Slim::Web::Cometd::Manager::deliver_events (241) Sending event on channel /53d7f6d2/slim/request/116 to 53d7f6d2
[25-01-15 16:04:23.1296] Slim::Web::Cometd::Manager::deliver_events (255) Delivering events to 53d7f6d2:
do {
  my $a = [
    {
      channel => "/53d7f6d2/slim/request/116",
      data => {
            # tied Tie::IxHash
            base      => {
                           actions => {
                                 add => {
                                       cmd => ["playlistcontrol"],
                                       itemsParams => "commonParams",
                                       params => { cmd => "add", menu => 1 },
                                       player => 0,
                                     },
                                 "add-hold" => {
                                       cmd => ["playlistcontrol"],
                                       itemsParams => "commonParams",
                                       params => { cmd => "insert", menu => 1 },
                                       player => 0,
                                     },
                                 go => {
                                       cmd => ["browselibrary", "items"],
                                       itemsParams => "commonParams",
                                       params => { menu => 1, mode => "tracks" },
                                       player => 0,
                                     },
                                 more => {
                                       cmd => ["albuminfo", "items"],
                                       itemsParams => "commonParams",
                                       params => { menu => 1 },
                                       player => 0,
                                       window => { isContextMenu => 1 },
                                     },
                                 play => {
                                       cmd => ["playlistcontrol"],
                                       itemsParams => "commonParams",
                                       nextWindow => "nowPlaying",
                                       params => { cmd => "load", menu => 1 },
                                       player => 0,
                                     },
                                 playControl => {
                                       cmd => ["artistinfo", "items"],
                                       itemsParams => "playControlParams",
                                       params => {
                                             # tied Tie::IxHash
                                             _index => 0,
                                             _quantity => 300,
                                             item_id => "4.3.0.1",
                                             menu => "artistinfo",
                                             useContextMenu => 1,
                                           },
                                       player => 0,
                                       window => { isContextMenu => 1 },
                                     },
                                 "set-preset-0" => {
                                       cmd => ["jivefavorites", "set_preset", "key:0"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-1" => {
                                       cmd => ["jivefavorites", "set_preset", "key:1"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-2" => {
                                       cmd => ["jivefavorites", "set_preset", "key:2"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-3" => {
                                       cmd => ["jivefavorites", "set_preset", "key:3"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-4" => {
                                       cmd => ["jivefavorites", "set_preset", "key:4"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-5" => {
                                       cmd => ["jivefavorites", "set_preset", "key:5"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-6" => {
                                       cmd => ["jivefavorites", "set_preset", "key:6"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-7" => {
                                       cmd => ["jivefavorites", "set_preset", "key:7"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-8" => {
                                       cmd => ["jivefavorites", "set_preset", "key:8"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                                 "set-preset-9" => {
                                       cmd => ["jivefavorites", "set_preset", "key:9"],
                                       itemsParams => "presetParams",
                                       player => 0,
                                     },
                               },
                         },
            count     => 7,
            item_loop => [
                           {
                             commonParams => { album_id => 6875, performance => "" },
                             icon => "music/59ce03be/cover",
                             "icon-id" => "59ce03be",
                             presetParams => {
                                   favorites_title => "Eternally Yours",
                                   favorites_type => "playlist",
                                   favorites_url => "db:album.title=Eternally%20Yours&contributor.name=Alphaville",
                                   icon => "music/59ce03be/cover",
                                 },
                             text => "Eternally Yours (Disk 1 von 2)\nAlphaville",
                             type => "playlist",
                           },
                           {
                             actions => {
                                   add => {
                                         cmd => ["browselibrary", "playlist", "add"],
                                         params => {
                                               menu      => 1,
                                               menuStyle => "menuStyle:allSongs",
                                               mode      => "tracks",
                                               search    => "sql=(albums.titlesearch LIKE 'ALPHAVILLE%' OR albums.titlesearch LIKE '% ALPHAVILLE%')",
                                               "sort"    => "albumtrack",
                                             },
                                         player => 0,
                                       },
                                   "add-hold" => {
                                         cmd => ["browselibrary", "playlist", "insert"],
                                         params => 'fix',
                                         player => 0,
                                       },
                                   go => { cmd => ["browselibrary", "items"], params => 'fix', player => 0 },
                                   more => {
                                         cmd => ["browselibrary", "items"],
                                         params => { item_id => 6, menu => 1, mode => "albums", search => "Alphaville" },
                                         player => 0,
                                         window => { isContextMenu => 1 },
                                       },
                                   play => {
                                         cmd => ["browselibrary", "playlist", "play"],
                                         nextWindow => "nowPlaying",
                                         params => 'fix',
                                         player => 0,
                                       },
                                 },
                             "icon-id" => "html/images/albums.png",
                             text => "Alle Titel",
                             type => "playlist",
                           },
                           {
                             actions => {
                                   go => {
                                           cmd => ["artistinfo", "items"],
                                           params => { item_id => "4.3.0.1.2" },
                                         },
                                 },
                             addAction => "go",
                             commonParams => { album_id => undef, performance => undef },
                             text => "",
                           },
                           {
                             actions => {
                                   go => {
                                           cmd => ["artistinfo", "items"],
                                           params => { item_id => "4.3.0.1.3" },
                                         },
                                 },
                             addAction => "go",
                             commonParams => { album_id => undef, performance => undef },
                             text => "",
                           },
                           {
                             actions => {
                                   go => {
                                           cmd => ["artistinfo", "items"],
                                           params => { item_id => "4.3.0.1.4" },
                                         },
                                 },
                             addAction => "go",
                             commonParams => { album_id => undef, performance => undef },
                             text => "",
                           },
                           {
                             actions => {
                                   go => {
                                           cmd => ["artistinfo", "items"],
                                           params => { item_id => "4.3.0.1.5" },
                                         },
                                 },
                             addAction => "go",
                             commonParams => { album_id => undef, performance => undef },
                             text => "",
                           },
                           {
                             actions => {
                                   go => {
                                           cmd => ["artistinfo", "items"],
                                           params => { item_id => "4.3.0.1.6" },
                                         },
                                 },
                             addAction => "go",
                             commonParams => { album_id => undef, performance => undef },
                             text => "",
                           },
                         ],
            offset    => 0,
            title     => "Alben",
            window    => { windowStyle => "icon_list" },
          },
      ext => { priority => "" },
      id => 74,
    },
  ];
  $a->[0]{data}{item_loop}[1]{actions}{"add-hold"}{params} = $a->[0]{data}{item_loop}[1]{actions}{add}{params};
  $a->[0]{data}{item_loop}[1]{actions}{go}{params} = $a->[0]{data}{item_loop}[1]{actions}{add}{params};
  $a->[0]{data}{item_loop}[1]{actions}{play}{params} = $a->[0]{data}{item_loop}[1]{actions}{add}{params};
  $a;
}
[25-01-15 16:04:23.1310] Slim::Web::Cometd::sendHTTPResponse (746) Sending Cometd chunk (192.168.100.203:60886):
[{"ext":{"priority":""},"channel":"/53d7f6d2/slim/request/116","id":"74","data":{"offset":0,"title":"Alben","base":{"actions":{"add":{"cmd":["playlistcontrol"],"player":"0","params":{"cmd":"add","menu":"1"},"itemsParams":"commonParams"},"set-preset-6":{"cmd":["jivefavorites","set_preset","key:6"],"itemsParams":"presetParams","player":"0"},"set-preset-4":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:4"]},"more":{"cmd":["albuminfo","items"],"player":"0","params":{"menu":"1"},"itemsParams":"commonParams","window":{"isContextMenu":"1"}},"play":{"cmd":["playlistcontrol"],"player":"0","itemsParams":"commonParams","params":{"menu":"1","cmd":"load"},"nextWindow":"nowPlaying"},"add-hold":{"player":"0","itemsParams":"commonParams","params":{"menu":"1","cmd":"insert"},"cmd":["playlistcontrol"]},"playControl":{"cmd":["artistinfo","items"],"player":"0","params":{"_index":"0","_quantity":"300","useContextMenu":"1","menu":"artistinfo","item_id":"4.3.0.1"},"window":{"isContextMenu":"1"},"itemsParams":"playControlParams"},"set-preset-9":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:9"]},"set-preset-3":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:3"]},"set-preset-1":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:1"]},"go":{"cmd":["browselibrary","items"],"player":"0","itemsParams":"commonParams","params":{"menu":"1","mode":"tracks"}},"set-preset-7":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:7"]},"set-preset-5":{"cmd":["jivefavorites","set_preset","key:5"],"itemsParams":"presetParams","player":"0"},"set-preset-2":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:2"]},"set-preset-0":{"player":"0","itemsParams":"presetParams","cmd":["jivefavorites","set_preset","key:0"]},"set-preset-8":{"itemsParams":"presetParams","player":"0","cmd":["jivefavorites","set_preset","key:8"]}}},"item_loop":[{"type":"playlist","commonParams":{"performance":"","album_id":"6875"},"presetParams":{"favorites_url":"db:album.title=Eternally%20Yours&contributor.name=Alphaville","favorites_title":"Eternally Yours","favorites_type":"playlist","icon":"music/59ce03be/cover"},"icon":"music/59ce03be/cover","icon-id":"59ce03be","text":"Eternally Yours (Disk 1 von 2)\nAlphaville"},{"text":"Alle Titel","actions":{"go":{"params":{"menuStyle":"menuStyle:allSongs","sort":"albumtrack","search":"sql=(albums.titlesearch LIKE 'ALPHAVILLE%' OR albums.titlesearch LIKE '% ALPHAVILLE%')","menu":"1","mode":"tracks"},"player":"0","cmd":["browselibrary","items"]},"play":{"player":"0","params":{"menuStyle":"menuStyle:allSongs","sort":"albumtrack","search":"sql=(albums.titlesearch LIKE 'ALPHAVILLE%' OR albums.titlesearch LIKE '% ALPHAVILLE%')","menu":"1","mode":"tracks"},"nextWindow":"nowPlaying","cmd":["browselibrary","playlist","play"]},"add":{"params":{"menuStyle":"menuStyle:allSongs","sort":"albumtrack","search":"sql=(albums.titlesearch LIKE 'ALPHAVILLE%' OR albums.titlesearch LIKE '% ALPHAVILLE%')","menu":"1","mode":"tracks"},"player":"0","cmd":["browselibrary","playlist","add"]},"add-hold":{"player":"0","params":{"menuStyle":"menuStyle:allSongs","sort":"albumtrack","search":"sql=(albums.titlesearch LIKE 'ALPHAVILLE%' OR albums.titlesearch LIKE '% ALPHAVILLE%')","menu":"1","mode":"tracks"},"cmd":["browselibrary","playlist","insert"]},"more":{"params":{"menu":"1","mode":"albums","item_id":"6","search":"Alphaville"},"window":{"isContextMenu":"1"},"player":"0","cmd":["browselibrary","items"]}},"icon-id":"html/images/albums.png","type":"playlist"},{"addAction":"go","actions":{"go":{"cmd":["artistinfo","items"],"params":{"item_id":"4.3.0.1.2"}}},"text":"","commonParams":{"album_id":null,"performance":null}},{"commonParams":{"album_id":null,"performance":null},"text":"","actions":{"go":{"params":{"item_id":"4.3.0.1.3"},"cmd":["artistinfo","items"]}},"addAction":"go"},{"commonParams":{"performance":null,"album_id":null},"text":"","actions":{"go":{"cmd":["artistinfo","items"],"params":{"item_id":"4.3.0.1.4"}}},"addAction":"go"},{"text":"","actions":{"go":{"params":{"item_id":"4.3.0.1.5"},"cmd":["artistinfo","items"]}},"addAction":"go","commonParams":{"album_id":null,"performance":null}},{"commonParams":{"album_id":null,"performance":null},"text":"","addAction":"go","actions":{"go":{"params":{"item_id":"4.3.0.1.6"},"cmd":["artistinfo","items"]}}}],"count":7,"window":{"windowStyle":"icon_list"}}}]
[25-01-15 16:04:23.1321] Slim::Web::Cometd::sendHTTPResponse (740) Sending Cometd response (192.168.100.203:60892):
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Length: 79
Content-Type: application/json
Expires: -1
X-Time-To-Serve: 0.0195729732513428

[{"id":"74","channel":"/slim/request","successful":true,"clientId":"53d7f6d2"}]

This log also shows the dummy response items in the second response.

@michaelherger
Copy link
Member

No worries, I think I have the MAI issue fixed (not released - will do so later tonight).

As for the caching issue: great catch! Your suggested solution looks reasonable to me. Would you mind submitting a PR with this change for all those *Info modules where we use this approach? (AlbumInfo, ArtistInfo, FolderInfo, TrackInfo, OnlineLibrary plugin)?

@maniac103
Copy link
Contributor Author

As for the caching issue: great catch! Your suggested solution looks reasonable to me. Would you mind submitting a PR with this change for all those *Info modules where we use this approach? (AlbumInfo, ArtistInfo, FolderInfo, TrackInfo, OnlineLibrary plugin)?

Unfortunately it doesn't work :-/
Caching the feed apparently happens when fetching the context menu (which I already do at full size, since it's not displayed in pages), so $feed always is associated with a large size. There must be some additional caching going on somewhere(TM), probably in XMLBrowser? I'll try to dig further into that if you don't have an idea off-hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants