erland wrote: > I'm sorry, I forgot about this thread. > > If you like to choose about average BMP numbers, something like this > might do it: > > Code: -------------------- > > > -- PlaylistName:BPM > -- PlaylistGroups: > -- PlaylistParameter1:custom:Select BPM:select 20*floor(customscan_track_attributes.value/20)+10,20*floor(customscan_track_attributes.value/20)+10 from customscan_track_attributes where customscan_track_attributes.module='customtag' and customscan_track_attributes.attr='BPM' group by 20*floor(customscan_track_attributes.value/20)+10 order by customscan_track_attributes.value > select tracks.url from tracks > join track_statistics on > tracks.url=track_statistics.url > join customscan_track_attributes on > tracks.id=customscan_track_attributes.track and customscan_track_attributes.module='customtag' and customscan_track_attributes.attr='BPM' and customscan_track_attributes.value>='PlaylistParameter1'-10 and customscan_track_attributes.value<'PlaylistParameter1'+10 > left join dynamicplaylist_history on > tracks.id=dynamicplaylist_history.id > where > audio=1 > and dynamicplaylist_history.id is null > group by tracks.id > order by rand() > limit 25; > -------------------- > > > > Or if you like to select a free range, you should be able to do > something like this: > > Code: -------------------- > > > -- PlaylistName:BPM Range > -- PlaylistGroups: > -- PlaylistParameter1:custom:Select Low BPM:select 10*floor(customscan_track_attributes.value/10),10*floor(customscan_track_attributes.value/10) from customscan_track_attributes where customscan_track_attributes.module='customtag' and customscan_track_attributes.attr='BPM' group by 10*floor(customscan_track_attributes.value/10) order by customscan_track_attributes.value > -- PlaylistParameter2:custom:Select High BPM:select 10*ceil(customscan_track_attributes.value/10),10*ceil(customscan_track_attributes.value/10) from customscan_track_attributes where customscan_track_attributes.module='customtag' and customscan_track_attributes.attr='BPM' and customscan_track_attributes.value>='PlaylistParameter1' group by 10*ceil(customscan_track_attributes.value/10) order by customscan_track_attributes.value > select tracks.url from tracks > join track_statistics on > tracks.url=track_statistics.url > join customscan_track_attributes as lowbpm on > tracks.id=lowbpm.track and lowbpm.module='customtag' and lowbpm.attr='BPM' and lowbpm.value>='PlaylistParameter1' > join customscan_track_attributes as highbpm on > tracks.id=highbpm.track and highbpm.module='customtag' and highbpm.attr='BPM' and highbpm.value<='PlaylistParameter2' > left join dynamicplaylist_history on > tracks.id=dynamicplaylist_history.id > where > audio=1 > and dynamicplaylist_history.id is null > group by tracks.id > order by rand() > limit 25; > -------------------- > > > > I don't have BPM tags in my own library at the moment, so I've no way > to verify if this works or not. > > There is also a "bpm" column in the standard "tracks" table, if this > is filled when you have bpm tags it should be possible to do all this > completely without Custom Scan. In this case the playlist SQL will > also be a bit simpler.
6 years later, this doesn't work anymore. Apparently. It throws this: Code: -------------------- Error: near "PlaylistParameter1": syntax error Carp::Clan::__ANON__(): DBI Exception: DBD::SQLite::db prepare failed: near "PlaylistParameter1": syntax error [for Statement "select tracks.url from tracks join track_statistics on tracks.url=track_statistics.url join customscan_track_attributes as songkey on tracks.id=songkey.track and songkey.module='customtag' and songkey.attr='INITIALKEY' and songkey.value=''PlaylistParameter1'' join customscan_track_attributes as bpmrange on tracks.id=bpmrange.track and bpmrange.module='customtag' and bpmrange.attr='BPM' and bpmrange.value>=''PlaylistParameter2''-2.5 and bpmrange.value<=''PlaylistParameter2''+2.5 left join dynamicplaylist_history on tracks.id=dynamicplaylist_history.id and dynamicplaylist_history.client='00:04:20:2b:0f:e2' where audio=1 and dynamicplaylist_history.id is null group by tracks.id order by rand() limit 25;"] at /usr/share/perl5/Slim/Schema/Storage.pm line 126 -------------------- ------------------------------------------------------------------------ Hypfer's Profile: http://forums.slimdevices.com/member.php?userid=64839 View this thread: http://forums.slimdevices.com/showthread.php?t=47234 _______________________________________________ plugins mailing list plugins@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/plugins