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.


-- 
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, Title Switcher 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=47234

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to