I'm not sure this solves the problem since I don't know exactly how the
iTunes party mix works. Also there might be better solutions that
doesn't create temporary tables.

This should get you a playlist based on your query that get you:
10% tracks unrated or rated 1-2
90% tracks rated 3-5


Code:
--------------------
    
  CREATE TEMPORARY TABLE mylowratedtracks AS 
  SELECT t.url /*, t.title, g.name, t.playCount, t.rating */
  FROM tracks t
  LEFT JOIN genre_track gt ON t.id = gt.track
  LEFT JOIN genres g ON gt.genre = g.id
  WHERE g.name NOT IN ('Classical','Books & 
Spoken','Podcast','Podcasts','Religious','Musicals ')
  AND g.name is not null
  AND (t.rating is null OR t.rating < 60)
  ORDER by random() limit 10;
  
  CREATE TEMPORARY TABLE myhighratedtracks AS SELECT t.url /*, t.title, g.name, 
t.playCount, t.rating */
  FROM tracks t
  LEFT JOIN genre_track gt ON t.id = gt.track
  LEFT JOIN genres g ON gt.genre = g.id
  WHERE g.name NOT IN ('Classical','Books & 
Spoken','Podcast','Podcasts','Religious','Musicals ')
  AND g.name is not null
  AND (t.rating >= 60)
  ORDER by random() limit 90;
  
  CREATE TEMPORARY TABLE mycombinedtracks AS 
  SELECT * FROM mylowratedtracks 
  UNION 
  SELECT * from myhighratedtracks;
  
  SELECT * from mycombinedtracks 
  ORDER BY random() limit 10;
  
  DROP TABLE mylowratedtracks;
  DROP TABLE myhighratedtracks;
  DROP TABLE mycombinedtracks;
  
--------------------


Note that this query will only work on a slimserver 6.5 using SQLite.
The reason is that it depends on the rating column in the tracks table
and the random(), with MySQL rand() is used instead and in slimserver
6.2 the ratings will not be placed in the tracks table (at least not by
TrackStat). So using slimserver 6.2 or slimserver 6.5 using MySQL would
require some minor changes.


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-trackstat)
, 'SQLPlayList' (http://tinyurl.com/pptqy) , 'DynamicPlayList'
(http://tinyurl.com/kfrgs) and 'RandomPlayList'
(http://tinyurl.com/pwtsc) plugins)
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=24692

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

Reply via email to