Yes, it's a menu level parameter. I did not want to move even more logic
to the queries. They should simply return what they're told to do, and
try to be as little smart as possible imho.

Umm... but there is no way to make them do this. They don't accept the
parameter, that's the problem.

The problem we're trying to resolve is that for some menu items we want to override the globally set library_id. Menu code would use that latter if none was defined in a menu item. Therefore we have to define one, which I chose to be -1. The reason for this value is probably a bit perly: above condition would read something like:

$library_id = $params->{library_id} || $prefs->get('library_id')

Which reads: use the library_id stored in the parameters, or stored in the preferences. In perl 0 is the same as false. Which means that sending an ID of 0 would cause the code to use the globally set value (the one in the prefs).

> And thinking about it again (hate these many replies, you really should
> find a way to read edited posts...) why do you use "-1" as a parameter
> at all? Shouldn't "0" do just as well?

For the aforementioned reason 0 wouldn't work, as it would be ignored and the default value be used instead. What you'd have to do in your code is to remove the parameter (or set it to 0) if -1 is being passed.

There's a price for going your own way...

You mean there should be a price for using officially documented
functionality instead of undocumented, reverse-engineered stuff? Nah.

Nope. You decided that the menus as defined for SP were not good enough for your use. Therefore you're using the well documented queries to implement the menus yourself. That's perfectly fine. You just have to bite the bullet and go all the way there. You can't expect us/me to implement your cherry-picked functionality here or there, depending on what you want/don't want to implement on your own. Didn't you ask me to add library_id to the status query in order to allow you to implement your own menus? Now please don't stop half way.

We/I've taken much blame for putting too much logic eg. into the artists query. Now I'm trying to stay away from the same problem and it's not right either. Oh well...

--

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

Reply via email to