Phil Meyer;229227 Wrote:
> I forgot to take out a filter that restricted the chosen songs to song
> that have never been played. I removed this and re-published, but I
> see that it didn't overwrite the existing published version. I can't
> find a way to remove a template that I have published, so perhaps you
> could remove the "Random albums for genre" that has the earliest last
> changed date.
>
If you like to update a published playlist you will need to enter the
same "unique identifier" as the previoius time. I've deleted to oldest
one, the unique identifier on the one left now is:
published_randomalbumsforgenre
Phil Meyer;229227 Wrote:
> Incidentally, if I only wanted to select from albums that have never
> been played before, how would I do it? Do I need to check the
> playcount of each song on the album, or is there some album stats
> table?
>
The album selection part of the playlist query would look something
like this to accomplish that. I used the "max" function here, there is
also an "avg" function and a "min" depending on what you want. The
ifnull section is required because else it will ignore the unplayed
tracks where track_statistics.playcount is null.
Code:
--------------------
create temporary table sqlplaylist_random_albums (primary key (album))
select tracks.album
from tracks
join genre_track on tracks.id=genre_track.track and
genre_track.genre='PlaylistParameter1'
left join track_statistics on tracks.url=track_statistics.url
where audio=1
group by tracks.album
having max(ifnull(track_statistics.playcount,0))=0
order by rand()
limit 1;
--------------------
--
erland
Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan, Custom Skip, Multi Library and Database Query plugins'
(http://wiki.erland.homeip.net/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=38603
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins