PDA

View Full Version : Album numbers



Danny Rego
2005-06-21, 10:13
Hey guys, is there any way we could assign a NUMBER to an album (or perhaps
even artists, or playlists) so that we could just enter the number on the
remote, and hit enter, and that item would play?

I'm only asking because then I could program my harmony remote (quite
easily) to play my favorite albums/playlists.

The reason I'm asking this on the dev list, is I'd like to know if perhaps
there is a unique ID number for each album in the DB that I could possibly
utilize for this purpose? Does that ID number change everytime there's a
re-scan???

I was thinking of making a plugin that would export a CSV file of favorite
albums (and numbers) in the format that the harmony website could import for
use in the remote.....and also would allow you to hit a button on the remote
to enter what "DISC NUMBER" you'd like to play.

Any comments?

(actually...that leads to another possibly project...how about giving
plugins a way to "make up" a button code for config in the IR files...in
other words, instead of re-configuring the "play" or "play.hold" entry in
the IR file, a plugin could look for, and use the "mypluginbutton" or
"mypluginbutton.hold" for it's functionality...hope it makes sense the way
I've explained it)

Danny Rego

gorstk
2005-06-21, 10:28
Danny Rego wrote:
> Hey guys, is there any way we could assign a NUMBER to an album (or
> perhaps even artists, or playlists) so that we could just enter the
> number on the remote, and hit enter, and that item would play?

I thought of this idea a while back.

Imagine being able to print off a list of your albums. Browse the list,
then just type in the number of the album you wanted.

Not sure how the album 'number' would remain unique between rescans
though - especially when we have to frequently wipe the database in
order for slimserver to delete unused entries and add new ones.

kdf
2005-06-21, 10:34
Quoting Danny Rego <danny (AT) rego (DOT) com>:


> The reason I'm asking this on the dev list, is I'd like to know if perhaps
> there is a unique ID number for each album in the DB that I could possibly
> utilize for this purpose? Does that ID number change everytime there's a
> re-scan???

if you look at the url's used, you can see the id numbers for every album.
I would expect them to stay the same on rescan, but not necessarily so if you
wipe the cache.

> I was thinking of making a plugin that would export a CSV file of favorite
> albums (and numbers) in the format that the harmony website could import for
> use in the remote.....and also would allow you to hit a button on the remote
> to enter what "DISC NUMBER" you'd like to play.
>
sounds like a good idea. I think the favourites plugin does allow you to save
an album as a favourite, but that may not be the extent of function that you
desire here.

> (actually...that leads to another possibly project...how about giving
> plugins a way to "make up" a button code for config in the IR files...in
> other words, instead of re-configuring the "play" or "play.hold" entry in
> the IR file, a plugin could look for, and use the "mypluginbutton" or
> "mypluginbutton.hold" for it's functionality...hope it makes sense the way
> I've explained it)

This already exists.
Slim::Hardware::IR::addModeDefaultMapping('mode',\ %mapping);

where mode must match a valid button mode and the mapping hash is the key value
pairs like those found in Default.map

Have a look at the bottom of the SavePlaylist plugin that comes with slimserver.

-kdf

Danny Rego
2005-06-21, 10:40
> Not sure how the album 'number' would remain unique between rescans
> though - especially when we have to frequently wipe the database in order
> for slimserver to delete unused entries and add new ones.

So I guess that anwers part of my question...there is no unique ID number
that stays the same for each album after re-scan.

Perhaps I could make a config for the plugin that would "Search" for what
you specify and then play it? For example you could setup "Album #332" as
"Search for artist "Alanis", album "Jagged Little Pill"".....then when you
enter 332, it will find that exact album, and play it!? (then it could
allow for playing a particular artist, playlist, genre etc by using an
"album number")

Does this sound useful to anyone else???

(creating config screens for this would probably be murder...yikes...here I
go with the late nights again...haahaa)

Danny Rego

Danny Rego
2005-06-21, 10:44
> sounds like a good idea. I think the favourites plugin does allow you to
> save
> an album as a favourite, but that may not be the extent of function that
> you
> desire here.

Hmm.....I'll have to have a look at that plugin...perhaps a suggestion to
the author would be to assign an "album number" to each favorite, and allow
direct access to it by typing the number in on the keypad.

> This already exists.
> Slim::Hardware::IR::addModeDefaultMapping('mode',\ %mapping);

Has this been around for a while!? I wonder how I missed it!? (I'll have
to give'er a look to see if it's what I need)

Danny Rego

kdf
2005-06-21, 10:45
Quoting Danny Rego <danny (AT) rego (DOT) com>:

> Perhaps I could make a config for the plugin that would "Search" for what
> you specify and then play it? For example you could setup "Album #332" as
> "Search for artist "Alanis", album "Jagged Little Pill"".....then when you
> enter 332, it will find that exact album, and play it!? (then it could
> allow for playing a particular artist, playlist, genre etc by using an
> "album number")

you can do this fairly easily with the datastore methods. if you look for
$ds->find, you'll see it littered all over the code.

> Does this sound useful to anyone else???

Does it have to? I'd recommend sticking to what you want. You'll get more
sleep that way ;)

-k

Danny Rego
2005-06-21, 10:59
> sounds like a good idea. I think the favourites plugin does allow you to
> save
> an album as a favourite, but that may not be the extent of function that
> you
> desire here.

....by the way...are you talking about the bookmark plugin? If not...where
can I find this???

Danny Rego

kdf
2005-06-21, 11:09
Quoting Danny Rego <danny (AT) rego (DOT) com>:


> ...by the way...are you talking about the bookmark plugin? If not...where
> can I find this???

nope, I'm talking about "favorites". it's part of 6.1

-k

kdf
2005-06-21, 11:31
Quoting Danny Rego <danny (AT) rego (DOT) com>:

> Has this been around for a while!? I wonder how I missed it!? (I'll have
> to give'er a look to see if it's what I need)
>
Wed Oct 22 13:06:51 2003 PDT :)

Its way at the bottom, so not really noticeable.
It is also not widely recommended since a bunch of plugins trying to overwrite
the standard modes would be nearly impossible to arbitrate. For creating
mappings on your own modes, its a great thing.

the mixer plugins make use of this feature as well.

The plugin API will automatically call any defaultMap() routine that is found
within a plugin module. see Buttons::Plugins::addDefaultMaps

-kdf

Robert Moser
2005-06-21, 12:20
Danny Rego wrote:
> (actually...that leads to another possibly project...how about giving
> plugins a way to "make up" a button code for config in the IR files...in
> other words, instead of re-configuring the "play" or "play.hold" entry
> in the IR file, a plugin could look for, and use the "mypluginbutton" or
> "mypluginbutton.hold" for it's functionality...hope it makes sense the
> way I've explained it)
>
> Danny Rego

There are two levels of mapping in between slimserver receiving an ir
signal and some function executing. The first maps the ir code to a
button name, and the second maps the button name to a function. The ir
code to button mapping is mode independent, while the button to function
mapping is mode dependent.

The first mapping is controlled by the .ir files, while the second is
controlled by the .map files.

Plugins can define their own button to function mapping for their own
mode. The buttons used there can be whatever you like. However, if
there isn't an ir code which will map to that button name, you'll never
have that mapping be used by the remote.

Plugins have no way of customizing the ir code to button mapping.

If you have a programmable remote which has extra buttons, the best
thing to do is create a new .ir file for that remote, with the extra ir
codes to button names mapped out there. Then those new buttons would be
available to be used in a .map file, or from within a plugin's defaultMap().

Danny Rego
2005-06-21, 12:25
Excellent....thanks for the helpful info guys. I'll play around with it
tonight. (I've been meaning to ask about it for a while, as I just want one
button on my universal to do something special with my plugin)

Danny Rego



> There are two levels of mapping in between slimserver receiving an ir
> signal and some function executing. The first maps the ir code to a
> button name, and the second maps the button name to a function. The ir
> code to button mapping is mode independent, while the button to function
> mapping is mode dependent.
>
> The first mapping is controlled by the .ir files, while the second is
> controlled by the .map files.
>
> Plugins can define their own button to function mapping for their own
> mode. The buttons used there can be whatever you like. However, if there
> isn't an ir code which will map to that button name, you'll never have
> that mapping be used by the remote.
>
> Plugins have no way of customizing the ir code to button mapping.
>
> If you have a programmable remote which has extra buttons, the best thing
> to do is create a new .ir file for that remote, with the extra ir codes to
> button names mapped out there. Then those new buttons would be available
> to be used in a .map file, or from within a plugin's defaultMap().
>

Robert Moser
2005-06-21, 12:46
kdf wrote:
> Quoting Danny Rego <danny (AT) rego (DOT) com>:
>
>
>>Has this been around for a while!? I wonder how I missed it!? (I'll have
>>to give'er a look to see if it's what I need)
>>
>
> Wed Oct 22 13:06:51 2003 PDT :)
>
> Its way at the bottom, so not really noticeable.
> It is also not widely recommended since a bunch of plugins trying to overwrite
> the standard modes would be nearly impossible to arbitrate. For creating
> mappings on your own modes, its a great thing.
>
> the mixer plugins make use of this feature as well.
>
> The plugin API will automatically call any defaultMap() routine that is found
> within a plugin module. see Buttons::Plugins::addDefaultMaps
>
> -kdf

addModeDefaultMapping can only be used to create mappings for new modes,
such as those created by a plugin.

I made addModeDefaultMapping such that it will not overwrite a currently
defined mode mapping. As such it can not be used to change the mapping
of pre-existing modes. To change those mappings will require either
dropping in a custom .map to override the defaults, or editing of the
Default.map file.

So, in order to modify existing mode mappings from a plugin you would
have to either get into the symbol table for Slim::Hardware::IR and
modify %irMap, or drop a custom .map file into an IR directory and
switch the client irmap preference to use that new file.

We also reload the %irMap for a particular map file whenever the irmap
preference is changed to that map file. This is so that any changes to
the map file are brought in without having to continually scan the IR
directories for changes. This has the side effect of removing any
back-door changes to %irMap.

This is intentionally non-trivial. I really did not want a plugin to
mess with the mapping created by a user, or with the default mapping.
If mapping changes are needed by a plugin, those changes should be in
the documentation for that plugin so that the end-user can make an
informed decision about the behavior change that will happen.

Philip Meyer
2005-08-03, 13:33
>Perhaps I could make a config for the plugin that would "Search" for what
>you specify and then play it? For example you could setup "Album #332" as
>"Search for artist "Alanis", album "Jagged Little Pill"".....then when you
>enter 332, it will find that exact album, and play it!? (then it could
>allow for playing a particular artist, playlist, genre etc by using an
>"album number")
>
Could you not keep it even simpler - embed the "Album #nnnn" into a comment tag. If comment tags are added to the DB during a scan, a plugin could be written to find the unique number. Perhaps a stand-alone tool could be written to add "Album #nnnn" comment tags into each track. I believe you can have more than one comment tag in a file, so it would even be possible to enter several "Album #nnnn" for tracks that are shared with more than one album (eg. where a track appears on a "Greatest Hits" album.

I'd like the Advanced Search facility to be able to search tag comments too.

Phil

danny6869
2005-08-05, 11:07
I've actually got this done already...it just needs a few tweaks, and it's
ready to roll. It doesn't use the comment tag, but it does allow you to do
fancier things, like make album #443 play all "Offspring" songs.....or #444
could play all songs with "love" in the title. I'm just waiting on some
information from the harmony remote makers, as my primary purpose for this
plugin was to utilize the "media" button on those remotes to play favorite
albums on the squeezebox. (people with harmony remotes will understand what
I mean better than I can explain it)

Danny Rego


----- Original Message -----
From: "Philip Meyer" <slim (AT) hergest (DOT) demon.co.uk>
To: "Slim Devices Developers" <developers (AT) lists (DOT) slimdevices.com>
Sent: Wednesday, August 03, 2005 4:33 PM
Subject: Re: [Developers] Re: Album numbers


>Perhaps I could make a config for the plugin that would "Search" for what
>you specify and then play it? For example you could setup "Album #332" as
>"Search for artist "Alanis", album "Jagged Little Pill"".....then when you
>enter 332, it will find that exact album, and play it!? (then it could
>allow for playing a particular artist, playlist, genre etc by using an
>"album number")
>
Could you not keep it even simpler - embed the "Album #nnnn" into a comment
tag. If comment tags are added to the DB during a scan, a plugin could be
written to find the unique number. Perhaps a stand-alone tool could be
written to add "Album #nnnn" comment tags into each track. I believe you
can have more than one comment tag in a file, so it would even be possible
to enter several "Album #nnnn" for tracks that are shared with more than one
album (eg. where a track appears on a "Greatest Hits" album.

I'd like the Advanced Search facility to be able to search tag comments too.

Phil

Bruce Hartley
2005-09-17, 04:25
Did you ever release the code to do these discrete codes -> favourite album jumps.

I would love to do that from my Pronto type remote.

Thanks,
Bruce.

GoCubs
2005-10-15, 20:12
addModeDefaultMapping can only be used to create mappings for new modes,
such as those created by a plugin.

I made addModeDefaultMapping such that it will not overwrite a currently
defined mode mapping. As such it can not be used to change the mapping
of pre-existing modes. To change those mappings will require either
dropping in a custom .map to override the defaults, or editing of the
Default.map file.

So, in order to modify existing mode mappings from a plugin you would
have to either get into the symbol table for Slim::Hardware::IR and
modify %irMap, or drop a custom .map file into an IR directory and
switch the client irmap preference to use that new file.

We also reload the %irMap for a particular map file whenever the irmap
preference is changed to that map file. This is so that any changes to
the map file are brought in without having to continually scan the IR
directories for changes. This has the side effect of removing any
back-door changes to %irMap.

This is intentionally non-trivial. I really did not want a plugin to
mess with the mapping created by a user, or with the default mapping.
If mapping changes are needed by a plugin, those changes should be in
the documentation for that plugin so that the end-user can make an
informed decision about the behavior change that will happen.

I'm working on an enhancement to my SuperDateTime screensaver plugin that requires the user to be able to use the arrow keys while the plugin is active. I created my own custom mapping using addModeDefaultMapping. This mapping works when my screensaver is triggered if it is set as the now playing screensaver. However, when the squeezebox is OFF and my screensaver is set as the off screensaver, the custom mapping does not work. Is this because it's in "OFF" mode and I cannot overwrite it, even though my plugin is also active? Modifying the [off] values in default.map fixes my problem, but I'd rather have the plugin automatically remap the keys. Is it supposed to work this way? Any workarounds?

Thanks
-Greg

GoCubs
2005-10-15, 20:19
I think I found a solution to my previous post...
In addition to:
Slim::Hardware::IR::addModeDefaultMapping('SCREENS AVER.superdatetime',\%mapping);
I added:
Slim::Hardware::IR::addModeDefaultMapping('OFF.sup erdatetime',\%mapping);

...and it seems to be doing the trick :)

-Greg

Grotus
2005-10-15, 21:31
GoCubs blurted out:
> I think I found a solution to my previous post...
> In addition to:
> Slim::Hardware::IR::addModeDefaultMapping('SCREENS AVER.superdatetime',\%mapping);
> I added:
> Slim::Hardware::IR::addModeDefaultMapping('OFF.sup erdatetime',\%mapping);
>
> ...and it seems to be doing the trick :)
>
> -Greg

Yep, that's exactly what you were supposed to do.