Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 33
  1. #11
    Senior Member
    Join Date
    Sep 2005
    Posts
    2,845
    Quote Originally Posted by afriend View Post
    One oddity: in the artists menu for this virtual ibrary, some artists have - in addition to the correct albums - empty albums listed (when you click on them, it says empty). That happens also if I create such a library with the advanced search UI. Any idea how to get rid of those?
    please check these artists for "member of a sampler/compilation"
    Do you use one or two lists? -> settings/my music / browse artists
    I believe your using two - try one and these emptry artists are gone.

  2. #12
    Quote Originally Posted by DJanGo View Post
    please check these artists for "member of a sampler/compilation"
    Do you use one or two lists? -> settings/my music / browse artists
    I believe your using two - try one and these emptry artists are gone.
    I think you are right. I haven't checked all of the empty album entries but they seem to be compilations that do include a song by the chosen artist but just not one with AAA in the comments tag.

    As for the LMS settings, I don't know what configurable in "single, configurable artists list" means but I've always had only one single list for artists and album artists alike. I have toggled between the 2 available settings but that doesn't make the "ghost" albums disappear.
    I'll probably table this for now so I don't get distracted from the virtual library tasks. I might require a separate thread.
    Last edited by afriend; 2018-08-14 at 03:40.

  3. #13
    #1
    Ok, so I have almost finished creating the virtual libraries I need.
    For the "20 Random Compilation Albums" (= built-in "20 Random Albums" for compilations) I could only come up with a workaround.
    I've tried creating a virtual library for that but couldn't figure out the exact SQL query (using albums.id or what not) to get it working, however many SQL query variations I tried. The only code that worked gave me 20 random compilation albums with just 1 track in it = 20 random tracks.
    I know it's because it's on the track and not album level but just couldn't fugure it out.
    And - it didn't rebuild the menu when clicking on it again.

    Code:
         	sql => qq{
    				INSERT OR IGNORE INTO library_track (library, track)
    					SELECT '%s', tracks.id
    					FROM tracks 
    					JOIN albums ON tracks.album = albums.id 
    					WHERE albums.compilation=1
    					AND tracks.audio = 1
    					AND not exists(select * from genre_track,genres 
    						where
    							genre_track.track=tracks.id and
    							genre_track.genre=genres.id and
    							genres.name in ('Classical','Soundtracks'))
    			
    				group by albums.id
    				order by random()
    				
    				limit 20
         				},
       		rebuildOnSelect => 1
    Anyway, so I tried this workaround: I used the virtual library that gives me all compilation albums and I added mode => 'randomalbums' and sort => 'random' to the code that creates the menu:

    Code:
    		Slim::Menu::BrowseLibrary->registerNode({
    			type         => 'link',
    			name         => 'COMPILATIONS_RANDOM_20_ALBUMS',
    			params       =>  {library_id => Slim::Music::VirtualLibraries->getRealId('COMPIS_with_EXCLUDED_GENRES'),
    								mode => 'randomalbums',
    								sort => 'random'},
    			feed         => \&Slim::Menu::BrowseLibrary::_albums,
    			icon         => 'html/images/albums.png',
    			jiveIcon     => 'html/images/albums.png',
    			homeMenuText => 'COMPILATIONS_RANDOM_20_ALBUMS',
    			condition    => \&Slim::Menu::BrowseLibrary::isEnabledNode,
    			id           => 'COMPILATIONS_RANDOM_20_TracksByAlbum',
    			weight       => 90,
    			cache        => 1,
    			});
    I'd be ok with this workaround but it always gives me 50 albums.
    Is there a way to insert a limit (20 albums) into this workaround?

    #2
    But now comes the really hard part: with all those menus on the top level it's getting more and more crowded. And while I can play around and do some trial and error with SQL, there's no way I can do the same with perl.
    I took a look at the code of some plugins, especially Erland's Custom Libraries which has a part in it that makes all menus (artists, albums...) of a virtual library submenus of a top level menu with the name of the virtual library. But that menu grouping code is so beyond what I can do. I just couldn't get it to work.

    So if you know how to group menus together the way I described in the opening post, if you have some working code that I can easily adjust to my needs, I would be very glad to see it here.
    From my many hours of tinkering with virtual libraries, I can say it's not easy but ultimately rewarding because it allows finer control and will hopefully still work by the time Erland's plugins will have stopped working. Thank you very much for your help.

  4. #14
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,261

    Virtual Libraries - help beginner please

    > *And* - *it didn't rebuild the menu when clicking on it* again.

    There's no mechanism to achieve this.

    > rebuildOnSelect => 1


    That flag you must have invented yourself. Or I'm victim of my
    forgetfulness again... I didn't find it in all of the LMS code base.

    > Anyway, so I tried *this workaround*: I used the virtual library that
    > gives me all compilation albums and I added *mode => 'randomalbums'* and
    > *sort => 'random'* to -the code that creates the menu:-


    You're definitely exploring new ground here! :-) Great, if that works!

    But the 'order by...' is irrelevant in the insert. It's only relevant
    when querying data.

    > I'd be ok with this workaround but it always gives me *50* albums.
    > Is there a way to insert a limit (*20* albums) into this workaround?


    I guess that's just the default number of items per page.

    --

    Michael

  5. #15
    So I gave up on the idea of having a menu group for the menu I've created. It's too difficult for me. If somebody digs up this thread at some time and get this working, please post your code here.

    One final (I hope) question regarding the genre menu I've created for compilations.
    The menu levels are like this:

    Compis by Genre (Top Level Name) > genres (where you select a genre) > artists (it shows you all artists in this genre, you select all albums) > all albums

    How can I eliminate the artists menu level and make it go straight from genres to all albums from this genre?
    Last edited by afriend; 2018-08-22 at 06:23.

  6. #16
    Uh, and I'd like to include my own icons in the plugin 'bundle' for Web UI and iPeng:
    what's the correct path to use in the menu parameters?

    icon => '???????????.png'

  7. #17
    Quote Originally Posted by mherger View Post
    exploring new ground here
    I would like to group select menus from various virtual libraries into one single top level menu folder (as explained in post 1).
    It seems to be a Perl coding challenge and therefore I hope as an experienced coder you can spot my problem right away and maybe push me in the right direction.

    It feels like I have 2 Perl code examples I need to bring together.

    On the one hand the code to group menus belonging to one virtual library (here: 'AAA') into a single folder:

    Code:
    		Slim::Menu::BrowseLibrary->registerNode({
                            type         => 'link',
                            name         => 'MENUGROUP',
    			params       => { library_id => Slim::Music::VirtualLibraries->getRealId('AAA') },
                            feed         => sub {
                            	my ($client, $cb, $args, $pt) = @_;
                            	my @items = ();
    
                            	push @items,{
                            		type => 'link',
                            		name => string('AAA_SEL_ALBUMS'),
                            		url => \&Slim::Menu::BrowseLibrary::_albums,
                            		icon => 'html/images/albums.png',
                           			passthrough => [{ 
                           				library_id => $pt->{'library_id'},
                           				searchTags => [
                           					'library_id:'.$pt->{'library_id'}
                           				],
                           			}],
                            	};
    
                             	push @items,{
                             		type => 'link',
                             		name => string(AAA_SEL_ARTISTS'),
                             		url => \&Slim::Menu::BrowseLibrary::_artists,
                             		icon => 'html/images/artists.png',
                             		passthrough => [{ 
                             			library_id => $pt->{'library_id'},
                             			searchTags => [
                             				'library_id:'.$pt->{'library_id'}
                             			],
                             		}],
                             	};
     				$cb->({
     					items => \@items,
     					});
                             },
                            icon => 'html/images/musicfolder.png',
                            jiveIcon => 'html/images/musicfolder.png',
                            id           => 'MyTopLevelMenu',
                            weight       => 600,
                            cache        => 1,
                    });
    But since the library_id is defined before the push @items, all menus in this folder have to be from the virtual library defined in the beginning (params).

    And on the other hand I can create menus from various virtual libraries (alas, top level menus only) using this code:
    Code:
    	my @menus = ( {
    		name => 'AAA_ARTISTS',
    		icon => 'html/images/artists.png',
    		feed => \&Slim::Menu::BrowseLibrary::_artists,
    		id   => 'AAA_TracksByArtist',
    		weight => 25,
           virtualID => 'AAA',
    	},{
    		name => 'BBB_ALBUMS',
    		icon => 'html/images/albums.png',
    		feed => \&Slim::Menu::BrowseLibrary::_albums,
    		id   => 'BBB_TracksByAlbum',
    		weight => 25,
            virtualID => 'BBB',
    	} );
    
    	foreach (@menus) {
    		Slim::Menu::BrowseLibrary->registerNode({
    			type         => 'link',
    			name         => $_->{name},
    			params       => { library_id => Slim::Music::VirtualLibraries->getRealId($_->{virtualID}) },
    			feed         => $_->{feed},
    			icon         => $_->{icon},
    			jiveIcon     => $_->{icon},
    			homeMenuText => $_->{name},
    			condition    => \&Slim::Menu::BrowseLibrary::isEnabledNode,
    			id           => $_->{id},
    			weight       => $_->{weight},
    			cache        => 1,
    		});
    	}
    So if you know how I can bring these two together to have one top level menu folder containing menus from various virtual libraries, please let me know. I'm really trying but I don't think I'll get there on my own.
    Thank you very much.

  8. #18
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,261

    Virtual Libraries - help beginner please

    > *params => { library_id => Slim::Music::VirtualLibraries->getRealId('AAA') },*

    No need to define the library_id at this level. The top level menu item
    doesn't need it, but only the sub-items. Therefore:

    > *push @items*,{
    > type => 'link',
    > name => string('AAA_SEL_ALBUMS'),
    > url => \&Slim::Menu::BrowseLibrary::_albums,
    > icon => 'html/images/albums.png',
    > *passthrough* => [{
    > *library_id* => $pt->{'*library_id*'},
    > searchTags => [
    > '*library_id*:'.$pt->{'*library_id*'}
    > ],
    > }],
    > };


    Just define the library_id here for every menu item (using the same
    ->getRealId() call for the individual libraries) instead of reading it
    from the top-level menu.

    --

    Michael

  9. #19
    Quote Originally Posted by mherger View Post
    Just define the library_id here for every menu item (using the same
    ->getRealId() call for the individual libraries)
    I've tried many different variations: the library_id getRealId call with and without params, inside and outside the passthrough block, with and without changing the searchTags value, with and without the $pt...
    This is just the code I used last:
    Code:
    		Slim::Menu::BrowseLibrary->registerNode({
                            type         => 'link',
                            name         => 'MENUGROUP',
                            feed         => sub {
                            	my ($client, $cb, $args, $pt) = @_;
                            	my @items = ();
                            	push @items,{
                            		type => 'link',
                            		name => string('AAA_SEL_ALBUMS'),
                            		url => \&Slim::Menu::BrowseLibrary::_albums,
                            		icon => 'html/images/albums.png',
    					id   => string('myMusicAlbums_AAA_Sel_TracksByAlbum'),
                             		# params => { library_id => Slim::Music::VirtualLibraries->getRealId('AAA_SEL') },
                             		passthrough => [{ 
                             			# params => { library_id => Slim::Music::VirtualLibraries->getRealId('AAA_SEL') },
                             			library_id => { Slim::Music::VirtualLibraries->getRealId('AAA_SEL') },
                             			searchTags => [
                             				'library_id:'.{ Slim::Music::VirtualLibraries->getRealId('AAA_SEL') }
                            			],
                             		}],
                            	};
     							$cb->({
     								items => \@items,
     							});
                             },
                            icon => 'html/images/musicfolder.png',
                            jiveIcon => 'html/images/musicfolder.png',
                            id           => 'MyTopLevelMenu',
                            weight       => 600,
                            cache        => 1,
                    });
    When I don't end up with a syntax error, I get all the albums of my complete library when it should be just the albums of the virtual library AAA. Bit frustrating because I feel I'm so close.

    So if you could let me know where exactly (inside/outside passthrough block) and in what form (with/without params, need to change the searchTag as well...) to place the getRealId call, I would be so glad. I'm really determined to wrap this thing up and start using this plugin.
    Thank you so much for your help.

  10. #20
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,261
    Quote Originally Posted by afriend View Post
    I've tried many different variations: the library_id getRealId call with and without params, inside and outside the passthrough block, with and without changing the searchTags value, with and without the $pt
    You certainly have too many parameters in there :-D. I think it should be

    Code:
     passthrough => [{ 'library_id' => $your_id }]
    Michael

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

Posting Permissions

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