Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    2,824

    LMS caching menu item image

    Does LMS caches the menu items images when a plugin creates a menu? (the "image" property that I set in the callback to display a menu which in my case is a link to a web image)
    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

  2. #2
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    13,866
    It caches the scaled thumbnails requested by the UIs
    ---
    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. #3
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    2,824
    Quote Originally Posted by pippin View Post
    It caches the scaled thumbnails requested by the UIs
    Thanks, that makes sense but it does not seem to work for me. My plugin builds the menu the following way
    Code:
    sub initPlugin {
    	my $class = shift;
    
    	$class->SUPER::initPlugin(
    		feed   => \&toplevel,
    		tag    => 'LCI',
    		menu   => 'radios',
    		is_app => 1,
    		weight => 10,
    	);
    
    	if ( main::WEBUI ) {
    		require Plugins::LCI::Settings;
    		Plugins::LCI::Settings->new;
    	}
    	
    	for my $recent (reverse @{$prefs->get('recent')}) {
    		$recentlyPlayed{ $recent->{'url'} } = $recent;
    	}
    	
    	Slim::Control::Request::addDispatch(['LCI', 'info'], 
    		[1, 1, 1, \&cliInfoQuery]);
    		
    	
    }
    Where function "toplevel" reads a set of channels from a station and build the list

    Code:
    sub toplevel {
    	my ($client, $callback, $args) = @_;
    	
    	my $items = [ { name => cstring($client, 'PLUGIN_LCI_RECENTLYPLAYED'), image => getIcon(), url  => \&recentHandler, } ];
    		
    	addChannels($client, $callback, $args, $items);
    }
    
    sub addChannels {
    	my ($client, $cb, $args, $items) = @_;
    	my $page = "/pages/emissions/?type=other&filter=emissions-lci";
    	
    	Plugins::LCI::API::search( $page, sub {
    	
    		my $result = shift;
    		my $data = $result->{page}->{data};
    
                    ... some more code ...		
    
    		for my $entry (@{$data->{data}->{elementList}}) {
    							
    			push @$items, {
    				name  => $entry->{text},
    				type  => 'playlist',
    				url   => \&searchEpisodes,
    				image => $entry->{pictures}->{elementList}[0]->{dpi}[0]->{url},
    				passthrough 	=> [ { link => $entry->{link} } ],
    			};
    			
    		}
    		
    		$cb->( $items );
    	
    	} );	
    }
    The link set in image => is the same at every call of the top menu build (I'm sure it's the case because the result of the search function is cached and I hit the cache), but what I observe is that displaying the menu takes forever because LMS seems to grab each image from the URL (if I don't set the image, building the menu is immediate)

    I get there is something I don't understand in what is really cached
    Last edited by philippe_44; 2017-03-19 at 19:29.
    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

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,475

    LMS caching menu item image

    > The link set in image => I know is the same at every call of the top
    > menu build (I'm even more sure it's the case because the result of the
    > search function is cached and I hit the cache), but what I observe is
    > that displaying the menu takes forever because LMS seems to grab each
    > image from the URL (if I don't set the image, building the menu is
    > immediate)


    So... the problem isn't that you wouldn't ge the right artwork, but that
    loading it is slow? What's an icon's URL? What UI? Did you check what
    LMS is doing with --debug artwork,artwork.imageproxy?

    --

    Michael

  5. #5
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    2,824
    Quote Originally Posted by mherger View Post
    > The link set in image => I know is the same at every call of the top
    > menu build (I'm even more sure it's the case because the result of the
    > search function is cached and I hit the cache), but what I observe is
    > that displaying the menu takes forever because LMS seems to grab each
    > image from the URL (if I don't set the image, building the menu is
    > immediate)


    So... the problem isn't that you wouldn't ge the right artwork, but that
    loading it is slow? What's an icon's URL? What UI? Did you check what
    LMS is doing with --debug artwork,artwork.imageproxy?

    --

    Michael
    Yes, I have the artwork, but it's very slow are reloading every time. Typical URL would be: http://photos.lci.fr/images/767/1316...6e5c-0@1x.jpeg. It(s the default UI. I've not checked at debug log of LMS, sorry, I will
    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

  6. #6
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,475

    LMS caching menu item image

    > Yes, I have the artwork, but it's very slow are reloading every time.
    > Typical URL would be:
    > http://photos.lci.fr/images/767/1316... 1x (DOT) jpeg.
    > It(s the default UI. I've not checked at debug log of LMS, sorry, I will


    Is this the URL showing up in eg. the web UI? Then LMS isn't involved in
    loading/displaying it and doesn't re-size it either. That seems wrong to me.

    Are you seeing this behaviour with all LMS versions?
    --

    Michael

  7. #7
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    2,824
    Quote Originally Posted by mherger View Post
    > Yes, I have the artwork, but it's very slow are reloading every time.
    > Typical URL would be:
    > http://photos.lci.fr/images/767/1316... 1x (DOT) jpeg.
    > It(s the default UI. I've not checked at debug log of LMS, sorry, I will


    Is this the URL showing up in eg. the web UI? Then LMS isn't involved in
    loading/displaying it and doesn't re-size it either. That seems wrong to me.

    Are you seeing this behaviour with all LMS versions?
    --

    Michael
    I've set the debug levels for artwork. I see a first time that LMS makes the HTTP queries to get the images but there is no more logs when I re-enter the plugin page again, so I assume it uses the cache upon further requests, but it's still awfully slow. Maybe it's the resizing itself that takes a lot of time? Is the resized image cached or the original? I've only tested on 7.9.x so far as I recently moved my mai system to that release.

    I'm not sure I'm following your comment wrt the URL I gave in my previous post. This url is something I gather in the plugin through some web services and that I then set as the icon for the next level display menu items in LMS, as I do in my other plugins (I've added the code in previous post)
    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

Posting Permissions

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