tuc;663458 Wrote: > Thanks Erland > As I understand your reply, the only two actions required are: > 1. When items are added or deleted from the current playlist, save the > data about the current playlist in a table with a unique ID "current > playlist" as key. This code should run immediately after the add/delete > command. > 2. When a playlist is deleted, change the "current playlist" unique ID > as used by 1. This code should run after the deletion of the whole > playlist, but before any new add/delete actions. > > So this should be possible without any disruption of normal behaviour > and with the existing API, right? It does require that deletion of a > whole playlist in SBS is not implemented as a series of "delete one > track". > Regarding performance I'm mostly worried about point 1. It might not be an issue but I know that there are code that when playing an item you have browsed to it adds track by track. I think most of the SBS code should be fine but I know that at least Custom Browse works this way.
Another issue that complicate things is that there are many different commands that modifies the playlist, there is "load", "add", "addtracks", "loadtracks" and probably others too, so you need to figure out exactly which commands to react on. tuc;663458 Wrote: > > I guess I just have to learn how to code a plugin. Where would you > recommend me to start? I do know programming and SQL but I have no clue > about what the API or DB look like. So I suspect it will take me some > time :-) > Database is somewhat described here: http://wiki.slimdevices.com/index.php/SlimServerDatabaseStructure Another good source which you want to look at is probably: - Slim/Control/Request.pm: Which contains a list of all commands available, you probably want to look at the "playlist" commands - Slim/Control/Command.pm: Which contains the implementation of the commands. The best way is to start from an existing plugin and remove stuff you don't need and add stuff you need. Mine are pretty large, so you probably want to start with one of the smaller plugins instead. The bundled RandomPlay (Random Mix) plugin have some playlist management so that might be a good choice. I would suspect that you need to: - In initPlugin setup a subscription with "subscribe" to the commands you like to listen to and make it call a callback in your plugin. - Implement the callback so it either detect what was just added/removed from the current playlist or just get the complete current playlist, and save it in a new database table. - To create new tables, take a look at one of my plugins, it's done at least in DynamicPlayList/Plugin.pm (initDatabase) or TrackStat/Storage.pm (init). Both just have some code that parses and execute a sql file which contains CREATE TABLE statements. tuc;663458 Wrote: > > Perhaps it's better to continue this outside this thread - this thread > is intended for your plugins. > Yes, that's probably a good idea. -- erland Erland Isaksson ('My homepage' (http://erland.isaksson.info)) (Developer of 'many plugins/applets (both free and commercial)' (http://wiki.slimdevices.com/index.php/User:Erland). If my answer helped you and you like to encourage future presence on this forum and/or third party plugin/applet development, 'donations are always appreciated' (http://erland.isaksson.info/donate)) Interested in music discovery ? See 'Social Music Discovery (SMD)' (http://forums.slimdevices.com/showthread.php?p=656713) project. ------------------------------------------------------------------------ erland's Profile: http://forums.slimdevices.com/member.php?userid=3124 View this thread: http://forums.slimdevices.com/showthread.php?t=49483 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/plugins
