As I understand it, the purpose of this is to play:
- All tracks between two years that neither have been rated nor played
If this is correct, you can try something like this:
Code:
--------------------
-- PlaylistName: Not played by Years...
-- PlaylistGroups: Not played,Years
-- PlaylistParameter1:year:Select 1st year:
-- PlaylistParameter2:custom:Select 2nd year:select tracks.year,tracks.year
from tracks where tracks.year>='PlaylistParameter1' and tracks.audio=1 group by
tracks.year order by tracks.year
select tracks.url from tracks
join tracks_persistent on
tracks.id=tracks_persistent.track
left join track_statistics t2 on
tracks.url=t2.url and t2.rating>0
where
tracks.audio=1
and t2.url is null
and tracks_persistent.playCount is null
and tracks.year>='PlaylistParameter1'
and tracks.year<='PlaylistParameter2'
group by tracks.id
order by rand()
limit 10;
--------------------
Play counts has been moved to tracks_persistent in SqueezeCenter 7.1.
The t1 part isn't necessary as far as I can see.
The dynamicplaylist_history part isn't necessary unless you like to
avoid that it adds the same track twice, if you like to avoid this you
instead need something like:
Code:
--------------------
-- PlaylistName: Not played by Years...
-- PlaylistGroups: Not played,Years
-- PlaylistParameter1:year:Select 1st year:
-- PlaylistParameter2:custom:Select 2nd year:select tracks.year,tracks.year
from tracks where tracks.year>='PlaylistParameter1' and tracks.audio=1 group by
tracks.year order by tracks.year
select tracks.url from tracks
join tracks_persistent on
tracks.id=tracks_persistent.track
left join track_statistics t2 on
tracks.url=t2.url and t2.rating>0
left join dynamicplaylist_history on
tracks.id=dynamicplaylist_history.id
where
tracks.audio=1
and t2.url is null
and tracks_persistent.playCount is null
and tracks.year>='PlaylistParameter1'
and tracks.year<='PlaylistParameter2'
and dynamicplaylist_history.id is null
group by tracks.id
order by rand()
limit 10;
--------------------
Or even more easier, use the playcount in track_statistics:
Code:
--------------------
-- PlaylistName: Not played by Years...
-- PlaylistGroups: Not played,Years
-- PlaylistParameter1:year:Select 1st year:
-- PlaylistParameter2:custom:Select 2nd year:select tracks.year,tracks.year
from tracks where tracks.year>='PlaylistParameter1' and tracks.audio=1 group by
tracks.year order by tracks.year
select tracks.url from tracks
left join track_statistics t2 on
tracks.url=t2.url and (t2.rating>0 or t2.playcount>0)
left join dynamicplaylist_history on
tracks.id=dynamicplaylist_history.id
where
tracks.audio=1
and t2.url is null
and tracks.year>='PlaylistParameter1'
and tracks.year<='PlaylistParameter2'
and dynamicplaylist_history.id is null
group by tracks.id
order by rand()
limit 10;
--------------------
Or if you don't want to avoid that the same track is played again:
Code:
--------------------
-- PlaylistName: Not played by Years...
-- PlaylistGroups: Not played,Years
-- PlaylistParameter1:year:Select 1st year:
-- PlaylistParameter2:custom:Select 2nd year:select tracks.year,tracks.year
from tracks where tracks.year>='PlaylistParameter1' and tracks.audio=1 group by
tracks.year order by tracks.year
select tracks.url from tracks
left join track_statistics t2 on
tracks.url=t2.url and (t2.rating>0 or t2.playcount>0)
where
tracks.audio=1
and t2.url is null
and tracks.year>='PlaylistParameter1'
and tracks.year<='PlaylistParameter2'
group by tracks.id
order by rand()
limit 10;
--------------------
--
erland
Erland Isaksson
'My homepage' (http://erland.isaksson.info) 'My download page'
(http://erland.isaksson.info/download)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan, Custom Skip, Multi Library and Database Query plugins'
(http://wiki.erland.isaksson.info/index.php/Category:SlimServer))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=53604
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins