Oh, I think this could be much easier. Create a simple plugin which has
at least a sub initPlugin. In there you're going to register your
libraries:
Code:
--------------------
Slim::Music::VirtualLibraries->registerLibrary( {
id => 'userA',
name => 'Library based on some complex processing',
scannerCB => sub {
my $libraryId = shift;
createLibrary($libraryId, 'A')
}
} );
sub createLibrary {
my $id = shift; # use this internal ID rather than
yours!
# do some serious processing here
...
# don't forget to update the library_track table with ($id,
'track_id') tuples at some point!
}
--------------------
Check out Slim/Music/VirtualLibraries.pm. There's some documentation at
the top. You'd have to register one library per user (replace 'A' in the
call). createLibrary would be called by the scanner with a library ID.
You then do your magic to figure out whether a track belongs to a
library or not. If it does, you create a record per track and library:
Code:
--------------------
INSERT OR IGNORE INTO library_track (library, track) VALUES $id, $track_id
--------------------
How you figure out $track_id is up to you. I'd probably go through all
folders referenced in the tracks table's url column, check for your data
and create records accordingly.
Some importers have a handler which would be called whenever a track is
added. This doesn't work with the regular scan, but only with eg. Browse
Music Folder (BMF). I'd stick with above method to get started. It
should cover most cases.
Michael
http://www.herger.net/slim-plugins - MusicArtistInfo, MusicInfoSCR,
Smart Mix
------------------------------------------------------------------------
mherger's Profile: http://forums.slimdevices.com/member.php?userid=50
View this thread: http://forums.slimdevices.com/showthread.php?t=105551
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins