afriend wrote: 
> I think that could be it.
> But I'm not sure I understand how these IDs work. 
> Which IDs do I choose if I want to have *multiple* playlists with
> *multiple* parameters - and in a certain order in which they are asked?
> Would would the IDs and the parameters hash look like for these PLs?
> 
> Example:
> > 
Code:
--------------------
  >   >         my %parameter1 = (
  >                     'id' => 1,
  >                     'type' => 'genre',
  >                     'name' => 'Select genre'
  >     );
  >     my %parameter2 = (
  >                     'id' => 2,
  >                     'type' => 'custom',
  >                     'name' => 'Select decade',
  >                     'definition' => "select cast(((tracks.year/10)*10) as 
int),case when tracks.year>0 then cast(((tracks.year/10)*10) as int)||'s' else 
'Unknown' end from tracks where tracks.audio=1 group by 
cast(((tracks.year/10)*10) as int) order by tracks.year desc"
  >     );
  >     my %parameter3 = (
  >                     'id' => 3,
  >                     'type' => 'list',
  >                     'name' => 'Select percentage of TOP Rated Songs',
  >                     'definition' => 
'0:0%,10:10%,20:20%,30:30%,40:40%,50:50%,60:60%,70:70%,80:80%,90:90%,100:100%'
  >     );
  > 
  >     # PL2 - a playlist with rated songs with a certain percentage of songs 
rated >= 3 stars
  >     my %parametersPL2 = (
  >             1 => \%parameter3
  >     );
  >     $playlist2{'parameters'} = \%parametersPL2;
  >     $result{'ratingslight_rated-with_top_percentage'} = \%playlist2;
  > 
  >     # PL3 - a playlist with rated songs by decade
  >     my %parametersPL3 = (
  >             1 => \%parameter2
  >     );
  >     $playlist3{'parameters'} = \%parametersPL3;
  >     $result{'ratingslight_rated-by_decade'} = \%playlist3;
  > 
  >     # PL4 - a playlist with rated songs by genre with a certain percentage 
of songs rated >= 3 stars
  >     my %parametersPL4 = (
  >             1 => \%parameter2,
  >             2 => \%parameter3
  >     );
  >     $playlist4{'parameters'} = \%parametersPL4;
  >     $result{'ratingslight_rated-by_decade_with_top_percentage'} = 
\%playlist4;
  > 
  >     # PL5 - a playlist with rated songs by genre and decade with a certain 
percentage of songs rated >= 3 stars
  >     my %parametersPL5 = (
  >             1 => \%parameter1,
  >             2 => \%parameter2,
  >             3 => \%parameter3
  >     );
  >     $playlist5{'parameters'} = \%parametersPL5;
  >     $result{'ratingslight_rated-by_genre_and_decade_with_top_percentage'} = 
\%playlist5;
--------------------
> > 

PL5 is correct, the important part is that the keys in parametersPL5
hash matches the id in the hash each key points to.

So for PL2 you need to use a hash that looks the same as %parameters3
but with id set to 1 since the key in parametersPL2 is 1.
And for PL3 you need to use a hash that looks like %parameters2 but with
if set to 1.
And for PL4 you need to use a hash that looks like %parameters2 but with
id set to 1 for the first parameter and a hash that looks like
%parameter3 with id set to 2 for the second parameter.

I would suggest that you use separate hashes for each playlist else it’s
going to be easy to accidentally set the id incorrect.
The id is used for ordering the parameters in the order you like them to
be specified by the user.

If I’d write the plugin today I’d probably remove the id attribute and
only use the keys in the parameters attribute on the top level. As it is
now you need to have the same info in two places. 

Hope this explains it, let me know if it doesn’t  and I’ll try to write
sample when I’m beside a computer.



Erland Isaksson ('My homepage' (http://erland.isaksson.info))
Developer of 'many plugins/applets'
(https://wiki.slimdevices.com/index.php/User_Erland.html)
*Starting with LMS 8.0 I no longer support my plugins/applets* ('see
here for more information'
(https://forums.slimdevices.com/showthread.php?49483-Announce-New-versions-of-erlands-plugins&p=998836&viewfull=1#post998836)
)
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=113344

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to