@michael

Here is another funny use of the plugin:

if MusicArtistInfo plugin is installed I want to add 'Ablum Information'
in QobuzGetTracks().


Code:
--------------------
                if ($IsMusicArtistInfo) {
                        push @$items, {
                                name  => cstring($client, 
'PLUGIN_MUSICARTISTINFO_ALBUMINFO'),
                                items => 
Plugins::MusicArtistInfo::AlbumInfo->getAlbumMenu(undef, { album => { album => 
$album->{title}, artist => $artist, client => $client } })
                        }
                }
--------------------


Also the following code is needed:


Code:
--------------------
    my $IsMusicArtistInfo = 0;
  
  sub postinitPlugin {
  ...
        if ( 
Slim::Utils::PluginManager->isEnabled('Plugins::MusicArtistInfo::Plugin') ) {
                $IsMusicArtistInfo = 1;
        }
  ...
  }
  
--------------------



If you inspect the code above you will see that it is a trick, because
it works only if you add a code line to AlbumInfo.pm.


Code:
--------------------
    sub getAlbumMenu {
        my ($client, $cb, $params, $args) = @_;
        
        if ($params->{album}->{client}) { $client = $params->{album}->{client}; 
delete $params->{album}->{client}; } #Sven 2020-03-31
--------------------


This changes the $client value.
Without this trick I always run into a runtime error in this line:


Code:
--------------------
    type => ($client && $client->controllerUA || '') =~ /squeezeplay/i ? 'link' 
: 'slideshow',
  
  [20-04-05 13:00:20.1358] Slim::Networking::IO::Select::__ANON__ (130) Error: 
Select task failed calling Slim::Networking::Async::HTTP::_http_read_body: 
Can't locate object method "controllerUA" via package 
"Plugins::MusicArtistInfo::AlbumInfo" at 
/SlimServer/Cache/InstalledPlugins/Plugins/MusicArtistInfo/AlbumInfo.pm line 85.
  ; fh=Slim::Networking::Async::Socket::HTTP=GLOB(0x55a420ccda70)
  
  
--------------------


This problem also exists in ArtistInfo.pm, if you like to call
getArtistMenu().

The disadvantage of this trick is that every time the MusicArtistInfo
plugin is updated, the trick must be reinstalled in the new version.

So my question to you is:

Do you have a better idea to make this work?

Or can you modify the code line,

Code:
--------------------
    type => ($client && $client->controllerUA || '') =~ /squeezeplay/i ? 'link' 
: 'slideshow',
--------------------


that the runtime error disappears.


------------------------------------------------------------------------
sveninndh's Profile: http://forums.slimdevices.com/member.php?userid=69030
View this thread: http://forums.slimdevices.com/showthread.php?t=97146

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to