=== Jive.pm ================================================================== --- Jive.pm (revision 24026) +++ Jive.pm (local) @@ -77,6 +77,8 @@ Slim::Control::Request::addDispatch(['jiveunmixable'], [1, 1, 1, \&jiveUnmixableMessage]); Slim::Control::Request::addDispatch(['jivealbumsortsettings'], [1, 0, 1, \&albumSortSettingsMenu]); Slim::Control::Request::addDispatch(['jivesetalbumsort'], [1, 0, 1, \&jiveSetAlbumSort]); + Slim::Control::Request::addDispatch(['jiveartworksettings'], [1, 0, 1, \&albumArtworkSettingsMenu]); + Slim::Control::Request::addDispatch(['jivesetartworkpref'], [1, 0, 1, \&jiveSetAlbumArtPref]); Slim::Control::Request::addDispatch(['jiveplaylists', '_cmd' ], [1, 0, 1, \&jivePlaylistsCommand]); Slim::Control::Request::addDispatch(['jiverecentsearches'], [0, 1, 0, \&jiveRecentSearchQuery]); @@ -109,10 +111,11 @@ $log->info("Begin function"); my $prefs = preferences("server"); my $sort = $prefs->get('jivealbumsort') || 'artistalbum'; + my $showArt = $prefs->get('jivealbumartpref') || 'showart'; # Pre-cache albums query if ( my $numAlbums = Slim::Schema->rs('Album')->count ) { $log->debug( "Pre-caching $numAlbums album items." ); - Slim::Control::Request::executeRequest( undef, [ 'albums', 0, $numAlbums, "sort:$sort", 'menu:track', 'cache:1' ] ); + Slim::Control::Request::executeRequest( undef, [ 'albums', 0, $numAlbums, "sort:$sort", "showArt:$showArt", 'menu:track', 'cache:1' ] ); } # Artists @@ -242,6 +245,7 @@ @{musicServicesMenu($client)}, @{playerSettingsMenu($client, 1)}, @{albumSortSettingsItem($client, 1)}, + @{albumArtSettingsItem($client, 1)}, @{myMusicMenu(1, $client)}, @{recentSearchMenu($client, 1)}, ); @@ -327,6 +331,89 @@ } +sub albumArtSettingsItem { + $log->info("Begin function"); + my $client = shift; + my $batch = shift; + + my @menu = (); + push @menu, + { + text => $client->string('COVERART'), + id => 'settingsArtworkSettings', + node => 'advancedSettings', + displayWhenOff => 0, + weight => 100, + actions => { + go => { + cmd => ['jiveartworksettings'], + params => { + menu => 'radio', + }, + }, + }, + window => { + titleStyle => 'settings', + }, + }; + + if ($batch) { + return \@menu; + } else { + _notifyJive(\@menu, $client); + } + +} + +sub albumArtworkSettingsMenu { + $log->info("Begin function"); + my $request = shift; + my $client = $request->client; + my $prefs = preferences("server"); + my $pref = $prefs->get('jivealbumartpref') || 'showart'; + my %sortMethods = ( + showart => 'SHOW_ARTWORK', + hideart => 'HIDE_ARTWORK', + ); + $request->addResult('count', scalar(keys %sortMethods)); + $request->addResult('offset', 0); + my $i = 0; + for my $key (sort keys %sortMethods) { + $request->addResultLoop('item_loop', $i, 'text', $client->string($sortMethods{$key})); + my $selected = ($pref eq $key) + 0; + $request->addResultLoop('item_loop', $i, 'radio', $selected); + my $actions = { + do => { + player => 0, + cmd => ['jivesetartworkpref'], + params => { + 'showArt' => $key, + }, + }, + }; + $request->addResultLoop('item_loop', $i, 'actions', $actions); + $i++; + } +} + +sub jiveSetAlbumArtPref { + my $request = shift; + my $client = $request->client; + my $showArt = $request->getParam('showArt'); + my $prefs = preferences("server"); + $prefs->set('jivealbumartpref', $showArt); + + # this requires the caches to be rebuilt, and a playerstatus notification to be sent out + buildCaches(); + $client->execute([ 'status', '-', 10, 'menu:menu' ]); + + # resend the myMusic menus with the new showArt pref set + myMusicMenu(0, $client); + + $request->setStatusDone(); +} + + # allow a plugin to add a node to the menu sub registerPluginNode { $log->info("Begin function"); @@ -1552,10 +1639,13 @@ sub myMusicMenu { $log->info("Begin function"); - my $batch = shift; - my $client = shift || undef; - my $prefs = preferences("server"); - my $sort = $prefs->get('jivealbumsort') || 'artistalbum'; + my $batch = shift; + my $client = shift || undef; + my $prefs = preferences("server"); + my $sort = $prefs->get('jivealbumsort') || 'artistalbum'; + my $showArt = $prefs->get('jivealbumartpref') || 'showart'; + my $menuStyle = $showArt eq 'showart' ? 'album' : ''; + my @myMusicMenu = ( { text => $client->string('BROWSE_BY_ARTIST'), @@ -1593,8 +1683,7 @@ }, }, window => { - menuStyle => 'album', - menuStyle => 'album', + menuStyle => $menuStyle, titleStyle => 'albumlist', }, }, @@ -1652,7 +1741,6 @@ }, }, window => { - menuStyle => 'album', titleStyle => 'newmusic', }, }, @@ -1702,7 +1790,11 @@ sub searchMenu { $log->info("Begin function"); - my $batch = shift; + my $batch = shift; + my $prefs = preferences("server"); + my $showArt = $prefs->get('jivealbumartpref') || 'showart'; + my $menuStyle = $showArt eq 'showart' ? 'album' : ''; + my $client = shift || undef; my @searchMenu = ( { @@ -1725,15 +1817,15 @@ go => { cmd => ['artists'], params => { - menu => 'album', - menu_all => '1', - search => '__TAGGEDINPUT__', + menu => 'album', + menu_all => '1', + search => '__TAGGEDINPUT__', _searchType => 'artists', }, }, }, window => { - text => $client->string('SEARCHFOR_ARTISTS'), + text => $client->string('SEARCHFOR_ARTISTS'), titleStyle => 'search', }, }, @@ -1757,17 +1849,18 @@ go => { cmd => ['albums'], params => { - menu => 'track', - menu_all => '1', - search => '__TAGGEDINPUT__', + menu => 'track', + menu_all => '1', + showArt => '1', + search => '__TAGGEDINPUT__', _searchType => 'albums', }, }, }, window => { - text => $client->string('SEARCHFOR_ALBUMS'), + text => $client->string('SEARCHFOR_ALBUMS'), titleStyle => 'search', - menuStyle => 'album', + menuStyle => $menuStyle, }, }, { @@ -1790,18 +1883,18 @@ go => { cmd => ['tracks'], params => { - menu => 'track', - menuStyle => 'album', - menu_all => '1', - search => '__TAGGEDINPUT__', + menu => 'track', + menu_all => '1', + showArt => '1', + search => '__TAGGEDINPUT__', _searchType => 'tracks', }, }, }, window => { - text => $client->string('SEARCHFOR_SONGS'), + text => $client->string('SEARCHFOR_SONGS'), titleStyle => 'search', - menuStyle => 'album', + menuStyle => $menuStyle, }, }, { === Queries.pm ================================================================== --- Queries.pm (revision 24026) +++ Queries.pm (local) @@ -172,6 +172,9 @@ my $menuMode = defined $menu; my $insertAll = $menuMode && defined $insert; + my $jiveShowArt = $prefs->get('jivealbumartpref') eq 'hideart' ? 0 : 1; + my $jiveMenuStyle = $jiveShowArt ? 'album' : ''; + if (!defined $tags) { $tags = 'l'; } @@ -260,7 +263,7 @@ } # Flatten request for lookup in cache, only for Jive menu queries - my $cacheKey = complex_to_query($where) . complex_to_query($attr) . $menu . $tags . (defined $insert ? $insert : ''); + my $cacheKey = complex_to_query($where) . complex_to_query($attr) . $menu . $tags . $jiveShowArt . (defined $insert ? $insert : ''); if ( $menuMode ) { if ( my $cached = $cache->{albums}->{$cacheKey} ) { my $copy = from_json( $cached ); @@ -351,7 +354,7 @@ } }, 'window' => { - 'titleStyle' => "album", + 'titleStyle' => $jiveMenuStyle, } }; @@ -386,7 +389,7 @@ # first PLAY ALL item if ($insertAll) { - $chunkCount = _playAll(start => $start, end => $end, chunkCount => $chunkCount, request => $request, loopname => $loopname, includeArt => 1); + $chunkCount = _playAll(start => $start, end => $end, chunkCount => $chunkCount, request => $request, loopname => $loopname, includeArt => $jiveShowArt ); } # We need to know the 'No album' name so that those items @@ -411,6 +414,7 @@ my $favorites_title = $text; $favorites_title =~ s/\n/ - /g; + $text = $jiveShowArt ? $text : $favorites_title; $request->addResultLoop($loopname, $chunkCount, 'text', $text); @@ -441,8 +445,10 @@ $request->addResultLoop($loopname, $chunkCount, 'params', $params); - # artwork if we have it + + # artwork if we have it and want it if ($eachitem->title ne $noAlbumName && + $jiveShowArt && defined(my $iconId = $eachitem->artwork())) { $iconId += 0; $request->addResultLoop($loopname, $chunkCount, 'icon-id', $iconId); @@ -3411,6 +3417,7 @@ $modecurrent = 1; } + # if repeat is 1 (song) and modecurrent, then show the current song if ($modecurrent && ($repeat == 1) && $quantity) { @@ -4209,7 +4216,8 @@ my $contributorID = $request->getParam('artist_id'); my $albumID = $request->getParam('album_id'); my $year = $request->getParam('year'); - my $menuStyle = $request->getParam('menuStyle') || 'item'; + my $allSongs = $request->getParam('allSongs'); + my $showArt = $request->getParam('showArt'); my %favorites; $favorites{'url'} = $request->getParam('favorites_url'); @@ -4217,6 +4225,10 @@ my $menu = $request->getParam('menu'); my $insert = $request->getParam('menu_all'); + + # only show art under certain conditions: pref not set to 'hide' and showArt param sent in request + my $jiveShowArt = $prefs->get('jivealbumartpref') eq 'hideart' ? 0 : $showArt ? 1 : 0; + my $jiveMenuStyle = $jiveShowArt ? 'album' : ''; # menu/jive mgmt my $menuMode = defined $menu; @@ -4363,7 +4375,7 @@ # first PLAY ALL item if ($insertAll) { - $chunkCount = _playAll(start => $start, end => $end, chunkCount => $chunkCount, request => $request, loopname => $loopname, includeArt => ( $menuStyle eq 'album' ) ); + $chunkCount = _playAll(start => $start, end => $end, chunkCount => $chunkCount, request => $request, loopname => $loopname, includeArt => $jiveShowArt ); } @@ -4390,7 +4402,7 @@ # Bug 7443, check for a track cover before using the album cover my $iconId = $item->coverArtExists ? $id : 0; - if(defined($albumObj)) { + if( defined($albumObj) && $jiveShowArt ) { $album = $albumObj->title(); $iconId ||= $albumObj->artwork(); } @@ -4406,20 +4418,25 @@ 'text' => $text, }; - if ($menuStyle eq 'album') { + if ( $jiveShowArt ) { $request->addResultLoop($loopname, $chunkCount, 'style', 'albumitem'); + } else { + $request->addResultLoop($loopname, $chunkCount, 'style', 'item'); + } + + if ( $allSongs ) { + $request->addResultLoop($loopname, $chunkCount, 'text', $item->title); + } elsif ( $jiveShowArt ) { $request->addResultLoop($loopname, $chunkCount, 'text', $text); - } elsif ($menuStyle eq 'allSongs') { - $request->addResultLoop($loopname, $chunkCount, 'text', $item->title); } else { my $oneLineTrackTitle = Slim::Music::TitleFormatter::infoFormat($item, $format, 'TITLE'); $request->addResultLoop($loopname, $chunkCount, 'text', $oneLineTrackTitle); } - if (defined($iconId)) { + if ( defined($iconId) && $jiveShowArt ) { $iconId += 0; $window->{'icon-id'} = $iconId; - if ($menuStyle eq 'album') { + if ( $jiveShowArt ) { $request->addResultLoop($loopname, $chunkCount, 'icon-id', $iconId); } } @@ -4470,13 +4487,13 @@ params => { search => $request->getParam('search'), menu => $request->getParam('menu'), + showArt => $jiveShowArt, menu_all => 1, cached_search => 1, _searchType => $request->getParam('_searchType'), }, }, }, - window => { menuStyle => 'album' }, }; Slim::Control::Jive::cacheSearch($request, $jiveSearchCache); } @@ -4938,6 +4955,7 @@ $text = $track->title . "\n" . $text; } + $request->addResultLoop($loop, $count, 'style', 'albumitem'); $request->addResultLoop($loop, $count, 'text', $text); # Add trackinfo menu action for remote URLs @@ -5528,7 +5546,7 @@ goCmd => [ 'tracks' ], addHoldCmd => [ 'playlistcontrol' ], params => { - go => { menu => 1, menu_all => 1, sort => 'title', menuStyle => 'allSongs', }, + go => { menu => 1, menu_all => 1, sort => 'title', allSongs => 1, }, play => { cmd => 'load', }, add => { cmd => 'add', }, 'add-hold' => { cmd => 'insert', },