Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: In Playlist filter based on now playing (Read 1494 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

In Playlist filter based on now playing

Hi, I am looking for a component or solution to allow in playlist filtering based on the currently playing track.

Lets say I have a playlist with 2000 dance music files all fully tagged via mixed in key with BPM and Key info, I would like to have an option to filter the playlist to show tracks with only a similar BPM and Compatible key too the track currently playing, too assist in choosing the next track to add to the que, to play next. Creating a great harmonic sounding "mix" of music.
 
The filter would be set to a bpm range and keys via a script.
The playlist would stay fixed and not spawn a new one on each filter.

Is this possible? Dose it exist? I have done a lot of searching.

Apologies if posed in the wrong place I am fairly new around here, but a long time Foobar lover.

Many Thanks Ben

Re: In Playlist filter based on now playing

Reply #1
To all your requests such as playlist based and playlists specific filtering? Nope. To have a way to show songs based on similar attributes of the now playing song without interfering in current playlist? Yes.
There is an older component called library tree, not to be confused with the more recent JSpanel Library Tree by Wilb, that has a "nowplaying" function. It's a tree view component for columns ui but I guess it should also work in a popup panel using foo_popup with DUI.
You can find it here: http://foo2k.chottu.net/

Re: In Playlist filter based on now playing

Reply #2
Thank you!

This is a great step forwards!

Have a great day

Ben

Re: In Playlist filter based on now playing

Reply #3
Hey there,

Filtering tracks is usually the job of the library viewer, not the playlist viewer - you would usually filter tracks first and then add to playlist. I think best you could do "in playlist" is to sort - make a column for %bmp% and sort by that (click column header) - the currently playing track would be amongst ones with the same value.

Also if you use a library viewer like Facets, you can select a value and it highlights those tracks in the playlist, for easy finding.

Cheers

Re: In Playlist filter based on now playing

Reply #4
Perhaps some further explanation if you're going to use library tree. You need to create a view node in the component preferences. Give it a name and set the view format. The view format is how you would like to display the node. For example %bpm% %artist% %title% or %bpm%|%artist% %title% would show %bpm% and %artist% %title% as a subnode.
In the filter field you define what you want to display in the node. In your case it should be:

Code: [Select]
%bpm% IS $nowplaying{%bpm%}

If you want you can further narrow the filter like this

Code: [Select]
%bpm% IS $nowplaying{%bpm%} AND %style% IS Dance

Once you have this set up library tree will dynamically show every file in your library that corresponds to what you have playing currently according to the set filter settings. No manual look up required. You can right click the node and add everything to the playback queue or you can grab the node and drag it into a playlist. I mainly use this nowplaying filter function to show me top rated songs of whatever artist or genre I'm playing.

Re: In Playlist filter based on now playing

Reply #5
Thank you so much for this help guys, Ive got it working and its very close to the behaviour I was looking for, which is amazing.

I have ended up with With 3 filters one for Same BPM one for same Key and one for both.

Next I going to now look more into using functions listed in the title formatting guide with an aim too learn to filter by a range so it show the Current BPM and BPM'S down to 5 less and 5 more in the results. I think the $add $sub Functions along with AND in theory should enable this.  

Then the harder part compatible keys, which I think Ill have to Develop New Custom Tag, which I can use in the Filter.

Thanks again have a great day

Ben

Re: In Playlist filter based on now playing

Reply #6
Not really sure if this will work but try to filter like this:

Code: [Select]
%bpm% IS $nowplaying{%bpm%} AND $sub(%bpm%,5) IS $nowplaying{%bpm%} AND $add(%bpm%,5) IS $nowplaying{%bpm%}

Re: In Playlist filter based on now playing

Reply #7
Never mind my previous suggestion, it's stupid, doesn't work. This does:

Code: [Select]
(
%bpm% IS $nowplaying{"$sub(%bpm%,5)"} OR
%bpm% IS $nowplaying{"$sub(%bpm%,4)"} OR
%bpm% IS $nowplaying{"$sub(%bpm%,3)"} OR
%bpm% IS $nowplaying{"$sub(%bpm%,2)"} OR
%bpm% IS $nowplaying{"$sub(%bpm%,1)"} OR
%bpm% IS $nowplaying{"$add(%bpm%,1)"} OR
%bpm% IS $nowplaying{"$add(%bpm%,2)"} OR
%bpm% IS $nowplaying{"$add(%bpm%,3)"} OR
%bpm% IS $nowplaying{"$add(%bpm%,1)"} OR
%bpm% IS $nowplaying{"$add(%bpm%,5)"} OR
%bpm% IS $nowplaying{%bpm%}
)
AND %bpm% PRESENT

This shows all %bpm% within a range of minus 5 and plus 5 of the currently playing %bpm%. So if you play 120 bpm everything from  115 to 125 will be shown.
Also if you use
Code: [Select]
%bpm%\%artist% - %title%
as view format it will rank from low to high the bpm and have the artist and title under each respective bpm subnode.
Put all the filter code on one line to use as filter.

Re: In Playlist filter based on now playing

Reply #8
Nailed it! Thank you.

I added to my code I made to work out the Compatible Keys to make one Mega Filter!
Code: [Select]
( %bpm% IS $nowplaying{"$sub(%bpm%,5)"} OR %bpm% IS $nowplaying{"$sub(%bpm%,4)"} OR %bpm% IS $nowplaying{"$sub(%bpm%,3)"} OR %bpm% IS $nowplaying{"$sub(%bpm%,2)"} OR %bpm% IS $nowplaying{"$sub(%bpm%,1)"} OR %bpm% IS $nowplaying{"$add(%bpm%,1)"} OR %bpm% IS $nowplaying{"$add(%bpm%,2)"} OR %bpm% IS $nowplaying{"$add(%bpm%,3)"} OR %bpm% IS $nowplaying{"$add(%bpm%,1)"} OR %bpm% IS $nowplaying{"$add(%bpm%,5)"} OR %bpm% IS $nowplaying{%bpm%} ) AND %bpm% PRESENT AND (%INITIALKEY% IS $nowplaying{%INITIALKEY%} OR %INITIALKEY% IS $nowplaying{%_CK1%} OR %INITIALKEY% IS $nowplaying{%_CK2%} OR %INITIALKEY% IS $nowplaying{%_CK3%})

For the keys Ive ended up making 3 dynamic fields, and referencing to the %Key% tag that M.I.K puts unique code into, against the keys I know to be compatible. using this code and variations there of.

Code: [Select]
$if($strstr(%KEY%,eyJrZXkiOiIxQSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),1B)
$if($strstr(%KEY%,eyJrZXkiOiIxQiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),1A)
$if($strstr(%KEY%,eyJrZXkiOiIyQSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),2B)
$if($strstr(%KEY%,eyJrZXkiOiIyQiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),2A)
$if($strstr(%KEY%,eyJrZXkiOiIzQSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),3B)
$if($strstr(%KEY%,eyJrZXkiOiIzQiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),3A)
$if($strstr(%KEY%,eyJrZXkiOiI0QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),4B)
$if($strstr(%KEY%,eyJrZXkiOiI0QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),4A)
$if($strstr(%KEY%,eyJrZXkiOiI1QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),5B)
$if($strstr(%KEY%,eyJrZXkiOiI1QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),5A)
$if($strstr(%KEY%,eyJrZXkiOiI2QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),6B)
$if($strstr(%KEY%,eyJrZXkiOiI2QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),6A)
$if($strstr(%KEY%,eyJrZXkiOiI3QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),7B)
$if($strstr(%KEY%,eyJrZXkiOiI3QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),7A)
$if($strstr(%KEY%,eyJrZXkiOiI4QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),8B)
$if($strstr(%KEY%,eyJrZXkiOiI4QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),8A)
$if($strstr(%KEY%,eyJrZXkiOiI5QSIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),9B)
$if($strstr(%KEY%,eyJrZXkiOiI5QiIsInNvdXJjZSI6Im1peGVkaW5rZXkiLCJhbGdvcml0aG0iOjk0fQ==),9A)
$if($strstr(%KEY%,eyJrZXkiOiIxMEEiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),10B)
$if($strstr(%KEY%,eyJrZXkiOiIxMEIiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),10A)
$if($strstr(%KEY%,eyJrZXkiOiIxMUEiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),11B)
$if($strstr(%KEY%,eyJrZXkiOiIxMUIiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),11A)
$if($strstr(%KEY%,eyJrZXkiOiIxMkEiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),12B)
$if($strstr(%KEY%,eyJrZXkiOiIxMkIiLCJzb3VyY2UiOiJtaXhlZGlua2V5IiwiYWxnb3JpdGhtIjo5NH0=),12A)

There is probably a much easier way to do it but it works.

Only thing left is to modify my style script for the Camalot Key colours. so it all displays nice in the Playlist view.

Code: [Select]
$if($strstr(%INITIALKEY%,1A),$set_style(back,$rgb(86,241,218,86,241,218)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,1B),$set_style(back,$rgb(2,237,202,2,237,202)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,2A),$set_style(back,$rgb(125,242,170,125,242,170)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,2B),$set_style(back,$rgb(60,238,129,60,238,129)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,3A),$set_style(back,$rgb(174,245,137,174,245,137)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,3B),$set_style(back,$rgb(134,242,79,134,242,79)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,4A),$set_style(back,$rgb(232,218,161,232,218,161)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,4B),$set_style(back,$rgb(223,202,115,223,202,115)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,5A),$set_style(back,$rgb(253,191,167,253,191,167)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,5B),$set_style(back,$rgb(255,160,124,255,160,124)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,6A),$set_style(back,$rgb(253,175,183,253,175,183)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,6B),$set_style(back,$rgb(255,160,124,255,160,124)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,7A),$set_style(back,$rgb(253,170,204,253,170,204)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,7B),$set_style(back,$rgb(255,129,180,255,129,180)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,8A),$set_style(back,$rgb(242,171,228,242,171,228)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,8B),$set_style(back,$rgb(238,130,217,238,130,217)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,9A),$set_style(back,$rgb(221,180,253,221,180,253)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,9B),$set_style(back,$rgb(206,143,255,206,143,255)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,10A),$set_style(back,$rgb(190,205,253,190,205,253)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,10B),$set_style(back,$rgb(159,182,255,159,182,255)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,11A),$set_style(back,$rgb(142,228,249,142,228,249)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,11B),$set_style(back,$rgb(86,217,249,86,217,249)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,12A),$set_style(back,$rgb(85,240,240,85,240,240)),%INITIALKEY%)
$if($strstr(%INITIALKEY%,12B),$set_style(back,$rgb(85,240,240,85,240,240)),%INITIALKEY%)

Thank you so much for your help!

Ben