I'm considering writing a plugin to allow 'extra' tags to be read from a
text file in the same directory as a music file. I want to do this to
add the ability to easily filter my music for each user in our
household, but don't want to modify the tags in the music files
themselves, as these are automatically updated based on data from
MusicBrainz.

How did you plan to present those filtered lists to the users? As virtual libraries?

- For each track that is found, call a function in the plugin

You plugin would have to register an importer. You already looked at the Fulltext Search plugin. You'll get the idea. That importer can be run after the other, regular scans. You could then grab a list of all tracks, and process them with your magic.

- Retrieve the directory where that track is stored

The file paths are stored in the url column of the tracks table. That url can be converted to a file path using Slim::Utils::Misc::pathFromFileURL($url).

- Read a file in this directory (if it exists) and cache its contents
- Add any tags in this file to the database for the track concerned

I think this will be the crucial part: how to store your additional data. The library.db has a pretty fixed structure. Unless you can fit your data in there somehow, you might need to manage your own table.

But this might actually be a pretty simple solution if you opted for the virtual libraries: a virtual library definition expects an SQL query which returns track IDs to be used in a library. If you created your own table, it could be as simple as two columns: user and track ID. The library for user A would be defined as "select track_id from my_custom_user_table where user = 'A'". I hope you get the point :-).

--

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

Reply via email to