PasTim wrote: 
> Thanks.  Beyond my skills these days I'm afraid, but the problem is so
> rare for me that the inconvenience if it does happen is not too bad :)
As a workaround, I have gotten in the habit of modifying any SQL that
uses the multilibrary id to use the name and then do a join on
multilibrary_libraries to get the id. I admit it's really ugly, but I
don't really mind doing this because using names is more robust than
hardcoding library ids in the sql. Still, it's only really an option for
people comfortable modifying SQL (You can get to the SQL by choosing
Customize SQL in many of Erland's plugins)

Here's an example of a SQL playlist that I use to randomly play work
(i.e., all the movements of a symphony). I've marked out the relevant
lines.

Code:
--------------------
    -- PlaylistName:Random Played Works
  -- PlaylistGroups:
  -- PlaylistOption Unlimited:1
  DROP TABLE IF EXISTS albumworks;
  
  CREATE TEMPORARY TABLE IF NOT EXISTS albumworks 
  AS SELECT tracks.album AS album, customscan_track_attributes.value as work, 
Ifnull(track_statistics.playcount, 0) as playcount
  FROM tracks
  JOIN multilibrary_track
  *JOIN multilibrary_libraries*
  LEFT JOIN track_statistics
  JOIN customscan_track_attributes
  ON tracks.id = customscan_track_attributes.track
  AND tracks.url = track_statistics.url
  AND customscan_track_attributes.module = 'customtag'
  AND customscan_track_attributes.attr = 'WORK'
  AND tracks.id=multilibrary_track.track 
  *AND multilibrary_track.library=multilibrary_libraries.id*
  WHERE playcount > 0* AND multilibrary_libraries.libraryid = 'no_duplicates'*
  GROUP BY tracks.album, customscan_track_attributes.value
  ORDER BY random() limit 10 ;
  
  SELECT tracks.url FROM
  (SELECT rowid AS albumworks_id, album as albumworks_album, work, playcount 
from albumworks)
  JOIN tracks
  JOIN customscan_track_attributes
  ON tracks.id = customscan_track_attributes.track
  AND customscan_track_attributes.module = 'customtag'
  AND customscan_track_attributes.attr = 'WORK'
  AND customscan_track_attributes.value = work
  AND tracks.album = albumworks_album
  ORDER BY albumworks_id, tracks.tracknum;
--------------------


------------------------------------------------------------------------
mps's Profile: http://forums.slimdevices.com/member.php?userid=36351
View this thread: http://forums.slimdevices.com/showthread.php?t=49483

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

Reply via email to