HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: fbuser on 2010-01-02 17:15:40

Title: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2010-01-02 17:15:40
foo_random_pools is a foobar2000 component for creating random playlist entries selected and grouped by various pool definitions.

Mainly you can define titleformat expressions for selecting random groups like albums including sorting and filtering from the media library or from playlists. If foo_sqlite is installed some pool attributes can also defined with SQL expressions.

Upgrade Note: If you're upgrading from an older version than 2.0.0, it is highly recommended to backup your current configuration before.

Prerequisites:

Download (https://www.foobar2000.org/components/view/foo_random_pools)
Version history (https://www.foobar2000.org/components/view/foo_random_pools/releases)

Title: foo_random_pools
Post by: Black_Over_Bills_Mothers on 2010-01-03 09:01:02
Thanks for this plugin. I'm finding it really great to use.

Is there any chance of adding, as an option to number of tracks to add, a duration - say 1hr. In this way I could easily configure any number of tracks with a total length of roughly 1 hr. Obviously not exactly the duration but upto.

Thanks.
Title: foo_random_pools
Post by: Chris Norman on 2010-01-03 12:08:05
Looks like a great idea - going to test it.
Title: foo_random_pools
Post by: xbullethammer on 2010-01-03 19:57:30
BRILLIANT!

Finally a way to add random albums to a playlist!
Title: foo_random_pools
Post by: realhaiy on 2010-02-13 09:25:39
great plugin!
only one requset: option for preventing adding duplicates
Title: foo_random_pools
Post by: NullString on 2010-02-13 17:03:42
THis is goddamn great!
If I want to select 7 random albums I use the group query "%album artist%-%album%, and the query works perfectly. But I want to filter it so I don't get 2 albums from the same album artist, how can I do it?

Also would love to limit the query for filesize instead of group/track count.

GJ!
Title: foo_random_pools
Post by: Xezzy on 2010-02-13 20:03:54
Yes, limit the playlist by filesize would be great feature, especially for portable mp3 devices...
Title: foo_random_pools
Post by: fbuser on 2010-02-14 00:11:57
A limiting by duration or filesize will be probably implemented, but I won't implement any kind of memory for the random pools, which means there will be no chance to prevent duplicates.
Title: foo_random_pools
Post by: mrinferno on 2010-02-14 14:24:04
just noticed this last night and had a chance to try this morning.
very cool and thanks!!!
adding random albums to a playlist has been something I've always wanted to do with foobar.
this plug-in has lots of possibilities.  back to enjoying the randomness...
Title: foo_random_pools
Post by: foosion on 2010-02-14 14:37:35
Nice idea. I've tried to make it crash, but I wasn't successful so far.  There are a few things that could be improved (keep in mind that I'm a perfectionist):
Discoverability
Preferences
Dialogs
Here's my suggestion how to modify the "Random pool" dialog with an image and source code. The main reason why I reduced the height of the large edit controls is that it was easiest to show what I wanted that way, Resource Hacker isn't the most convenient tool for editing dialogs.
(http://foosion.foobar2000.org/misc/foo_random_pools.png)
Code: [Select]
103 DIALOG 50, 50, 332, 295
STYLE DS_FIXEDSYS | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Random pool"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "Ms Shell Dlg 2"
{
  CONTROL "", 1018, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 51, 11, 274, 12
  CONTROL "Determine probability for picking groups based on group size", 1004, BUTTON, BS_AUTOCHECKBOX | BS_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 76, 253, 14
  CONTROL "", 1019, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 51, 28, 274, 45
  CONTROL "", 1003, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 51, 93, 274, 45
  CONTROL "", 1020, EDIT, ES_LEFT | ES_MULTILINE | ES_AUTOHSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 51, 143, 274, 45
  CONTROL "", 1021, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 108, 205, 32, 12
  CONTROL "", 1000, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 108, 222, 32, 12
  CONTROL "", 1041, EDIT, ES_LEFT | ES_AUTOHSCROLL | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 108, 239, 32, 12
  CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 220, 276, 51, 14
  CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 277, 276, 50, 14
  CONTROL "Name:", 1014, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 13, 22, 8
  CONTROL "Group:", 1015, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 30, 38, 8
  CONTROL "Filter:", 1016, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 144, 20, 8
  CONTROL "Priority:", 1017, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 207, 38, 8
  CONTROL "Sort order:", 1002, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 95, 38, 8
  CONTROL "Number of groups to add:", 1039, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 224, 93, 8
  CONTROL "0 = don't consider this pool, when adding items from all pools", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 150, 204, 171, 18
  CONTROL "Limit number of tracks to add:", 1040, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 241, 100, 8
  CONTROL "0 = no limit", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 150, 241, 171, 8
}
Title: foo_random_pools
Post by: fbuser on 2010-02-14 15:45:43
Nice idea. I've tried to make it crash, but I wasn't successful so far.
Maybe you have to try harder. 

There are a few things that could be improved (keep in mind that I'm a perfectionist):
I'm always open to improvement suggestions.

Discoverability
  • foo_whatsnew did not pick up the main  menu commands after installation, so I suspect you don't enumerate any,  when no pool is configured. I suggest to enumerate the "All pools"  command always, but make is disabled and greyed, when there are no  pools, and to add a "More..." command that opens the preferences page.  The menu tree for foo_random_pools would then look like this:
    Code: [Select]
    [code]File
       Random pools
         All pools
         [insert configured pools here]
         ---
         More...
    [/code]
[/list][/quote]Good point, but I'll add another menu separator after "All pools". This should be possible now with SDK 1.0, at least I found no way to make this with the old SDK.

Preferences
  • Link the "Help" button to the installed help file.
  • Use new preferences page API from the 1.0 SDK.
I overlooked the first point, the second one is, of course, already planned.

Dialogs
  • Improve dialog layout. For example, add some horizontal space between buttons. I think Microsoft recommends 7 DLUs.
  • End labels for edit controls with a colon.
  • Improve text for "Don't determine distinct group values" check box. See below for my suggestion.
Personally, I don't like the first two points, but as a plugin should follow the host application, I will change that. For the third point, your text makes it more clear, what is meant, so I will use it. Regarding the dialog layout in general, I wasn't really happy with it by myself and I already got a proposal in a German Foobar200 forum, so I will also change the layout.[/li][/list]
Title: foo_random_pools
Post by: exxecutor on 2010-02-14 16:14:04
Thank you for this component!

However, why is %added% DURING LAST 6 WEEKS an invalid filter expression?
Title: foo_random_pools
Post by: fbuser on 2010-02-14 17:10:54
Will be fixed with the next version.
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-02-14 20:05:42
Anyone have any idea how I could rig a script for this in order to draw random pools of albums only from the past week/month/etc. using the %added% tag?
Title: foo_random_pools
Post by: exxecutor on 2010-02-23 12:54:04
So, I have been using this component for some days and it has become one of the most important to me! I love its "weighted randomness". I am using it with album ratings (calculated outside of foobar with a script I wrote). In my case, the component automatically populates my playlist with random albums but in the long run makes me listen to more great albums than bad ones. It also has great synergy with playlist_attribute's "remove played/skipped tracks".

I think, the preferences page could be improved for the next version.  Right now it's pretty inefficient if you want to play around with priorities.
Title: foo_random_pools
Post by: Xezzy on 2010-03-29 23:48:11
Great component. Is it still under development? Cause its listed as problematic, but its features are really cool.
Title: foo_random_pools
Post by: fbuser on 2010-03-30 18:51:04
Thanks for the hint. I'm already using a newer version and never had a crash, so I wasn't aware of it. I requested the crash reports and will look into them.
Title: foo_random_pools
Post by: mrinferno on 2010-03-30 19:00:32
Thanks for the hint. I'm already using a newer version and never had a crash, so I wasn't aware of it. I requested the crash reports and will look into them.


cool, glad to hear you're still developing.  i've had maybe one crash while running random pools, but i also have foo_uie_lyrics2 which has usually been the source of the crash.

either way, definitely looking forward to trying any new versions of random pools when your ready to release.
using it daily and i'm totally hooked on the ability to populate playlists with random albums!
Title: foo_random_pools
Post by: NullString on 2010-03-30 19:19:41
haven't gotten any crashes yet.
this plugin sort of "resurrects" not popular albums in my library, the randomness that mixes known with unknown... damn useful little tool
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-03-31 07:35:02
How does this "weighted randomness" work that some people have been talking about?
Title: foo_random_pools
Post by: exxecutor on 2010-03-31 08:31:51
How does this "weighted randomness" work that some people have been talking about?


It works best with parameters which are the same for whole albums (like date, genre, album rating). If you want to listen to more new music, create pools like f.i. (the more pools, the better):

Filter: %date% GREATER 2008, Priority: 20
Filter: %date% LESS 2009, Priority: 10
(Group: %album% for all)

After that specify a playlist for the autoadd feature and when the component should add a new album. Now when you listen to this playlist, the component will choose random albums but newer ones twice as often.

EDIT: I'm also looking forward to a new version. Amazing Plugin!
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-03-31 08:48:05
Gotcha, thanks for the explanation
Title: foo_random_pools
Post by: fbuser on 2010-04-04 22:28:28
Version 0.0.2 is available. See first post for DL and CL.
Title: foo_random_pools
Post by: exxecutor on 2010-04-04 23:33:55
Thank you very much! Works great so far.
Title: foo_random_pools
Post by: mrinferno on 2010-04-05 03:28:13
awesome thanks! looking forward to trying out more thoroughly tomorrow.

just FYI, it appears loading the new version blows away previous settings.

not a biggie for me at all i can easily recreate, just figured i would mention it though.


Title: foo_random_pools
Post by: Fractal_Mortality on 2010-04-05 06:46:52
So does this mean we can now perform filters like ADDED within LAST SIX WEEKS etc?

If so, what is the exact format?
Title: foo_random_pools
Post by: fbuser on 2010-04-05 08:40:27
just FYI, it appears loading the new version blows away previous settings.
Aargh, I think I noticed it, but later I forgot it, as it only happens by updating from version 0.0.1 to 0.0.2.

Edit: Fixed now ith version 0.0.2.1
Title: foo_random_pools
Post by: fbuser on 2010-04-05 08:41:26
So does this mean we can now perform filters like ADDED within LAST SIX WEEKS etc?

If so, what is the exact format?
Standard query syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax)
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-04-05 09:02:35
Ahhh, it appears this isn't working for me because my %added% format is

20100403

(YearMonthDay with no spaces or dashes)

I totally understand that this is simply a convention I've held onto, but would it be hard to edit the plugin to also support this date format?
Title: foo_random_pools
Post by: fbuser on 2010-04-05 09:17:16
Ahhh, it appears this isn't working for me because my %added% format is

20100403

(YearMonthDay with no spaces or dashes)

I totally understand that this is simply a convention I've held onto, but would it be hard to edit the plugin to also support this date format?
Sorry, but that is not possible. As the query syntax for dates doesn't seem to support something like $left(%added%,4)-$substr(%added%,5,2)-$right(%added%,2), the only thing you can do is to use masstager and convert your added field in that way.
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-04-05 09:20:06
Hmm, ok... Any idea how I'd go about that in masstagger?

edit: Nevermind, figured it out
Title: foo_random_pools
Post by: fbuser on 2010-04-05 09:36:18
"Format from other field" with the destination field ADDED and the pattern mentioned above should do it.
Title: foo_random_pools
Post by: mrinferno on 2010-04-05 14:49:14
Edit: Fixed now ith version 0.0.2.1


confirmed, tested the new version on my other install of foobar, settings are now preserved.
Title: foo_random_pools
Post by: q-stankovic on 2010-04-17 15:10:23
Since the component offers the limitation by time, size and number of tracks i tried to replicate simple playlist generating functionality - means: no random picked and then limited group is added but the limitation is applied on whole library. That is a a standard feature of playlist tree. I found out that title formatting expressions are possible that gives back the whole library as one group.

I would like to ask for a simple feature: before we have to type in weird expressions to create a group that consists of all media library items wouldn't it be more intuitive to do the same by leaving the group textbox just empty?
Title: foo_random_pools
Post by: fbuser on 2010-04-17 15:56:26
You don't need weird expressions to achieve this. Just use a field you don't have in your library, something like %all%. This should be simple enough. On the contrary, I found it a little bit confusing to get the whole library back, when no group was entered. That's why I restricted the group field to be non-empty.
Title: foo_random_pools
Post by: q-stankovic on 2010-04-17 16:05:56
You don't need weird expressions to achieve this. Just use a field you don't have in your library, something like %all%.

Or for example %library%?  Good to know!
Maybe you can do anything that is more obvious than using empty box or non-existing fields?

Title: foo_random_pools
Post by: fbuser on 2010-04-17 21:22:04
I don't see a need to do anything here. To get the whole library as one group you just need field with the same value for all tracks in the library. So, you could define a field and tag it for all tracks with an arbitrary value (obviously not the best solution) or you even use a field which has the value "undefined", which is the case, if a field doesn't exist.
Title: foo_random_pools
Post by: q-stankovic on 2010-04-18 21:29:03
I don't see a need to do anything here.
Well, now i know how to do it but what about other users? There is a useful feature that is hidden and could only be used by secret knowledge. A simple checkbox would do the job IMO.

I have a question: If we have a one added random pool that consists of more than one group, is each group of the pool random or is a random repetition avoided?
Title: foo_random_pools
Post by: fbuser on 2010-04-18 22:04:53
Well, now i know how to do it but what about other users? There is a useful feature that is hidden and could only be used by secret knowledge. A simple checkbox would do the job IMO.
There is nothing hidden and there is no secret knowledge, it's just logic. A checkbox would only be redundant, without any further benefit.

I have a question: If we have a one added random pool that consists of more than one group, is each group of the pool random or is a random repetition avoided?
From the help file:
Quote
Number of groups to add: Defines how many groups should be determined for adding tracks to a playlist. If "Determine probability for picking groups based on group size" is not selected, it is guaranteed, that no duplicates will be selected. In this case, if the number of distinct groups is less than the number of groups to add, the lesser number will be used.
Title: foo_random_pools
Post by: carpman on 2010-05-05 03:27:22
Hi all,

Great component fbuser. Looking forward to seeing how it develops.

I'm trying to understand the "All Pools" selection. Am I right in thinking for example that if you choose All Pools it will, based on the weighting, give you a selection of each Pool mixed together?

So for example, if one pool is limited to 1 hour and has a priority of 10 and another is limited to 2 hours with a priority of 20 you are likely to get a playlist of approx. 1 hour 30 mins?

The reason I ask is because I've been getting strange results from a test:

I've 2 pools. Both apply filters:

1) %path% HAS "chamber"

2) %title% HAS "adagio" OR %title% HAS "andante" OR %title% HAS "cantabile"

They have equal priority. Yet when I select "All Pools", ALL the results contain tracks with either adagio, andante or cantabile in the title.

Any idea why? I expected about 50% of tracks to be chamber music since "chamber" will appear in the directory name (%path%) and 50% of tracks with either adagio, andante or cantabile in the title.

Finally, each Pool works fine when selected independently, it's only a problem when All Pools is chosen.

All help much appreciated.
Thanks,

C.
Title: foo_random_pools
Post by: carpman on 2010-05-05 06:30:55
Forget it. Seems like a freak occurence of randomness.
Basically I ran it many times and each time every track had adagio etc ...
Have run it many many more times and I'm getting a mix.
Sorry for the false alarm.

C.
Title: foo_random_pools
Post by: carpman on 2010-05-06 02:32:14
Okay, after some more testing of this component I'm beginning to feel stupid.
Can someone explain to me what All Pools is supposed to do?

My expectation was that it would give you a mix of the various pools based on weighting. I've applied equal weighting to each of three pools, and I seem to be getting the results of one pool OR another, but never a combination.

Is that what's supposed to happen?

Again any help greatly appreciated. Or if someone can point me to the appropriate place in foo_random_pools_help.html that would be good.

Many thanks,

C.
Title: foo_random_pools
Post by: Wooops on 2010-05-06 08:25:14
There´s no option to run "all pools" simultaneously or one after one, but you can try this (hopefully it will do what you want), instead of using 2 pools merge them into one, such that it contains your both criteria’s (for your pool 1 and 2) specified in the group field and set in "number of groups to add: 2" It should add tracks from those 2 groups into a single playlist mix, you can use in the sort field "rand()" to get it really mixed
Now looking more closely to your pools it doesn´t seem possible to get both filters into one pool, but you can try using the same criteria as in your Pools 1 (%path%) for your Pool 2. Hopefully you have your adagio, andante or cantabile songs stored in a folder of the same name. Create a new pool and configure it as this:

Code: [Select]
Group field:%directoryname%
Number of Groups to add: 2
Filter : (%path% HAS "\Music\chamber") AND ((%path% HAS "\Music\adagio") OR (%path% HAS "\Music\andante") OR (%path% HAS "\Music\cantabile"))

Note: if you need to exclude a directory use (NOT (%path% HAS "\directory\"))

Hope it helps.
Title: foo_random_pools
Post by: fbuser on 2010-05-06 21:08:46
Again any help greatly appreciated. Or if someone can point me to the appropriate place in foo_random_pools_help.html that would be good.
An explicit explanation of "All pools" is missing indeed. It's only implicitly explained for the priority field. With "All pools" one pool is picked from all pools with a priority unequal to zero.

If you really need more than one pool to be added to a playlist, you have two options:
Title: foo_random_pools
Post by: carpman on 2010-05-07 09:27:50
Thanks for the reply. I got it now.
So basically All Pools is a lucky dip where you pick one pool from all the pools - which matches with the results I've been getting.

In which case I have a feature request.
Can you have a Run All Pools (except for those with a priority of 0) feature. This would be the equivalent of manually selecting each of the pools in the list.

Because so far what foo_random_pools can't do is provide a selection of tracks from a number of varied criteria, and this would allow for that, because you've made is easy to set the limits on each pool quite small (i.e. just a few tracks). So you can have a little of this, a little of that and a little of the other. 

Cheers,

C.
Title: foo_random_pools
Post by: NullString on 2010-05-07 14:31:30
In which case I have a feature request.
Can you have a Run All Pools (except for those with a priority of 0) feature. This would be the equivalent of manually selecting each of the pools in the list.

that sounds promising, like some sort of "alias" for groups of pools
Title: foo_random_pools
Post by: Fractal_Mortality on 2010-05-08 00:31:50
Because so far what foo_random_pools can't do is provide a selection of tracks from a number of varied criteria, and this would allow for that, because you've made is easy to set the limits on each pool quite small (i.e. just a few tracks). So you can have a little of this, a little of that and a little of the other.


Aye, this sounds like a great feature. The new "all pools" could also have a group amount, just like individual pools (i.e. if I wanted 20 random albums chosen from all of my pools, and selected according to their ranking, I could do it).
Title: foo_random_pools
Post by: laite on 2010-06-21 18:22:33
Hi, it seems that if same album is on random playlist twice, automatic add doesn't work. In other words, I have set this to add new album when there is 5 or less songs left, and it works correctly if album at the end of the list has only one instance on playlist, but doesn't work if same album is twice (or more) on playlist.
Title: foo_random_pools
Post by: fbuser on 2010-06-21 21:18:54
Thanks for reporting. Fixed with version 0.0.2.2.
Title: foo_random_pools
Post by: hesher on 2010-07-08 14:29:28
Could someone give an example for usage of the plugin?
I'm not sure I completely understand how it works and an example a little more practical than the one in the help file could really help.

Thankx
Title: foo_random_pools
Post by: mrinferno on 2010-07-08 15:51:23
one of my favorite ways to use it is as a virtual album changer [in conjunction with foo_removeplayed (basically just removes songs from the playlist after they finish playing)].

Example Random Pool:
Code: [Select]
Name: Album-Pop/Rock
Group: %album artist% - %date% - %album%
Number of groups to add: 1
Filter: (NOT %album artist% IS "Various Artists") AND (%genre% IS Pop/Rock)
Limit: 0, 0, 0, unchecked
Sort: %path_sort%
Sort / limit each group: checked
Priority: 10

Random Pools - Autoadd settings:
"Playlist patterns" set to "Random*"
"Add, when the playlist had X items or less" set to 1
"Add, when the playback position is X items..." set to 1


then i name a playlist Random1, manually populate the 1st pool, File -> Random Pools -> Album-Pop/Rock, and hit play.  Once playback starts, foo_random_pools will monitor that playlist (based off my settings above).

after each album plays down to the last track a new random album will be en queued to the playlist.
thus creating the virtual changer effect.

there are tons of stuff you can do with the plugin, this is just one example.
Title: foo_random_pools
Post by: hesher on 2010-07-10 00:08:42
one of my favorite ways to use it is as a virtual album changer [in conjunction with foo_removeplayed (basically just removes songs from the playlist after they finish playing)].

Example Random Pool:
Code: [Select]
Name: Album-Pop/Rock
Group: %album artist% - %date% - %album%
Number of groups to add: 1
Filter: (NOT %album artist% IS "Various Artists") AND (%genre% IS Pop/Rock)
Limit: 0, 0, 0, unchecked
Sort: %path_sort%
Sort / limit each group: checked
Priority: 10

Random Pools - Autoadd settings:
"Playlist patterns" set to "Random*"
"Add, when the playlist had X items or less" set to 1
"Add, when the playback position is X items..." set to 1


then i name a playlist Random1, manually populate the 1st pool, File -> Random Pools -> Album-Pop/Rock, and hit play.  Once playback starts, foo_random_pools will monitor that playlist (based off my settings above).

after each album plays down to the last track a new random album will be en queued to the playlist.
thus creating the virtual changer effect.

there are tons of stuff you can do with the plugin, this is just one example.

Great Example! Thanks!
Title: foo_random_pools
Post by: Bodhi on 2010-09-05 22:04:01
fbuser a billion thanks, I was looking for that for a long time!

Title: foo_random_pools
Post by: Sixth Street on 2010-09-06 17:29:56
Just started playing around with this component, it is great!

How would I go about populating a new playlist with one random album from each genre in my library?
Title: foo_random_pools
Post by: q-stankovic on 2010-09-06 17:39:23
Not possible because that would require not only one group but also a subgroup.
Title: foo_random_pools
Post by: Sixth Street on 2010-09-06 17:55:06
Not possible because that would require not only one group but also a subgroup.


That's what I was suspecting.  Thanks for the quick reply though.  As a workaround, I just setup a pool for each genre I have and then manually select each one from the random pools menu to populate.  Not as elegant as what I was hoping for, but plenty good enough.

This is great for iPod syncing with foo_dop.

Much thanks to the dev!
Title: foo_random_pools
Post by: q-stankovic on 2010-09-06 18:51:21
I remember that the @limit function inside playlist tree gave the opportunity to create such queries. Fbuser, what dou you think about field for a subgroup and a sub-subgroup (no more, no less ) - that would make possible fancy queries


... with one random album from each genre in my library?
Another request: easy option to choose all groups
Title: foo_random_pools
Post by: Bodhi on 2010-09-07 10:29:47
Hi,

Is there a limitation in MBs?
It works fine until I chose a limitation big enough. If I pick, for example, a limitation of 5000 MBs, There's not even 1000MBs of tracks (group = %track%)!

Thank you!
Title: foo_random_pools
Post by: fbuser on 2010-09-11 12:28:33
Is there a limitation in MBs?
No, fixed in 0.0.2.3. See first post for download.
Title: foo_random_pools
Post by: Bodhi on 2010-09-11 12:35:24
Great, thanks!
Title: foo_random_pools
Post by: laite on 2010-09-21 15:08:42
First of all, let me say that I really like this component. Along with foo_scheduler it is probably most essential component to my listening. That said, I have two suggestions:

1. How about making autoadding choose possible pools depending on what playlist is active. For example, if it's "random tracks", foo_randompools would pick only from pools named with TR_* (or perhaps some pool specific option at which playlists they attend to).

2. I would like to see somekind of simple "master query" in options. For example, I have quite complex system with ratings, playcounts, hyped statuses and so on with my pools. Sometimes though, I would only like to listen certain type or aged music and easiest way that comes to my mind is that on options-page I coul write something like '%genre% HAS "metal"' and it would automatically be added to every poolquery. So, if my "%rating" EQUAL 3" was selected (randomly) the whole query would be '%genre% HAS "metal" AND %rating% EQUAL 3'. Does this make sense?

The component is sufficient the way it is, but I think these improvements would make it even better.
Title: foo_random_pools
Post by: TakuSkan on 2010-10-05 09:25:16
I'm terrible at figuring out code to get FB2K to work for me.  Could someone tell me if  it would be possible to write code for foo_random_pools that would target directories with large numbers of files, and then set a low playback priority for them in the 'Random Pool' preferences?

I like to have FB2K play tracks from my entire library at random.  But the problem is that even with a randomized playlist, and 'Shuffle (tracks)" set, FB2K tends to play the artists more frequently with large numbers (complete discographies) of files.

I've experimented with foo_random_pools, and have found something that works.  I can create a pool for, say all 'Rock' genre  tracks, but that excludes an artist with a huge number of files, with a high priority:

(%path% HAS "\MP3s\Rock-Pop") AND (NOT %artist% IS "UB40")
Priority: 30

Then I can create another pool that loads that artist, and sets its priority low:

%artist% IS UB40
Priority: 1

I could create a separate pool for each artist with large numbers of tracks, and set the priority of each low.  And then go into the pool that plays all files, and add every artist that has high numbers of tracks.

But that seems like more work than should be needed.  Is it possible to write code that limits playback based on the number of tracks in an artist's folder/subfolders?

That would just require two pools:

1 – One with artists with less than say 100 tracks set to a high priority
2 – One with artists with more than 100 tracks set to a low priority

Title: foo_random_pools
Post by: fbuser on 2010-10-05 20:38:57
Just create only one pool with using %artist% as your group definition and %path% HAS "\MP3s\Rock-Pop" as your filter. Then for each artist you will get the same probability to get picked, independent from the number of tracks you have for an artist.
Title: foo_random_pools
Post by: TakuSkan on 2010-10-06 06:48:41
Wow... this is closing in on something I've been thirsting for since the 1st copy of Winamp ever released.  As you suggested, I set %artist% as my group definition, but dropped 'Rock-Pop' and set %path% HAS "\MP3s" as a filter for my entire library.

I say 'closing in' because, while I am getting few if any repeat artists played with things configured as you suggested, I'm finding that foo_random_pools seems to dwell within some folders more than others.

I played about a half hour's worth of my entire library, and noticed that I was hearing a lot of tracks from my 'World' folders.  And I was hardly hearing any classical tracks at all.  I have a foo_np_simple script logging everything FB2K plays.  So I opened the log file and ran searches to see how many files from each genre's top folder were played.

I should point out that I only set foo_random_pools to add 1 track to the queue at a time.

I won't post all the results, but here's enough to make a point:

Code: [Select]
  Play    Total  Folder 
  Count   Files

    12    402:  Miscellaneous MP3s 1
    31    557:  Miscellaneous MP3s 2
    6     1840: Classical (Choral)
    7     655:  Classical (Instrumental)
    6     416:  Classical (Vocal)
    2     323:  Country
    51    4651: Folk-World
    7     448:  Jazz
    6     50:   Jazz Collections
    10    48:   Jazz Webcasts
    13    183:  Pop FM Broadcasts
    34    7960: Rock-Pop
    42    656:  Rock-Pop Collections
    8     109:  Soundtracks
    72    835:  World
    --
    324 Total played (genres with only few files not listed above)
.


Look at the proportions:

Out of 835 files in the 'World' folders, 72 of them were played.
Out of 1840 classical choral files, only 6 were played
Out of 655 classical instrumental files, only 7 were played
Out of 414 classical vocal files, only 6 were played

Then look at the numbers for the 'Rock-Pop' files, and the 'Rock-Pop Collections' play counts:

Out of 7960 'Rock-Pop' files, 34 were played.
Out of only 656 'Rock-Pop Collections', 42 were played. 

That one really startled me.  I'll test this a bit more, but I guess with a little code added to set priorities, I can level things out.

After about 1/2 hour of normal playback, I started to skip forward to quickly play the next queued tracks (a total of 324).  Without waiting the 60 seconds FB2K requires to recognize them as having been 'Last Played', foo_random_pools would sometimes queue the same file again, or queue another track from the same album folder.  Not a problem with normal playback, but it makes it a little hard to evaluate performance. 

I'm still not clear on a few aspects of this component, but I'll hold off on questions until I've played with it a bit more.  Overall it's really a fantastic tool for customizing random track playback.  Thanks for all your effort on this fbuser.

Title: foo_random_pools
Post by: fbuser on 2010-10-06 19:02:12
Wow... this is closing in on something I've been thirsting for since the 1st copy of Winamp ever released.  As you suggested, I set %artist% as my group definition, but dropped 'Rock-Pop' and set %path% HAS "\MP3s" as a filter for my entire library.
This is a different scenario and so the results you described are not very suprising. If you want to equalize the results for the folders you should use $directory(%path%) as group and for using all tracks of your entire library you can leave the filter empty. If you have any subfolders in your folders, it will not work as described, but can be adjusted.

Without waiting the 60 seconds FB2K requires to recognize them as having been 'Last Played', foo_random_pools would sometimes queue the same file again, or queue another track from the same album folder.
'Last Played' and foo_random_pools are not related at all. foo_random_pools does not have any memory, therefore it can happen, that the same file will be picked twice in a row.

Title: foo_random_pools
Post by: TakuSkan on 2010-10-06 20:08:06
...you should use $directory(%path%) as group and for using all tracks of your entire library you can leave the filter empty.

I'll give that a try.

Quote
If you have any subfolders in your folders, it will not work as described, but can be adjusted.

Under each genre's main subfolder under \MP3s I used to have separate folders for each 'artist - album'.  But as the library grew over the years, I began to create a single folder for some artists, and group that artist's albums in sub-directories on that one.  So you're saying that will require some tweaking?

Would that mean creating a pool for each genre's folder, and setting a priority for each?
Title: foo_random_pools
Post by: fbuser on 2010-10-07 20:32:07
Would that mean creating a pool for each genre's folder, and setting a priority for each?
That could be solution. It is not necessary, if you are able to describe the structure of your folders with one title format expression. Basically, it should be possible, but the expression might become complicated.
Title: foo_random_pools
Post by: TakuSkan on 2010-10-08 10:10:47
Could you just lay out a brief abstract of what needs to be done here?  I'm not at all clear on why changing the group and filter as we did here changed the whole dynamic of what's going on.  This thread is about the only source of information on this component... si/no?
Title: foo_random_pools
Post by: fbuser on 2010-10-08 19:02:28
Could you just lay out a brief abstract of what needs to be done here?
Mainly you need to find a title format expression for grouping, which matches your root folders. Something like $puts(Remainder,$stripprefix(%path%,<your base path>))$left($get(Remainder),$sub($strchr($get(Remainder),\),1)) could be a starting point, maybe it already works.


I'm not at all clear on why changing the group and filter as we did here changed the whole dynamic of what's going on.
The filter is used to restrict the tracks of the media library before building the groups. For each track of the media library, which is not filtered out by the filter expression, the group expression is evaluated. All evaluations with the same value are building one group. Normally one such complete group will be randomly picked, but this behaviour can be customized by several attributes, e.g. you can limit the picking to only one track per group. So, for your described cases it should be obvious, that using %artist% as group leads to a different result than using $directory(%path%) as a group.

This thread is about the only source of information on this component... si/no?
Besides the help file, most probably yes.


Title: foo_random_pools
Post by: TakuSkan on 2010-10-09 23:08:16
Something like $puts(Remainder,$stripprefix(%path%,<your base path>))$left($get(Remainder),$sub($strchr($get(Remainder),\),1)) could be a starting point, maybe it already works.

Well if one of the main purposes of this component for me is to avoid constantly playing tracks by artists I have huge numbers of files for, after a quick test, that code seems to do just the opposite.

I'll try to read up on those title formatting values and see if I can figure out what they do and how to tweak things to work for me.
Title: foo_random_pools
Post by: fbuser on 2010-10-10 09:00:19
the main purposes of this component for me is to avoid constantly playing tracks by artists I have huge numbers of files for, after a quick test, that code seems to do just the opposite.
This code is not meant to do this. It is meant to balance the groups determined from different folders. If you want to balance the groups determined from different artists, you have to go back to use just %artist% as group. You need to decide for one of these. Both together is logically not possible.
Title: foo_random_pools
Post by: TakuSkan on 2010-10-12 04:22:58
If you want to balance the groups determined from different artists, you have to go back to use just %artist% as group

If I could set %artist% as the group, and then as a filter, set a path for each genre I have folders for, and then set a priority for each within the filter code string, I think I could accomplish what I'm after. 

But even though Wooops suggested that it should work in an earlier post, (http://www.hydrogenaudio.org/forums/index.php?showtopic=77460&view=findpost&p=704128) apparently I can't set more than just one path as a filter.  For instance this filter will lock up FB2K:

(%path% HAS "\MP3s\Blues") AND (%path% HAS "\MP3s\Country")

And then there'd still be the problem of setting a priority for each within the script.
Title: foo_random_pools
Post by: carpman on 2010-10-12 05:01:15
For instance this filter will lock up FB2K:

(%path% HAS "\MP3s\Blues") AND (%path% HAS "\MP3s\Country")

I'm not surprised. This expression would only return results if you had music in a directory structure (path) like so:
...\MP3s\Blues\MP3s\Country\*

Surely: (%path% HAS "\MP3s\Blues") OR (%path% HAS "\MP3s\Country")

C.
Title: foo_random_pools
Post by: TakuSkan on 2010-10-12 12:05:14
Surely: (%path% HAS "\MP3s\Blues") OR (%path% HAS "\MP3s\Country")

!OR! ... Yes... That makes much more sense.  Thanks for explaining that carpman.

That let's me combine 3-4 folder paths into one of 4 pools.  Each with %artist% as 'Group' and with priorities set to either 1, 5, 10, or 15.  That gets me closer to what I'm looking for.

It would be nice if it was possible to put all folder paths into the filters of one pool, and then set a priority for each.  Would FB2K code formatting prohibit that?
Title: foo_random_pools
Post by: tempman on 2010-10-13 17:42:28
Thanks for this great plug in!  I use it with autoadd in the way described by mrinferno above: http://www.hydrogenaudio.org/forums/index....st&p=713114 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77460&view=findpost&p=713114)

I would really like the ability to be able to specify priorities dynamically: e.g. %rating%*100 + %play_count%

An even bigger (?) feature request is to have different priority ratings for different playlists (and autoadd).  For example I would like to be able to have a pop/rock autoadd list and a separate classical/jazz autoadd list.  At the moment I think autoadd behaves the same way towards all playlists that match the playlist pattern.

Cheers!
Title: foo_random_pools
Post by: fbuser on 2010-10-15 16:59:46
I would really like the ability to be able to specify priorities dynamically: e.g. %rating%*100 + %play_count%
Besides that I don't see any real use for the example, it doesn't make any sense anyway. You cannot apply track based calculations to groups.

An even bigger (?) feature request is to have different priority ratings for different playlists (and autoadd).  For example I would like to be able to have a pop/rock autoadd list and a separate classical/jazz autoadd list.
At the moment I don't plan to implement something like this, but maybe in the future.
Title: foo_random_pools
Post by: carpman on 2010-10-20 00:50:44
Hi fbuser

I don't know how hard this would be to do, but what I'd really like is the ability to easily switch on/off pools, yet keep the same All Pools weightings ("priorities"), but only have those priorities apply to selected pools. Like so ...

(http://www.giantpygmy.net/stuff/foo_randompools_mockup.png)

At present if I want, for example, 3 complimentary (e.g. gentle background music) pools to randomly play, I have switch the priority of all non suitable pools to 0, which is a pain, then later switch them back to whatever they were before, which I can never remember. Easier to simply tick and untick and have a select all / select none right click option.

Just an idea, what do you think?

C.

EDIT: for clarity.
Title: foo_random_pools
Post by: Yaris on 2010-10-21 22:43:32
Nice plugin, thanks 
I want to random select individual songs. When I use %title% as Group,  tracks which are more than once on the disc appears on the playlist multiple times
Title: foo_random_pools
Post by: mrinferno on 2010-10-21 23:51:04
try %filename% as the group.
set limit number of tracks to add: 1
Number of groups to add: [number of tracks you want in the playlist]
make sure "sort / limit each group" is checked.

that works well for me.

for Group you need to use a unique field or you'll get duplicates.

Nice plugin, thanks 
I want to random select individual songs. When I use %title% as Group,  tracks which are more than once on the disc appears on the playlist multiple times

Title: foo_random_pools
Post by: スラッシュ on 2010-11-22 16:23:39
I totally love this component, it's great! Very intuitive to work with and it really does what it should.

I guess this might've been already suggested, but it would be awesome if you could auto-add different things into different playlists. Ie. I have a playlist called "pool|ranked" where it sends a weighted-random item based on %ranking%, but I'd also like a playlist where I get a "pool|DAR" weighted-random item based on DAR rating. Maybe I just didn't understand correctly and I'm doing it wrong, though?
Title: foo_random_pools
Post by: fbuser on 2010-11-22 17:36:20
I guess this might've been already suggested, but it would be awesome if you could auto-add different things into different playlists
Yes five posts (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77460&view=findpost&p=726772) above yours  ;)
Title: foo_random_pools
Post by: スラッシュ on 2010-11-22 17:54:42
That's what I get for reading the first few pages and going "I'll just post this..."
Title: foo_random_pools
Post by: Ephoras on 2011-03-11 00:54:37
hell, i think i m rly dumb, because i don't get it to work at all.

i installed the component
Went to menu -> Random Pool
Hit Add...
Name: Sony Walkman
Group: %libary%
Number of groups to add 0
Filter: %rating% GREATER 2
Number of MBs to add: 6840
Priority: 10

Autoadd
Plalylist patterns: All Music
Add, when playlist has X items or less: 1
PLaybback position: 0


In my opoinion i should somewhere get a playslist that has all songs with rating greater 2.

But i can't find it...

What i want do have, if someone wants to give me the code:
A playlist that has a maximum file size of 6,84GB
and includes only songs with rating 3, 4 and 5

i hope someone can help me
Title: foo_random_pools
Post by: carpman on 2011-03-11 08:04:05
Group: %libary%
Number of groups to add 0

You're telling it to search ALL tracks (Group: %libary%) BUT not add any (Number of groups to add 0).
This needs to be at least 1 in general and in your case:

Code: [Select]
Number of groups to add 1

And for tidyness sake you could change %libary% to %library% (but this makes no difference, as you've realised if you make up a %field% that doesn't exist it will search all tracks).

C.
Title: foo_random_pools
Post by: Ephoras on 2011-03-11 11:04:35
thanks, it works now;)

My main problem was that i needed some hours of sleep to figgure ot how to create the playlist it self, i think;)

works fine now;)
Title: foo_random_pools
Post by: prashantv on 2011-03-17 23:27:42
Is it possible to sort in descending order?
Title: foo_random_pools
Post by: Ephoras on 2011-03-22 11:43:41
Hell it still does not work the way i want it to.

My current config for random pool is:
Name: Sony Walkman
Group: %library%
Determine probability for picking groups based: Unchecked
Number of groups to add: 1
Filter: %rating% GREATER 2
Priority: 1
Limit: Numbers of MBs to add: 7800
Limit after Sorting: Unchecked
Sort: empty
Sort/Limit each group: uncheced


%rating% GREATER 2 contains around 10GB of files
But i can only store around 7,8GB on my player

So, i create an empty playlist
Hit random pools...Sony Walkman
Foobar adds files to the playlist
But always just 6-7GB not 7,8 gb

what am i doing wrong?
Title: foo_random_pools
Post by: fbuser on 2011-03-22 21:04:40
Which size have the files you are going to add to the playlist? If you have encoded complete albums into one file with a lossy format, it could explain your results as the limit will never be exceeded and the fillling algorithm will also not try to come as close to the limit as possible. If the next random track to be chosen during the filling would exceed the limit, nothing more will be added and the filling is considered as complete.

What are the values for "Number of tracks to add" and "Number of minutes to add"?

BTW, the expected result should be about 7,6GB as 7800MB=7,6 GB.
Title: foo_random_pools
Post by: Ephoras on 2011-03-22 23:12:24
thank you,
i had 1 loosless album in the filter, that seemed to be the problem.

The GB size was just entered random because i did not know how much space the sony has free.

NUmber of tracks and Number of of minutes are: 0 (no limit)


I started a new topic for some more questions  because i don't want to spam this threat any longer;)

pls have a look at it: http://www.hydrogenaudio.org/forums/index....showtopic=87627 (http://www.hydrogenaudio.org/forums/index.php?showtopic=87627)
Title: foo_random_pools
Post by: mrinferno on 2011-04-02 13:02:44
hi fbuser,
I was just rereading through the thread, haven't been around in a while.
any chance you have considered carpman's suggestion in post #77 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77460&view=findpost&p=727642)?

I have been hoping for a quicker way to enable/disable the all the various pools I have created depending on my listening mood.
Alternatively, perhaps if there was a way to tie specific pools/priorities to unique Autoadd playlist patterns.

If it's too much effort or not feasible, that's cool.  Totally love the plugin the way it is.



Title: foo_random_pools
Post by: Ephoras on 2011-04-20 08:11:46
Hi,
anyone here who wants to help me?

I currently have randompools set up to create a 6.97GB playlist with songs %Rating% GREATER 2.
THat on is quite fine, but i have much more rating 3 songs than 4/5, so there are more of them in the playlist.

What i want to have:
A playlist that first puts in all rating 4/5 Songs
But never more than 5.00GB (no exact 5gb needed, just in this range)
FIlls the rest with rating 3 songs


HOw can this be done?
Just by 2 random pool setups?
THe problem is currently i don't have 5gb of 4/5 songs, so the setup has to be dynamic

I hope this works via sorting or such, but i don'T get it to work right....

Ephoras
Title: foo_random_pools
Post by: trebordean on 2011-04-21 12:28:38
I have my random pools selecting from an autoplaylist of tracks that have never been played.

When I add some of these tracks into my random pool playlist, some tracks indicate as being played.

Is this because random pools merely looks for a track name in the playlist, but doesn't differentiate the actual non played track in the autoplaylist from an identical one appearing on another album which has already been played?

Regards,

trebordean.
Title: foo_random_pools
Post by: fbuser on 2011-04-21 16:10:08
I have my random pools selecting from an autoplaylist of tracks that have never been played.
No, you don't. Random pools is selecting always from the media library, never from a playlist.

Is this because random pools merely looks for a track name in the playlist,
No, it looks for the tracks in the library which matches your group and filter epressions.

but doesn't differentiate the actual non played track in the autoplaylist from an identical one appearing on another album which has already been played?
If you are using foo_playcount to determine wether a track was played or not, it's probably caused by the behaviour of this component to consider such kind of tracks to be identical. But without knowing more details (at least the group and filter expression) this is only a guess, which wouldn't actually explain, why already played tracks are selected at all.

Title: foo_random_pools
Post by: trebordean on 2011-04-22 17:57:40
fbuser,

Under the playlist patterns section, a dropdown list gives me all my playlists. I merely selected one of those.

I do use the playcount component.

Regards,

trebordean
Title: foo_random_pools
Post by: tpijag on 2011-04-22 18:20:13
Tracks are selected by whatever definition you provided in the ADD random pool dialog. If that definition does not filter out played tracks, you get played tracks.

The playlist patterns drop down section has noting to do with track selection.

From documentation
Quote
Autoadd - Playlist patterns: Various wildcard patterns separated by ; can be entered here for matching a playlist name. If the name of the currently playing playlist matches one of these patterns, entries from a random pool with a priority unequal to zero will be added to the playlist, if one of the following two conditions is true:
Title: foo_random_pools
Post by: e11 on 2011-05-10 22:53:19
Thanks for the reply. I got it now.
So basically All Pools is a lucky dip where you pick one pool from all the pools - which matches with the results I've been getting.

In which case I have a feature request.
Can you have a Run All Pools (except for those with a priority of 0) feature. This would be the equivalent of manually selecting each of the pools in the list.

Because so far what foo_random_pools can't do is provide a selection of tracks from a number of varied criteria, and this would allow for that, because you've made is easy to set the limits on each pool quite small (i.e. just a few tracks). So you can have a little of this, a little of that and a little of the other. 

Cheers,

C.


Any news on this feature, would be ideal for creating streaming radio stations eg.. Having a pool for rock, pop and rap and having one track from each pool added to the playlist simultaniously, would be awsome
Title: foo_random_pools
Post by: carpman on 2011-05-11 11:09:49
I'm pretty much satisfied with foo_random pools in this regard. There is a way to get weighted random playlists but in a sense only on the fly. The way I do it is as follows:

I've got something like 30 queries, each selects only one track. These are added to a playlist called random, which updates when there are less than 3 tracks in it (there's a reason for that number -- i.e. if a pool yields no tracks which is possible then the playlist doesn't breakdown with no tracks to play, additionally if you make the number too large then the possibility of duplicate tracks increases).

So then you can adjust the probabilities.

Additionally, the use of Hotness as a variable %last_played% filter in conjunction with DAR (see here (http://www.hydrogenaudio.org/forums/index.php?showtopic=87111&view=findpost&p=747286)), comes in very handy as a way to filter in conjunction with foo_random_pools.

Hope that helps.

C.
Title: foo_random_pools
Post by: e11 on 2011-05-11 11:40:19
Mabey im miss understanding the settings but, i want 3 pools and one track from each pool to be added when there is only one track left in the playlist. As far as i can see tracks are only added from one pool at a time.

eg..

Title: Pop
Group: %LIBRARY%
No of Groups: 1
Filter: %GENRE% IS Pop AND %RATING% GREATER 3
No of tracks to add: 1
Priority: 1

I repeat this for Rap and rock so i have 3 pools, 1 for each genre, I would like autoadd to add one track from each pool when there is less than 1 item on the playlist.
Is this Possible?

Edit: i would also like the tracks to be added in the order that the pools appear in the pools list
Title: foo_random_pools
Post by: fbuser on 2011-05-11 21:41:33
Mabey im miss understanding the settings but, i want 3 pools and one track from each pool to be added when there is only one track left in the playlist. As far as i can see tracks are only added from one pool at a time.
Yes, this is basically correct. There is an easy but only manual solution: Assign to all relevant pools, which you have defined, the same keyboard shortcut. Another more complex solution, which adds more than one pool automatically, could be to utilize function on_playlist_items_removed(playlist, new_count) {} within foo_uie_wsh_panel_mod together with "Remove played tracks" from foo_playlist_attributes.
Title: foo_random_pools
Post by: e11 on 2011-05-12 06:59:18
Ha that works
thankyou very much
Title: foo_random_pools
Post by: Marc27 on 2011-06-08 04:43:12
@e11
You may want to check out foo_random, Randomized playlist entries (http://www.hydrogenaudio.org/forums/index.php?showtopic=36632&st=0) as well. From it's description "Pseudo-radio station that plays songs from your media library." Try adding more than one random playlist entry.
Title: foo_random_pools
Post by: fuffi on 2011-11-29 22:45:29
foo_random_pools is a foobar2000 component for creating random playlist  entries selected and grouped by various pool definitions.

Wow, this is a powerful tool. Thank you! Brings fun and forgotten music back to my life ;)

Just three feature requests:

1)
(http://www.bilder-hochladen.net/files/hcyg-1h-9a11.png) (http://www.bilder-hochladen.net/files/hcyg-1h-9a11-png-nb.html)
Inline Editing.
I double-click on the "0" on field "Priority" and can just edit the number, instead of opening the "Random pool" Window, change the priority and close the window again. Would save some time and will help to easy change priorities for testing purposes IMHO.


2)
I encountered, that if all entries have priority 0, the first entry of the list will be chosen automaticly, when plugin is called via autoadd.

Sometimes i don't want the plugin to do its job, so i'd like to disable it. there seems not to be an easy way to do this.
Might it be a way to add an
  • active[/b] checkbox to each entry, so the user can enable/disable entries as he/she likes?
    that way i could disable all entries and therefore your fine plugin would have some rest.

    Or maybe a single
    • Enable plugin[/b] Checkbox in the main config window?

      3)
      Duplicate an existing entry so i could easily add/change some settings without retyping (or copy&paste) all the settings from another entry.


      cheers,
Title: foo_random_pools
Post by: ainz on 2011-12-22 22:47:28
I'm using this plugin to add whole albums as per mrinferno's example (http://www.hydrogenaudio.org/forums/index.php?showtopic=77460&view=findpost&p=713114).

I've got tracks in my library with ALBUM ARTIST set empty, e.g. white-labels that don't correspond to any release on Discogs. Because of the fallback behaviour of ALBUM ARTIST, these single tracks get picked by my album pool, and I don't want them to. I can't test if ALBUM ARTIST is not empty in the filter query, e.g. using NOT %ALBUM ARTIST% IS ? because of the fallback behaviour of ALBUM ARTIST which finds the track-level artist tag value instead.

Do I have to go tag all these rogue tracks with an ALBUM ARTIST value e.g. 'Unknown Album' and test against that, or remove their ALBUM ARTIST tags completely and test for %ALBUM ARTIST% PRESENT... or is there a better way of achieving what I want?

I'm thinking someone here has probably come across this problem already... TIA.
Title: foo_random_pools
Post by: fbuser on 2011-12-23 14:45:51
Use album artist PRESENT (withouth %)
Title: foo_random_pools
Post by: ainz on 2011-12-24 12:11:21
Use album artist PRESENT (withouth %)


Ah, I'd overlooked the remapping being optional, thanks.
This relies on single-artist albums all having ALBUM ARTIST set, and thus not relying on remapping though.
Title: foo_random_pools
Post by: ainz on 2011-12-26 10:34:52
Didn't explain myself well in that last post... for this to work as intended, ALBUM ARTIST would need to be explicitly set on single artist releases, contrary to the encouraged tag standards (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Encouraged_Tag_Standards)...
Title: foo_random_pools
Post by: ainz on 2011-12-26 11:42:46
Didn't explain myself well in that last post... for this to work as intended, ALBUM ARTIST would need to be explicitly set on single artist releases, contrary to the encouraged tag standards (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Encouraged_Tag_Standards)...


Ah, setting the group to %DIRECTORYNAME% does the trick.

This is a good component, it's got me listening to stuff I'd long forgotten!
As stated by someone previously, checkboxes to enable/disable pools individually would be handy.
Title: foo_random_pools
Post by: delusion on 2012-01-16 22:38:39
hey there, thanks for this nice plugin.

could someone give me a tipp, what's wrong with my filter expression shown below.
i try to add 200 tracks, max 1 per album and limited to NOT PLAYED DURING LAST 4 DAYS.
But with my used filter expression, it doesnt work. the expression for NOT PLAYED DURING LAST 4 DAYS is not been considered.

Group: %album%
Nr.ofGroups2Add: 200
Filter: (%path% HAS "\COLLECTION\") AND ((%genre% IS Electronic) OR (%genre% IS Dance) AND NOT (%last_played% DURING LAST 4 DAYS))
Limit Nr.ofTracks2Add: 1
Sort: $rand()
Sort/LimitEachGroup: Checked

Hope someone could help me out with this.
Thanks for this awesome plugin! fb2k is what you make of it!
greets, dls
Title: foo_random_pools
Post by: carpman on 2012-01-17 01:16:10
Filter: (%path% HAS "\COLLECTION\") AND ((%genre% IS Electronic) OR (%genre% IS Dance) AND NOT (%last_played% DURING LAST 4 DAYS))

Should be:

Code: [Select]
(%path% HAS "\COLLECTION\") AND ((%genre% IS Electronic) OR (%genre% IS Dance) AND (NOT %last_played% DURING LAST 4 DAYS))


assuming you want:

files where path has collection and genre is either electronic or dance and the files have not been been played in the last 4 days.

C.
Title: foo_random_pools
Post by: carpman on 2012-01-18 01:38:07
Actually thinking about it, your method may only apply "NOT %last_played% DURING LAST 4 DAYS" to "%genre% IS Dance". So you probably want to bundle the %genre% stuff together but not nest the %last_played%, like so:

Code: [Select]
(%path% HAS "\COLLECTION\") AND (%genre% IS Electronic OR %genre% IS Dance) AND (NOT %last_played% DURING LAST 4 DAYS)

C.
Title: foo_random_pools
Post by: delusion on 2012-01-26 21:06:09
thanks a lot, carpman! this was the fault. i'm not that experienced with coding... just for foobar-purposes.
Title: foo_random_pools
Post by: delusion on 2012-02-12 22:08:09
another question regarding my upper posting...

how could i change the settings to add 720 minutes of Tracks instead of an amount of 200?

Title: foo_random_pools
Post by: -AdZero- on 2012-04-27 06:22:10
Hi !

I have some pools configured as below :

(http://img220.imageshack.us/img220/5985/foorandompools1.png)

When there is no group returned by the first pool (because the is no more match) with priority 100, nothing is added to my playlist. I think the problem will be the same when an other pool will be empty.

Can you confirm that's the intended behavior ?
Is there a way to automatically switch to an other pool when the one chosen with priorities returns nothing ? If not, is it possible to add this feature ?

Thank you.
Title: foo_random_pools
Post by: fbuser on 2012-04-27 19:57:17
Can you confirm that's the intended behavior?
Is there a way to automatically switch to an other pool when the one chosen with priorities returns nothing ? If not, is it possible to add this feature ?
That's funny. I recently stumbled also over this behaviour and changed it already. An updated version, which covers this together with a bugfix is available.
Title: foo_random_pools
Post by: -AdZero- on 2012-04-30 07:51:33
Thanks for the update.

Unfortunately the problem still occurs.
Each pool is configured to return one album based on some filters (based on %added% and %play_count% values).
When I delete the content of my targeted playlist, a new album is added or it is left blank (seems like the first pool has been chosen).

Let me know if you want more details.
Title: foo_random_pools
Post by: fbuser on 2012-04-30 19:11:35
When I delete the content of my targeted playlist, a new album is added or it is left blank (seems like the first pool has been chosen).
I can't confirm this. Works perfectly here.

Let me know if you want more details.
Did you actually update to the latest version (0.1.1)?
Is it ensured, that at least one pool with priority != 0 returns a result?
What are your pool definitions?

Note: Depending on your library size it might need some seconds, before a pool with lower priority will be added to the playlist.
Title: foo_random_pools
Post by: -AdZero- on 2012-04-30 20:55:48
Did you actually update to the latest version (0.1.1)?

I have missed something... I used components update check to update but I haven't checked the version after restart.
Now I have checked and the displayed version of the component is still 0.1.0.

I tried a manual update with the zip file but it's the same version number displayed.

Is it ensured, that at least one pool with priority != 0 returns a result?

Yes, it's absolutely sure. If I change the priority of my pool with no results (the first one) to 0, the target playlist is always filled.

What are your pool definitions?

Group : %album artist%-%album%
Filter : %play_count% MISSING OR %play_count% IS 0
Priority : 100

Group : %album artist%-%album%
Filter :  %play_count% IS 1 AND NOT %last_played% DURING LAST 4 DAYS
Priority : 50

Group : %album artist%-%album%
Filter : %play_count% GREATER 1 AND %added% DURING LAST 60 DAYS AND NOT %last_played% DURING LAST 4 DAYS
Priority : 10

Group : %album artist%-%album%
Filter : %path% HAS "Audiothèque" AND %filename_ext% HAS ".flac" AND %added% DURING LAST 365 DAYS
Priority : 30
Title: foo_random_pools
Post by: fbuser on 2012-04-30 22:08:29
Did you actually update to the latest version (0.1.1)?

I have missed something... I used components update check to update but I haven't checked the version after restart.
Now I have checked and the displayed version of the component is still 0.1.0.
Aargh. I tried to upload the archive as fb2k-component-archive, which was rejected, but I didn't notice the relevant error message. Now, the latest version is actually uploaded.
Title: foo_random_pools
Post by: D.Sync on 2012-05-14 19:13:16
The concept for this plugin is great.

I had the following setting set to create a playlist with a mixture of Doujin from Final Fantasy and Chrono Trigger, but when go to File > Random Pools > All Pools nothing seemed to happen? Can anyone explain the basic behaviour of this plugin?

(http://i179.photobucket.com/albums/w306/DeoxySynchro89/th_03May150210.jpg) (http://s179.photobucket.com/albums/w306/DeoxySynchro89/?action=view&current=03May150210.jpg)

Edited: Well it seemed that I will have to manually click the Pool name instead of All Pool for it to work.
Title: foo_random_pools
Post by: Andreasvb on 2012-05-14 20:22:23
The concept for this plugin is great.

I had the following setting set to create a playlist with a mixture of Doujin from Final Fantasy and Chrono Trigger, but when go to File > Random Pools > All Pools nothing seemed to happen? Can anyone explain the basic behaviour of this plugin?

(http://i179.photobucket.com/albums/w306/DeoxySynchro89/th_03May150210.jpg) (http://s179.photobucket.com/albums/w306/DeoxySynchro89/?action=view&current=03May150210.jpg)

Edited: Well it seemed that I will have to manually click the Pool name instead of All Pool for it to work.

Set Priority higher than 0.
Title: foo_random_pools
Post by: D.Sync on 2012-05-15 06:13:11
The concept for this plugin is great.

I had the following setting set to create a playlist with a mixture of Doujin from Final Fantasy and Chrono Trigger, but when go to File > Random Pools > All Pools nothing seemed to happen? Can anyone explain the basic behaviour of this plugin?

(http://i179.photobucket.com/albums/w306/DeoxySynchro89/th_03May150210.jpg) (http://s179.photobucket.com/albums/w306/DeoxySynchro89/?action=view&current=03May150210.jpg)

Edited: Well it seemed that I will have to manually click the Pool name instead of All Pool for it to work.

Set Priority higher than 0.


Gee thanks. I really did overlooked that part.
Title: foo_random_pools
Post by: D.Sync on 2012-05-15 11:20:19
BTW is there any way to add the Random Pool into the Context Menu? E.g. right click on an empty playlist, then select the Random Pool to add. I had created a bunch of Random Pools and just hate to go to the File menu > Random Pools > Selection just to add it to the playlist. I thought of assigning keyboard shortcut but it's not too viable to assign each to every pool.
Title: foo_random_pools
Post by: q-stankovic on 2012-06-03 20:48:57
Hi fbuser,

could you explain what the new option "Filter with the content of target playlist" exactly do? I understood the help-file that just duplicate files would be removed - no more, no less! Right? Will the removed tracks be replaced by others?
Title: foo_random_pools
Post by: fbuser on 2012-06-03 21:09:44
The use of "removed" might be a little bit misleading here, although filtering is just removing certain parts from a total quantity. But using remove in this sense, the answers for the last two questions are: Yes, No.
Title: foo_random_pools
Post by: richard123 on 2012-07-06 21:53:08
I'd like to create a playlist of randomly chosen albums, not more than 1000mb in total size, from the playlist named PL2.

I can do everything other than restrict the chosen albums to those in PL2.  Is there some way to do this?

Group: %album%
Number of groups: 999
Number of MBs: 1000
Limit after sorting: checked

everything else unchecked, empty or 0
Title: foo_random_pools
Post by: Skelington on 2013-02-13 15:12:24
I realise this is an old thread but I've just discovered Random Pools and think it has great potential.

I wondered if anyone could help me set it up to create a playlist, in reverse order of the date I added the album to the PC, so the last album appears first in the list and runs for my entire library. My library is on a network so it would be handy to know how to set it up so that both networked PC's (running Foobar) had the same setup as the host PC.

I've seen this added to a 'skin' but never managed to work out how it was done (it wasn't via Random Pools but I thought this would be able to recreate it)

Help would be much appreciated.

S.
Title: foo_random_pools
Post by: fbuser on 2013-02-13 19:00:59
I wondered if anyone could help me set it up to create a playlist, in reverse order of the date I added the album to the PC, so the last album appears first in the list and runs for my entire library.
foo_random_pools is the wrong tool for this purpose. You should create an autoplaylist to get what you want. See here (http://www.hydrogenaudio.org/forums/index.php?showtopic=94733).

Title: foo_random_pools
Post by: Skelington on 2013-02-13 21:44:36
I wondered if anyone could help me set it up to create a playlist, in reverse order of the date I added the album to the PC, so the last album appears first in the list and runs for my entire library.
foo_random_pools is the wrong tool for this purpose. You should create an autoplaylist to get what you want. See here (http://www.hydrogenaudio.org/forums/index.php?showtopic=94733).


Really? That's a shame - I thought this would finally be the tool for the job :[ Particularly because I want to organise them by the date the mp3 was created not the date it was added to Foobar - because that would be redundant if I reinstalled the PC (which I have) so all the tracks were added on the same day.

I don't really understand how to use Random Pools properly, I've basically messed about with it and tried to find functions through trial and error - I don't find the documentation particularly friendly. I tried a previously posted entry to add and play random albums but it ended up just listing those tracks which I'd rated 5. -_X

Cheers for the reply.
Title: foo_random_pools
Post by: db1989 on 2013-02-13 22:15:47
I want to organise them by the date the mp3 was created not the date it was added to Foobar
As a search will reveal, date of creation has been requested numerous times but remains inaccessible, for reasons that have been explained IIRC. The closest thing you get is %last_modified% (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference#.25last_modified.25). That still does not require foo_random_pools, so, as fbuser said, your request is not relevant. You clearly want a specifically ordered list, the opposite of random.

As for the apparent problem with playing random albums, I guess that’s one of the perils of trying to adopt prefabricated solutions from other users! I suspect that the person who originally posted it is the most relevant to ask, although perhaps fbuser might be familiar with the relevant pattern.
Title: foo_random_pools
Post by: Skelington on 2013-02-14 11:58:25
You clearly want a specifically ordered list, the opposite of random.

As for the apparent problem with playing random albums, I guess that’s one of the perils of trying to adopt prefabricated solutions from other users! I suspect that the person who originally posted it is the most relevant to ask, although perhaps fbuser might be familiar with the relevant pattern.


Someone once said, you have to know how to do something very well before you can pervert it's use with any efficiency ;]

With regards to random album. the post was in this very thread, however I have actually managed to get it to display entire albums now. I've still not figured it out properly though as it only 'posts' one album per click and I have a couple of thousand so clicking them would give me RSI - I suspect the error lies in 'population' but can't figure out which.

Again, cheers for the reply though.
Title: foo_random_pools
Post by: fbuser on 2013-02-14 19:28:19
With regards to random album. the post was in this very thread, however I have actually managed to get it to display entire albums now. I've still not figured it out properly though as it only 'posts' one album per click and I have a couple of thousand
You can increase the number of groups for the relevant pool to add more than one album. But unless it is no problem for you to block your foobar2000 for a while, you should not increase this number too much.
Title: foo_random_pools
Post by: Hbsnail on 2013-05-02 18:28:19
I want to add some random tracks from one playlist to a new playlist
what should i do?

sorry for my poor english
Title: foo_random_pools
Post by: fbuser on 2013-05-02 20:56:25
I want to add some random tracks from one playlist to a new playlist
This is not possible. The source for a pool is always the media library, which can be filtered by the filter expression for the relevant pool.
Title: foo_random_pools
Post by: Bodhi on 2013-05-30 18:05:16
Hi

Can you tell me why the following filter is working:

%genre% IS Classical

and not this one:

%genre% IS NOT Classical

? (invalid filter type)

Thanks again for this great job
Title: foo_random_pools
Post by: BenB on 2013-05-30 18:41:05
Try:
Code: [Select]
NOT %genre% IS classical
Title: foo_random_pools
Post by: Bodhi on 2013-05-30 18:48:37
Try:
Code: [Select]
NOT %genre% IS classical

Youhouuuuuuuu

That's it, thanks
Title: foo_random_pools
Post by: wozza on 2013-07-01 03:05:46
Could someone please help me. I can't get this plugin to do anything.
I have hundreds of albums. They are all properly tagged and in folders. They are all in one huge playlist called "Albums". I want to play albums in a random order. I don't like the "shuffle albums" option because the albums are played in the same order. This option shuffles the order changes when I restart foobar, but I want a random album to come on whenever an album is finished. So if I play the last track of an album, the next track is the first track of another album. If I play that last track again, this time I hear the first track from a different album. Is this what the plug in is for?
The plug-in is installed. I can see an entry for it in the File menu and in the preferences windows. I've clicked the Add button, created a pool called "RandomAlbums", and for group I've put "%album%". I've left everything else at the defaults. To be honest, I haven't a clue what any of these other options mean.
So in the list in the preferences, now I can see:
Name: RandomAlbums
Priority: 0
Group: %album%
Group count: 1
The Autoadd box has my playlist name "Albums" listed as an option, so I leave that selected. The other two boxes, for an "Add" number, I've left at their default, 0.
Click OK. But what now? It doesn't seem to do anything. In the foobar menu, Playback->Order is default. Is that right? But songs are just being played in the order they are in the window. There is a menu option File->Random Pools that has three options, All Pools, RandomAlbums, More. Clicking the RandomAlbums options doesn't seem to have any effect at all.
I feel like I must have missed a step.
Title: foo_random_pools
Post by: tpijag on 2013-07-01 03:24:41
Can't offer specific help, but if you really have no idea as to the various options, you might of missed the .html documentation that comes with the component. Hopefully that may help some.
Title: foo_random_pools
Post by: wozza on 2013-07-01 03:31:34
my preferences dialog and my random pool dialog look exactly as they are on the html documentation http://www.palm-internet.eu/foobar2000/com...pools_help.html (http://www.palm-internet.eu/foobar2000/components/foo_random_pools/foo_random_pools_help.html), except for the autoadd playlist patterns, he has "Random*;Main". I assume his playlist is called Main, not sure why he has "Random*",  or if it matters to me.

Foobar is behaving as if it completely ignores this plug-in. How do I get it to actually take effect?
Title: foo_random_pools
Post by: wozza on 2013-07-01 03:49:44
ok, I think I figured it out.
clicking my pool name "Random Albums" on the file->random pools menu added a random album to the bottom of my playlist. It seems this is a tool for building a playlist.

But it isn't what I want.

I have a predefined playlist. I want to play random albums from that list. So, play song 1 from an album, play the album through to song the last, then choose a random album from the playlist and play song 1 from that.

Shuffle albums doesn't do this. Playing the last song from an album, you will always get the first song from the same next album.

anyone have any ideas on how I can get what I want.
Title: foo_random_pools
Post by: tpijag on 2013-07-01 04:02:53
EDIT based on your above text, you may ignore all that follows
Keep in mind this is a down and dirty explanation. I have never used the component till right now.

Don't believe you will get exactly what you are looking for. That is, playing a previous 'last' track to an album and then have the subsequent album added by the component change. OTOH, once you get it to work, you may find a use for it.

Add a playlist named whatever. Add whatever to random_pools config.

Keep in mind if you have followed his html exactly you are filtering on rating. may cause troubles if you do not use rating. Delete it for now.

In the config where you have add when 20 items remain, also put 20 in the next add option.

Save

Go to your whatever playlist. Click in the empty playlist. File>random pools>whatever.

you should get a random album inserted. When there are less than 20 items [if for instance you have the playlist to automatically remove played items] or when you start playing a track 20 from the end of the playlist, a new album will be added.

For your specific use, i would set both the add options to 1. then when you played to last track, a new album will appear. If you good back to that previous track a new random album will not appear. However a quick delete of the last added album will then be replaced with a new album.

good luck. hope i have not made it worse.
Title: foo_random_pools
Post by: tpijag on 2013-07-01 04:11:01
From your initial post, all albums are in your playlist. if this is the case random_pools may very well do what you want. As you are using it, it is populating your playlist with extra copies of your albums. Use a different blank playlist as I mention above and you may find it gets your towards what you want.
Title: foo_random_pools
Post by: BenB on 2013-07-01 04:17:58
Shuffle albums doesn't do this. Playing the last song from an album, you will always get the first song from the same next album.

Hmm... Shuffle (albums) doesn't behave the way you describe when I use it. I'm trying to get it to do what you say it does when you use it, but it randomly plays an album for me no matter what I do. Are there any other details you can give that might enable me to reproduce the behavior?

Shuffle (albums) does for me what you say you're wanting.
Title: foo_random_pools
Post by: richard123 on 2013-07-26 16:19:25
Feature request:

Do not add songs that are included in a named playlist.  If appropriate, I could first write the other playlist to a file.

Thanks
Title: foo_random_pools
Post by: amiti on 2013-09-30 23:58:56
I am trying to create playlists with different type of content. Is it possible to link pools per playlist?
Title: foo_random_pools
Post by: carpman on 2013-10-01 04:55:39
Isn't this the function of auto-playlists? Or do you still require the random element?

Creating an auto-playlist, playing in shuffle mode and having something like  ...    "AND (NOT %last_played% DURING LAST 7 DAYS)" to dynamically filter out recently played tracks; would this simulate what you are after?

C.
Title: foo_random_pools
Post by: amiti on 2013-10-01 18:57:02
I know about auto-playlists but this is not always a good solution.

I understand currently it isn't possible to set a pool (or pools) per playlist.
Title: foo_random_pools
Post by: 322 on 2013-11-22 13:09:05
I’ve just discovered this plugin that might do what I need, but I don’t want to define any specific pool, I just want the plugin to generate a playlist of random entries from the entire library. How do I do that?
Title: foo_random_pools
Post by: BenB on 2013-11-22 15:46:50
You still have to define a pool, and foo_random_pools will pick from your entire library unless you enable filtering for the pool.

I'll give you a simple pool for you to start off.

Go to File > Random pools > More... This will open up foo_random_pools preferences page.

Now click on the Add... button.

In the dialog that opens, do the following (leave any unmentioned settings as they are):

In the "Name:" box, enter Artists.

In the "Group" box, enter %artist%.

In the "Number of groups to add:" box, enter 20.

Tick the "Filter with the content of the target playlist" box. (This will prevent duplicate artists from being added if they are already present in the playlist).

In the "Number of tracks to add:" box, enter 1.

Make sure the "Sort/limit each group" box is ticked.

Now click on OK to close the dialog, and then click on Apply and OK to close the preferences dialog.

Now you can go to File > Random pools > Artists, which will add 1 track from 20 random artists in random order to the playlist.

(I suggest using an empty playlist; otherwise, it might be difficult to notice if any tracks were added since the artist may already be present in the playlist.)

You can increase the 20 to however many artists you want foo_random_pools to add, but you can just go to File > Random pools > Artists as many times as you want to keep adding random tracks without duplicating artists. You can also increase the 1 if you'd like more than one track from each artist.
Title: foo_random_pools
Post by: 322 on 2013-11-22 18:45:30
Thanks for the instructions. They work fine except they don’t select any songs with an empty "Artist" field...
Title: foo_random_pools
Post by: BenB on 2013-11-22 19:21:01
You could set up another pool with the same settings but use $directory_path(%path%) (which doesn't depend upon any tags whatsoever) for the Group box, but it's been my experience that there will be dupes from the same directory which I'd think shouldn't happen. Not a lot but some.

The key is to otherwise use a field that represents an actual group of tracks, i.e. %artist%, %album%, %album artist%, %genre%, $year(%date%), etc. You do not want to use fields such as %filename% or %title%, for example.
Title: foo_random_pools
Post by: 322 on 2013-11-23 12:42:47
Thanks for the tips. It seems like %path% group will only add as many entries as you indicate in "Number of groups to add". But I need to restrict it by the size on disc, and not by number of tracks.

I experimented a bit and discovered a parameter that seems to encompass every track in the library – %list_index%. Using the filter field, I have a full control over which tracks are being added.

There is, however, something I don’t fully understand. Browsing this topic I discovered operators like "NOT", "IS", "GREATER" etc. I can’t find any list of them and I don’t completely understand the sytax.
Title: foo_random_pools
Post by: BenB on 2013-11-23 21:40:46
It seems like %path% group will only add as many entries as you indicate in "Number of groups to add".

This is because each file's path is unique. To state it simply, two files cannot have the same path. Thus a group based on %path% can only have a quantity of 1 (and this is also true of %list_index%). The generated playlist can only contain as many tracks as the number of groups stipulated (regardless of the number of tracks specified). A scenario such as this is why I previously suggested you not use title formatting that doesn't represent a group of tracks.

I experimented a bit and discovered a parameter that seems to encompass every track in the library – %list_index%. Using the filter field, I have a full control over which tracks are being added.

Files can only have a %list_index% when they are in a playlist, and to be quite honest, I don't think this component accesses it. foo_random_pools can generate a playlist using %list_index% even when the playlist is empty, which shouldn't be possible AFAICT. Previously I had experimented with this component and found that whenever a nonexistent/inaccessible field is stipulated for Group, foo_random_pools seemingly defaults to some built-in way of choosing tracks (this would be something to ask the developer). This is what I think is happening with %list_index%, too.

So, you might be correct in the sense that specifying a nonexistent field encompasses the entire library, but I wouldn't be certain of having "full control."

There is, however, something I don’t fully understand. Browsing this topic I discovered operators like "NOT", "IS", "GREATER" etc. I can’t find any list of them and I don’t completely understand the sytax.

A query syntax reference can be found here (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax). There is also a html reference bundled in your foobar2000 directory that can be accessed from foobar in various places which opens in your browser.
Title: foo_random_pools
Post by: fbuser on 2013-11-23 22:12:41
whenever a nonexistent/inaccessible field is stipulated for Group, foo_random_pools seemingly defaults to some built-in way of choosing tracks (this would be something to ask the developer). This is what I think is happening with %list_index%, too.
As %list_index% is not defined in the context, which is used by foo_random_pools, the result of evaluating it is the same as for all other non-existing tags: ? (just a question mark). Due to this the whole library will be considered as one big group.
Title: foo_random_pools
Post by: 322 on 2013-11-24 11:15:12
Quote
A query syntax reference can be found here.


Thanks! It’s what I was looking for.

Quote
Due to this the whole library will be considered as one big group.


So basically any context-specific field would generate a random list of entire library.
Title: foo_random_pools
Post by: fbuser on 2013-11-24 20:54:12
So basically any context-specific field would generate a random list of entire library.
A context specific field is just a non-existing field in this case. So, you could also use for example %entire library%, which is much more meaningful for your purpose than an arbitrary context specific field.

And no, you don't get a random list of the entire library. You get just a list of the entire library in an unpredictable but reproducible order.

If you need a really randomized playlist of your entire library, just go in the menu to Library -> Search, type in ALL as search query, mark all entries in the "Library Viewer Selection" playlist and go in the menu to Edit -> Sort -> Randomize
Title: foo_random_pools
Post by: mjm716 on 2014-01-17 19:57:32
I'm looking for a solution to filter from an existing playlist, e.g.: %_playlist_name% IS Facet selection

is that possible?

What I'm trying to do is pull random tracks from my current selections and add to a playlist.
Title: foo_random_pools
Post by: eye2i on 2014-02-17 01:05:37
 
I haven't been this excited over my audio library experience since a couple of years back, prior to finding foobar2000, i was using MediaMonkey with it's similar feature --but eventually leaving it for what i like more about foobar2000 --except for not having what this component now finally gives me back! 

I joined the forum just now just to be able to say "thank you!" to the component author (but also, to the many who have shared tips, pointers, and explanations!  --that i was floundering around a bit before finding 'em).  Finally i can filter my media library from foobar2000 and not have to fiddle with the actual files/tags, and all according to my moods! (e.g. no more loading of "AlbumWrap" files when i'm in the mood for more of a "radio" play/variety)

The only thing i'd appreciate a further clarification of is the "All pools" feature, regarding its specific function. 
My guess is, that when selected, one of the specific pools is used to load the playlist first, then subsequently according to personal settings, the next pool is selected from and files added to the playlist from it, and so on...?  Or are they supposed to be merged on that initial manual load as well?  --assuming merging of pools is what the feature is about in the first place?

Thanks again for the awesome component (and the forum assistance, especially considering us coding noobs/wannabes)!
Title: foo_random_pools
Post by: carpman on 2014-02-17 04:03:15
I was similarly confused by this some time ago, hopefully this and the few subsequent posts helps:
http://www.hydrogenaudio.org/forums/index....st&p=704106 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77460&view=findpost&p=704106)

C.

EDIT: ps. I got it to do what I wanted (a "dynamic" weighted random playlist) with this method (in case it helps):
http://www.hydrogenaudio.org/forums/index....st&p=755427 (http://www.hydrogenaudio.org/forums/index.php?showtopic=77460&view=findpost&p=755427)
Title: foo_random_pools
Post by: eye2i on 2014-02-17 20:14:29
Thanks, carpman. 

My next snag is with regards to including a specific syntax to filter by song/album duration (playing time/song length). 
I would like to filter albums to be within a specified duration range. 
For example, to have no songs/albums shorter than 01:00 (1min) but also not longer than 07:30 (7mins30secs) in duration?  Or to cap the duration e.g. to filter so as to have no playing times longer than 12mins?
Title: foo_random_pools
Post by: BenB on 2014-02-17 22:23:27
You can filter for track duration but not for album duration. Query syntax is only applicable to individual tracks, not for groups or collections of them (the same is true with title formatting as well).

The only way you could filter for album length would be to add a tag containing that info which you could then use to filter with.
Title: foo_random_pools
Post by: eye2i on 2014-02-18 01:44:55
You can filter for track duration but not for album duration. Query syntax is only applicable to individual tracks, not for groups or collections of them (the same is true with title formatting as well).
The only way you could filter for album length would be to add a tag containing that info which you could then use to filter with.

#apologies.  i thought i was helping in my attempt to pick up on what i thought to be product/component specific lingo.

I do only want to select for songs/audio tracks.
(I'm also already or simultaneously filtering to not include Album/AlbumWrap per title/artist/etc; "album" here meaning multiple tracks within a single file; but being a prog-rock/symphonic rock/etc fan, i still have many single tracks that are way over the typical radio/dj play length of 3-6 mins)

To restate it: 
Could someone share with me, assuming it's possible to do the filtering, a specific syntax that will filter a pool by song/track duration aka playing time/song length?
I would like to filter tracks in a pool to be within a specified or restricted duration range.
For example, to have no songs/tracks shorter than 01:00 (1min) but also not longer than 07:30 (7mins30secs) in duration? Or to cap the duration e.g. to filter so as to have no playing times longer than 12mins?
Title: foo_random_pools
Post by: carpman on 2014-02-18 02:06:06
Say you wanted to only select for songs between 1 min and 7 mins 30 secs:
under Filter:
Code: [Select]
(%length_seconds% GREATER 59) AND (%length_seconds% LESS 451)

Look at the Query Syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax).

C.
Title: foo_random_pools
Post by: eye2i on 2014-02-22 22:03:03
#gratitude, carpman~
Title: foo_random_pools
Post by: eye2i on 2014-02-27 20:14:30
Code: [Select]
(%length_seconds% GREATER 59) AND (%length_seconds% LESS 451)
Ok, after some trial, i can't get this to actually work for me.  (that is the idea of what i want to accomplish though)

Is it possible that instead of "length", i could use "duration" somehow? 
(i have a Duration tag column in my playlist, which displays playing time/song length)

Any other ideas?
Quote
Look at the Query Syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax).
Thanks for both the resource and the link here to it (tho i had spotted it earlier and visited it prior). 
i don't know if it's my dyslexia or what, but that page tends to quickly run all together on me and i can't make much heads or tails out of it.  (fwiw, i do have pools selecting on other items/options e.g. genre/NOT genre)
Title: foo_random_pools
Post by: carpman on 2014-02-27 21:26:25
Go to: Main menu > Library > Search
and paste:
Code: [Select]
(%length_seconds% GREATER 59) AND (%length_seconds% LESS 451)
into the Media Library Search Box.

What results do you get?

C.
Title: foo_random_pools
Post by: eye2i on 2014-02-27 23:41:29
Go to: Main menu > Library > Search
and paste:
Code: [Select]
(%length_seconds% GREATER 59) AND (%length_seconds% LESS 451)
into the Media Library Search Box.

What results do you get?

C.

Interesting.
Rather than your specifics, to make it easier to inspect, i used:
Code: [Select]
(%length_seconds% GREATER 120) AND (%length_seconds% LESS 179)

And sure 'nuff, it filtered songs within those parameters.

And assuming, that if it works there, it should within random_pools, i tested it in random_pools with a test pool setup, with that as the only Filter entry --and sure enough, it worked there as well.
  My bad for not thinking to do a test pool with just the time filtered (instead of adding it to what i already had).
Thanks for confirming that it does work!

Thus i've obviously got a conflict going with the syntax i'm entering and using in conjunction with it as my other filtering.
I'll do some further examination of my filtering combinations.
I really appreciate the help, C-mahn!
Title: foo_random_pools
Post by: BenB on 2014-02-28 00:12:11
When you used that filter in combination with other filters, were the filters all joined (with AND, etc.) or were you trying to use filters with each one on its own line? Whichever one you did try, try doing the other. I'm not sure the latter way would even work.
Title: foo_random_pools
Post by: carpman on 2014-02-28 11:09:15
When combining queries you should use brackets, like so:

(QUERY 1a OR QUERY 1b) AND (QUERY2) AND (QUERY3)

This will yield results matching:
1a AND 2 AND 3, or 1b AND 2 AND 3

Here's an example of combining the code with some other query:
Code: [Select]
((%length_seconds% GREATER 59) AND (%length_seconds% LESS 451)) AND (%play_count% LESS 4)

Actually you don't need the brackets in the first query (I used them to make the query clearer as to what it was doing) so this will work:
Code: [Select]
(%length_seconds% GREATER 59 AND %length_seconds% LESS 451) AND (%play_count% LESS 4)

Notice the first AND is really part of the first query, the second AND is combining an additional query (see below Query 1 in red, query 2 in blue):
(%length_seconds% GREATER 59 AND %length_seconds% LESS 451) AND (%play_count% LESS 4)

C.
Title: foo_random_pools
Post by: elia_is_me on 2014-07-18 03:33:31
Encounter some trouble. I set up a pool, and set the filter to make it collect NO TRACKS from the media library, just like:

Name: Test
Group: %path%
number of groups to add: 1
number of tracks to add: 2
Filter: %path% HAS "JustTest"

and when I want to add some tracks from this pool, it crashes...
which means if you set up a pool, you must ensure that it contains tracks, otherwise it will crash.
Title: foo_random_pools
Post by: fbuser on 2014-07-18 19:31:02
I cannot reproduce this. Can you provide me the crash report. Just upload the relevant failure_000xxxx.dmp and failure_000xxxx.txt files to a one click hoster and send me the link via PM.
Title: foo_random_pools
Post by: shooftie on 2014-09-03 19:05:36
I'm struggling to get my head around this...

I want to generate a playlist or random songs from my entire library but I want the playlist:



Based on BenB's response (Nov 22 2013, 16:46) I have managed to get the plugin to return a specific number of tracks but to return as many as is needed to fulfil the quota (140GB). Nor have i been able to get it to return half single track and half sets...

settings:

http://i.imgur.com/8NEECcM.png (http://i.imgur.com/8NEECcM.png)

http://i.imgur.com/3xZBnbH.png (http://i.imgur.com/3xZBnbH.png)

What is it that I am missing? (I have read the docs AND this thread)
Title: foo_random_pools
Post by: BenB on 2014-09-03 21:02:26
Increase the value in the box for "Number of groups to add:" for both of your pools.

Also, for your Artist pool, you could add a "Filter" of NOT %path% HAS mixes.

And also for your Mixes pool, you should change your "Group" to %artist% or at least %title% and change the "Filter" to %path% HAS mixes.


Make sure you're using valid title formatting (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference) and query syntax (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Query_syntax).
Title: foo_random_pools
Post by: shooftie on 2014-09-05 10:18:49
Wicked... I understand that and am getting better results. However, I seem to be getting loads of the same artist.

Have I misunderstood the function of the plugin? Can I not gather an even spread of artists?
Title: foo_random_pools
Post by: BenB on 2014-09-05 23:20:02
Re-read the documentation (http://www.palm-internet.eu/foobar2000/components/foo_random_pools/foo_random_pools_help.html), esp. the Limits section.
Title: foo_random_pools
Post by: gentoosiast on 2015-02-11 08:36:28
Can't update to version 0.1.4: Could not load component "c663b5e2c5857822a8d97aafe925ce52a35a354d.zip": Unsupported format or corrupted file
Title: foo_random_pools
Post by: fbuser on 2015-02-11 17:52:15
Can't update to version 0.1.4: Could not load component "c663b5e2c5857822a8d97aafe925ce52a35a354d.zip": Unsupported format or corrupted file
Sorry, but currently you have to download and install the component manually. (http://www.hydrogenaud.io/forums/index.php?s=&showtopic=108318&view=findpost&p=889815)[/s]

It should now work normally again.
Title: foo_random_pools
Post by: ScribeOfTheMist on 2015-04-04 17:45:29
I'm not sure if this component is still actively being developed, but if so, is there any chance of getting a setting on the main page that would trigger the generation of new pools by length of the playlist rather than size or position? This was an option that used to exist on the original playlist tree component. I.e., I want the component to add new pools when the playlist length is, for example, under 60 minutes. My library contains wildly varying track lengths so the same number of tracks can be 45 minutes or 90 minutes depending on luck.

On the other hand if there's already a way to do this through clever queries then I would appreciate if someone could give me a hint. If not, no big deal, I have been happily using this component for several years and am very thankful to the developer, it's the best "auto DJ"-type code I've ever seen in any program. 
Title: foo_random_pools
Post by: fbuser on 2015-04-05 08:42:14
I'm not sure if this component is still actively being developed, but if so, is there any chance of getting a setting on the main page that would trigger the generation of new pools by length of the playlist rather than size or position?
Since some years I have plans to extend the component with some functionalities, but due to a lack of time, I couldn't realize them so far. However, I found some spare time and added the feature you requested. Just update the component with the update function of foobar2000.
Title: Re: foo_random_pools
Post by: jazzthieve on 2016-03-02 19:25:47
So I'm trying my hand on this component for the first time and I'm sure there's something I'm doing wrong here but it doesn't seem to do anything even with the most basic of terms I use.
So I have this;

Name: Progressive Rock
Group: %album%
Number of tracks to add: 50
Number of minutes to add: 200
Number of MBs to add: 0
Filter: %genre% IS Progressive Rock
Sort: %path_sort%
Filter with the content of the target playlist: unchecked
Sort / Limit each group: unchekced
Priority: 1

Autoadd
Playlist patterns: test
Add. when playlist has X items or less: 10
Add. when the playlist duration is X minutes or less: 0
Add. when the playback positions is X items or less from the end: 0


I would expect for the Test playlist to be filled with a random number of albums filtered on Progressive Rock but the result is nothing. It doesn't fill the playlist at all. Can someone give some hints as to what I'm doing wrong here.
Title: Re: foo_random_pools
Post by: -AdZero- on 2016-03-03 07:07:49
Hi.

Is your profile working when you try it manually via File/Random Pools/Progressive Rock when Test playlist is active ?
If yes, try to delete some items to have 10 or less in order to see if autoadd is working.

If no you'll have to dig a little more...  ::)

So I'm trying my hand on this component for the first time and I'm sure there's something I'm doing wrong here but it doesn't seem to do anything even with the most basic of terms I use.
So I have this;

Name: Progressive Rock
Group: %album%
Number of tracks to add: 50
Number of minutes to add: 200
Number of MBs to add: 0
Filter: %genre% IS Progressive Rock
Sort: %path_sort%
Filter with the content of the target playlist: unchecked
Sort / Limit each group: unchekced
Priority: 1

Autoadd
Playlist patterns: test
Add. when playlist has X items or less: 10
Add. when the playlist duration is X minutes or less: 0
Add. when the playback positions is X items or less from the end: 0


I would expect for the Test playlist to be filled with a random number of albums filtered on Progressive Rock but the result is nothing. It doesn't fill the playlist at all. Can someone give some hints as to what I'm doing wrong here.
Title: Re: foo_random_pools
Post by: jazzthieve on 2016-03-03 11:16:13
Yes, if I do that that it seems to fill the playlist. However, I can see no automatic adding (or removal) of tracks. I played around a bit and I would expect if the filter indicates %play_counter% IS 0 that as soon as it's changed to 1 it would automatically remove it from the playlist. Not happening, in fact the way it functions now I would have to manually remove the played tracks and then fill the playlist again by manually filling it by clicking file - random pools.
Title: Re: foo_random_pools
Post by: -AdZero- on 2016-03-03 12:21:57
This plugin won't remove any played track from your playlist.
What you seem to want is a rolling playlist with its content changing while playing. I have this working in my foobar for years now.
To achieve that you must use the Playlist Attributes (https://www.foobar2000.org/components/view/foo_playlist_attributes) plugin (another great plugin from fbuser) which has the option to remove tracks after it has been played (or skipped).
Look at the documentation (http://www.palm-internet.eu/foobar2000/components/foo_playlist_attributes/foo_playlist_attributes_help.html) to discover other features.

To avoid playing the same tracks (it depends on the size of your library) you can add an additional condition in your filter like : %genre% IS "Progressive Rock" AND NOT %last_played% DURING LAST 1 HOURS

Hope this will help you.

Yes, if I do that that it seems to fill the playlist. However, I can see no automatic adding (or removal) of tracks. I played around a bit and I would expect if the filter indicates %play_counter% IS 0 that as soon as it's changed to 1 it would automatically remove it from the playlist. Not happening, in fact the way it functions now I would have to manually remove the played tracks and then fill the playlist again by manually filling it by clicking file - random pools.
Title: Re: foo_random_pools
Post by: jazzthieve on 2016-03-03 12:53:17
Thanks, will check out your suggestion.
Title: Re: foo_random_pools
Post by: mark12 on 2016-03-08 21:38:46
Hi guys, I'm attempting to follow the documentation, but I honestly find it very confusing and unclear. I simply am trying to get a playlist that grabs 5 albums at random from my library at a time. What I mean by this is that everytime I click onto the playlist, I would like for it to have a new set of 5 random albums (preferably with no duplicates. I'm not sure if foo_random_pools is capable of this).

So I created a new Playlist called 'Random Albums', went into the foo_random_pools options and did this. Can someone let me know what I'm doing wrong, or the right way to get what I'm trying to achieve? For the record, the playlist seems to not populate at all. Thanks.

(https://u.pomf.is/exzcxp.png)

Title: Re: foo_random_pools
Post by: carpman on 2016-03-08 23:19:01
Go to Random Albums and add a track and play it. You'll find your albums are added.

Or from main menu: File > Random Pools > Album
This will populate any playlist with your criteria. You may want to add something like:
%album% - %tracknumber%
To the sort box and tick sort limit each group.
Also filter with the content of the target playlist will get rid of duplicates AFAIK.

You realise you can do the same thing pretty much, just by choosing Shuffle Albums from the drop down and playing a playlist of your entire library.

C.
Title: Re: foo_random_pools
Post by: i b listening on 2016-05-22 00:40:45
fbuser,

Thank you for your efforts, I love this plugin. I know this has been requested before (replies 60 & 80) - the ability to assign pools to different playlists - any chance???

Title: Re: foo_random_pools
Post by: i b listening on 2016-05-23 14:59:13
fbuser,

Thank you for your efforts, I love this plugin. I know this has been requested before (replies 60 & 80) - the ability to assign pools to different playlists - any chance???


I guess what would be ideal (for me anyway) is to have a check box labeled "Create one playlist per pool". If unchecked, foo_random pools would operate the way it is currently. If checked, foo_random_pools would create one playlist per pool. The name of the playlist could be the name of the pool.

I would be interested in any feedback on the idea: good, dumb, not worth the time to implement, too hard to implement, etc.
Title: Re: foo_random_pools
Post by: laddie on 2016-05-23 23:06:00
Is there a way to schedule random pools to activate every so often?  Basically a way to have it work with the Scheduler plugin?
Title: Re: foo_random_pools
Post by: fbuser on 2016-05-24 20:44:47
I would be interested in any feedback on the idea: good, dumb, not worth the time to implement, too hard to implement, etc.
Basically the idea is not bad and I might implement this in some way in the more or less far future. However, you can at least partially get what you want by using foo_scheduler as described below in combination with the "Set active playlist" action. Also, you can get what you want by utilizing foo_jscript_panel with the a piece of code similar to this (not tested, no error handling):

Code: [Select]
function getPlaylistIndex(name) {
  var idx=-1;
  for(var i=0;i<plman.PlaylistCount;i++)  {
    if(plman.GetPlaylistName(i)===name)  {
      idx=i;
      break;
    }
  }

  return idx;
}

function poolToPlaylist(poolName,playlistName) {
  var playlistIndex=getPlaylistIndex(playlistName);

  plman.ActivePlaylist=playlistIndex;
  plman.ClearPlaylist(playlistIndex);

  fb.RunMainMenuCommand("Random pools/"+poolName);
}

poolToPlaylist("Pool1","Playlist1");
poolToPlaylist("Pool2","Playlist2");
....
Of course, you need to either create a button or a main menu entry to run this code.

Is there a way to schedule random pools to activate every so often?  Basically a way to have it work with the Scheduler plugin?
Yes, just use the "Launch application" action with foobar2000.exe /command:"<pool name>". You might need to supply the full path to foobar2000.exe

For the restrictions for the /command parameter and how to overcome them, see here (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Commandline_Guide).
Title: Re: foo_random_pools
Post by: i b listening on 2016-05-26 22:15:29
fbuser,

Appreciate your reply, and I see what you are saying. I don't think that will work for what I am trying to accomplish.

I run fb2k on a pc that sits in a closet and streams music throughout my house. I can control some functions (play control, playlist selection/editing) of f2bk from an app on my phone.  90% of the time I listen to autoplaylists on shuffle mode; these playlists are generally based on combinations of genre and rating. Autoplaylists can't be modified (individual songs deleted, moved, etc). I can't determine which song will play next, but I can hit the skip button if I don't want to hear a particular song at that moment.

What I really like about foo_random_pools and foo_playlist_attributes is that, together, they allow me to create a playlist which contains ~25 (or any number) randomly selected songs that will be played next. (foo_playlist_attributes removes songs that have been played/skipped and foo_random_pools adds songs to keep the playlist at ~25 songs.) For this one playlist, using my phone app, I can look at the list of 25 songs coming up and get rid of the ones I don't feel like listening to at the moment. I can let this playlist run indefinitely and I can also manage the next ~hour's worth of music at any time.  I would love to have this capability for all my playlists. Being able to assign a random_pool for each playlist would accomplish this. There may be other ways???

Title: Re: foo_random_pools
Post by: benerogerio on 2016-12-25 16:10:56
For the devs! Please consider to implement a sort descending... thanks! random pools is awesome!
Title: Re: foo_random_pools
Post by: Slug on 2016-12-27 11:12:17
Hi,
as a new user of random pools i create 2 pools in my random pools
each one works correctly by itself
However when i choose to add "All pools" only one is added in the playlist...

Here a screenshort of my random pools :
(http://img11.hostingpics.net/pics/760128glav.jpg) (http://www.hostingpics.net/viewer.php?id=760128glav.jpg)
Title: Re: foo_random_pools
Post by: fbuser on 2016-12-27 19:13:49
However when i choose to add "All pools" only one is added in the playlist...
This is correct. If you choose "All pools" one of the pools with a priority greater zero is randomly choosen by considering the priority of each pool. For example, if you have two pools defined, A (with priority 9) and B (with priority 1), then pool A will be selected with a probability of 90% and pool B with a probability of 10%.
Title: Re: foo_random_pools
Post by: Slug on 2016-12-27 19:40:55
ok, tx
Title: Re: foo_random_pools
Post by: Slug on 2016-12-28 11:45:10
So it's not possible to use Random Pools to create a playlist that select a random song of Reggae for example then select a random song of Rocksteady then again and again?

And i can't understand what "Group" is.
It's always all my librairy or can i select a part of my librairy here?

Then in filters if i want to use several filters is it possible? (i tried with "%Rate% GREATER 2 AND %Genre% IS Reggae" but it doesn't work)
Title: Re: foo_random_pools
Post by: fbuser on 2016-12-28 18:54:57
So it's not possible to use Random Pools to create a playlist that select a random song of Reggae for example then select a random song of Rocksteady then again and again?
Only manually, but not automatically. However, it would be possible to create a script in JScriptPanel to automate this up to a certain extent.

And i can't understand what "Group" is.
It's always all my librairy or can i select a part of my librairy here?
A group is a set of tracks with the same attributes defined by a title format expression, i.e. if you set the group to %artist%, set the number of groups to 2 and don't set a limit for adding tracks, all tracks for 2 randomly chosen artists are added. Filtering the library can be done by entering a filter expression in the Filter field.

Then in filters if i want to use several filters is it possible? (i tried with "%Rate% GREATER 2 AND %Genre% IS Reggae" but it doesn't work)
If your library is tagged accordingly this will work. Is %Rate% spelled correctly? Normally the tag %Rating% is used in such cases. You can easily test a filter by going to the menu "Library -> Search" and enter the filter expression there.
Title: Re: foo_random_pools
Post by: Romroll on 2017-04-27 22:30:31
Hello,

is it possible to get a playlist composed of 25%Funk, 25%Rock, 25%Electro, 25%World with tracks sorted randomly?
If yes, can someone explain me how please? (I already use Foobar, foo_random_pools is installed, my flac library is tagged)

Thank you in advance, I read twice thre 8 pages but I couldn't understand the way to give instructions to foo_random_pools (but I guess a big potential!).
Title: Re: foo_random_pools: some preset button?
Post by: Rozzo on 2017-04-28 20:19:31
Hi,

I have seen this component in different occassions but never found it of interest, basically because of lack of an intuitive interface. Certainly I would like to have special playlist, but my mental hard disk does not feel attracted to learning code, even in the most elemental ways. We, general users, want buttons. Buttons are for that, you do a clic and then you got some results that somebody -the programmer- experienced before and that you can tell are wonderful and use every day. As it is right now is an incomplete component very few persons can use.

Ys
Rozzo
Title: Re: foo_random_pools
Post by: fbuser on 2017-04-28 20:25:03
is it possible to get a playlist composed of 25%Funk, 25%Rock, 25%Electro, 25%World with tracks sorted randomly?
Yes, but it cannot be done automatically. You can get the desired result as follows:

Create 4 pools Funk, Rock, Electro, World with the following settings (all other settings can be kept as they are):
Funk:
Name: Funk
Group: %genre%
Filter: genre IS Funk
Number of tracks to add: 10

Rock:
Name: Funk
Group: %genre%
Filter: genre IS Rock
Number of tracks to add: 10

Electro:
Name: Electro
Group: %genre%
Filter: genre IS Electro
Number of tracks to add: 10

World:
Name: World
Group: %genre%
Filter: genre IS World
Number of tracks to add: 10

Choose or create an empty playlist with your playlist manager

Execute the following main menu entries:
File -> Random pools -> Funk
File -> Random pools -> Rock
File -> Random pools -> Electro
File -> Random pools -> World
Edit -> Sort -> Randomize

This will create a playlist with 40 entries, 10 randomly selected tracks from each genre, with a random track order


Title: Re: foo_random_pools
Post by: fbuser on 2017-04-28 20:42:00
I have seen this component in different occassions but never found it of interest, basically because of lack of an intuitive interface.
Besides some possible minor enhancements, which are not worth to put effort into it, the interface is as intuiitive as it can be for the designed purpose.

Certainly I would like to have special playlist, but my mental hard disk does not feel attracted to learning code, even in the most elemental ways.
If you are not willing to to this, then this component is absolutely nothing for you and will never be. But this doesn't only apply to this component, it applies also to many other components, which require at least some basic knowledge of foobar2000 title format.

We, general users, want buttons. Buttons are for that, you do a clic and then you got some results that somebody -the programmer- experienced before and that you can tell are wonderful and use every day.
To create a component like this just with buttons, which magically know, which result the user expects, is simply not possible.

As it is right now is an incomplete component very few persons can use.
The component is neither incomplete nor can it only used by a few persons. Only the few persons, which are strictly deny to learn anything new, won't be able to use this component.
Title: Re: foo_random_pools
Post by: Romroll on 2017-05-13 00:02:47
Hello fbuser,

thanks for your answer and for your work!
Title: Re: foo_random_pools
Post by: Queseuq on 2017-05-17 13:32:57
Hey, would it be possible to have a pool output it's tracks to the queue, rather than a specific playlist?
Title: Re: foo_random_pools
Post by: fbuser on 2017-05-17 21:04:06
Hey, would it be possible to have a pool output it's tracks to the queue, rather than a specific playlist?
I don't think, that it is useful. There is nothing relevant , what you can do with the queue, what can't also be done with a playlist.
Title: Re: foo_random_pools
Post by: Queseuq on 2017-05-18 09:36:22
Hey, would it be possible to have a pool output it's tracks to the queue, rather than a specific playlist?
I don't think, that it is useful. There is nothing relevant , what you can do with the queue, what can't also be done with a playlist.

Hmmm, I thought that might be the case. I still prefer the queue though for a couple of reasons:

1. right click -> Add to queue. I may be being stupid but I haven't found a way to replicate this with playlists
2. With the queue it is possible to display the active playlist and the queue at the same time. I haven't yet found a way to display the active playlist with the now playing playlist beside it.

If anyone knows a way to get these features working with a playlist, please enlighten me!
Title: Re: foo_random_pools
Post by: fbuser on 2017-05-18 20:26:06
1. right click -> Add to queue. I may be being stupid but I haven't found a way to replicate this with playlists
This can be done with foo_playlist_attributes and foo_utils:

2. With the queue it is possible to display the active playlist and the queue at the same time. I haven't yet found a way to display the active playlist with the now playing playlist beside it.
This is also possible, but as far as I know only with ELPlaylist, which requires ColumnsUI, or with ESPlaylist, which is also working with Default UI. In both cases you can set the playlist viewer to follow the currently playing playlist instead of the active playlist.

Title: Re: foo_random_pools
Post by: Queseuq on 2017-05-19 09:48:59
Thanks fbuser!

I think the way I want to use foobar2000 is going to require quite a few workarounds whether I use the queue or a separate playlist. All part of the fun of using foobar2000!
Title: Re: foo_random_pools
Post by: Decalicatan_Decalicatan on 2017-07-26 18:54:46
Hi!

Is it possible to limit the selection of the pool to the tracks from a specific playlist (as opposed to any tracks from the media library) ? Thanks in advance
Title: Re: foo_random_pools
Post by: fbuser on 2017-07-26 22:44:53
Is it possible to limit the selection of the pool to the tracks from a specific playlist (as opposed to any tracks from the media library) ?
No.
Title: Re: foo_random_pools
Post by: Decalicatan_Decalicatan on 2017-07-27 07:03:11
ty for the answer!
Title: Re: foo_random_pools
Post by: stevehero on 2017-08-18 00:52:12
Amazing. I commend you on this plug! Thank you!
iTunes is starting to feel like that old girlfriend that seemed so nice at the time :o

Anyway, just wanted to ask if it's possible for each pool to be assigned its own playlist to auto-add to.

See screenshot for better understanding. Forgive me if this has been suggested before.
Title: Re: foo_random_pools
Post by: fbuser on 2017-08-25 19:55:31
Anyway, just wanted to ask if it's possible for each pool to be assigned its own playlist to auto-add to.
This does not really make sense. Autoadding is applied to the currently playing playlist, if its name matches the specified pattern.
Title: Re: foo_random_pools
Post by: stevehero on 2017-08-25 20:26:49
Ok, thanks, just thought it could be extended to pool different playlists. Thanks for the reply.
Title: Re: foo_random_pools
Post by: bouchacha on 2017-11-25 23:37:39
I'm a baby foobar user and was wondering if this is possible. I want to add a button that clears the playlist and plays a random album from the first track. Additionally, I would like it if at the end of a playlist, a random album starts playing. Mrinferno had something similar early on this thread but I'm still very confused and think I'm missing a few steps.
Title: Re: foo_random_pools
Post by: bronzi on 2017-12-12 06:01:48
Hi, I'm having a couple of issues and am hoping someone might have a tip or two.

I've created a random pool to add a random album to a playlist, which seems to be a common use of this component. It was working well for a while, but now whenever I add an album it is pre-shuffled (see image).
It only happens in this context--in all other playlists and filters album tracks are in their proper numerical order.
Any idea why this might happen?
I've tried re-creating the pool, and I've also tried adjusting Playlist Attribute parameters to no avail (thinking it might be causing the issue).
I've attached images of my random pool and playlist attribute settings.

Secondary question:
Is there a way to make the random album auto-play when its added to the playlist?

Thanks.
Title: Re: foo_random_pools
Post by: bronzi on 2017-12-12 19:19:10
I figured out my issue from an earlier post in this thread.
FYI, I needed a "%path_sort%" in the sorting field.

Thank you for this plugin--I switched to foobar from music bee basically just for this feature and am glad I did!

If anyone has a suggestion for my latter question that would be sweet:
How can I get the random pool to play automatically upon being added to the playlist?
Title: Re: foo_random_pools
Post by: fbuser on 2017-12-12 19:26:16
Any idea why this might happen?
You need to add a sort expression to the sort field: %discnumber% | %tracknumber%

If you don't use a sort expression, the order of the tracks is not defined. So in the past you just had luck.

Is there a way to make the random album auto-play when its added to the playlist?
Not with this component. With JScript Panel you could create a script, which comes close to what you want.
Title: Re: foo_random_pools
Post by: bronzi on 2017-12-12 19:56:24
Thanks for the info!
Title: Re: foo_random_pools
Post by: bouchacha on 2017-12-25 03:37:02
I'm a baby foobar user and was wondering if this is possible. I want to add a button that clears the playlist and plays a random album from the first track. Additionally, I would like it if at the end of a playlist, a random album starts playing. Mrinferno had something similar early on this thread but I'm still very confused and think I'm missing a few steps.

Just checking if I'm missing something. Right now if I want to skip to a random album, I have to press the random pool button which adds it to the end of the playlist, then I have to find the beginning of this new random album. Is there a better way?
Title: Re: foo_random_pools
Post by: fbuser on 2017-12-25 08:31:23
Not, really. You could use the autoadd functionality of the component and just remove the unwanted album from the playlist, but this would not directly play the newly added album, if there are other items in the playlist, which will be played first.

If you want to skip certain albums you could tag them meaningfully and exclude them by a filter for the relevant random pool.
Title: Re: foo_random_pools
Post by: bouchacha on 2017-12-25 09:10:20
Thanks for replying! Is there anyway to assign multiple commands to a single button? It could be something like:
1. Clear playlist
2. [Random Pool action]
3. Play
Title: Re: foo_random_pools
Post by: fabiospark on 2018-01-07 20:14:39
Anyway, just wanted to ask if it's possible for each pool to be assigned its own playlist to auto-add to.
This does not really make sense. Autoadding is applied to the currently playing playlist, if its name matches the specified pattern.
Let me turn stevehero's question into a feature request.

It would be very useful (to me, at least) to be able to tie a specific pool preset
to a specific playlist. Think of the common scenario of wanting to listen
to tracks not played recently. Using RP together with "remove played" from
playlist attributes is the usual way we can have a playlist AUTOMATICALLY refilled
with tracks that matches the query setup in RP: i.e. NOT %last_played% DURING LAST 7 DAYS.
But what if we want to send tracks from a different pool? I think we will have to go in the
settings and change the priorities of RP presets: correct?

If we could tie a playlist to a pool preset we could have one playlist for each different
additional filtering apart the "...last_played..." bit. I.e.:
- least played with high rating
- least played from a certain genre
- least played + you name it

I hope this explanation can make a little sense for you too and shed some light on why we are asking for that.
It will multiply the power of your already amazing plugin.

Thanks.
Title: Re: foo_random_pools
Post by: fbuser on 2018-01-07 21:02:43
But what if we want to send tracks from a different pool? I think we will have to go in the settings and change the priorities of RP presets: correct?
No, you can just select the relevant menu entry for that pool (File -> Random pools -> <Pool name>)

I hope this explanation can make a little sense for you too
Sorry, no. Auto-adding makes only sense for the currently playing playlist as only this playlist is affected by removing played or skipped tracks.
Title: Re: foo_random_pools
Post by: fabiospark on 2018-01-07 21:37:07
I hope this explanation can make a little sense for you too
Sorry, no. Auto-adding makes only sense for the currently playing playlist as only this playlist is affected by removing played or skipped tracks.
Yes, I understand. But from what I know one of the strength of FB is the ability
to have many playlists at hand that let you easily check what are you going
to listen to before you start playing them.
IMHO the ability to tie each pool to "its own" playist would fit well into FB well thought
playlist centric world.
Another useful thing, I think, is that in that way one can easily set the name
of each tied playlist matching the name of its generating pool.
By now we can't even know which is the "active" pool and with what the active playlist
will be filled with.
But maybe I'm wrong.

Of course this is only my view considering my use of RP in conjuction with remove played
(on a playlist basis, not on a global one) to create editable custom autoplaylists.

I hope I didn't annoy you too much asking you for something that has already
been asked many times before. I read all the thread before posting my request and I did it only
after I read an answer of yours where you seemed to think it over but didn't see the point.
I hoped to be able to let you see that point.

Thanks.

fabio
Title: Re: foo_random_pools
Post by: theagg on 2018-01-26 19:08:47
Can someone here remind me exactly how to get the autoadd feature working ?

I had worked out how to do this some time ago but following a required Windows reinstall yesterday (losing all Foobar settings as a result) I cannot recall how to get this working again.

Basically, prior to the reinstall I had Random Pools adding 3 tracks at a time using the autoadd "add when the playback position is X items from the end". Which it did perfectly.

Selecting that option now is having no effect, the playlist reaches the end and stops. Given its so long ago, I'm not sure how I had the settings in the edit pane. What is number of group vs number of tracks for example. Randomly playing around with these settings is doing nothing to get the auto add to work..help!!
Title: Re: foo_random_pools
Post by: fabiospark on 2018-01-26 20:18:22
You have to set the priority above zero.
Title: Re: foo_random_pools
Post by: Daeron on 2018-01-29 13:18:22
I'll attempt to echo what fabiospark and stevehero seemingly already requested, as I also think that would be a logical extension of the component.

The scenario is the following (picture below). Let's say you set up a random pool to populate a specific playlist with some arbitrary set of rules. Suppose you want your playlist to consist of 50% metal songs that came out before 2008 and 50% after and set up the component accordingly. The Playlist attributes component is also used to automatically remove played tracks from this playlist. The result is an auto-updating playlist which has the right distribution and basically requires no further input. Great.
(https://i.imgur.com/xWRWNaZ.png)

Now suppose you want another playlist with yet another set of arbitrary distribution of songs. Let's say 50% electronic songs which were rated above 4 and 50% below. Important is that you want to keep the auto-updating nature of the playlist, just like the metal songs had. As far as I'm aware, this is currently not possible. You can go back, edit and overwrite your original settings - basically repurposing your metal playlist to create the electronic playlist (picture below) - but you can't define multiple of these special playlists with different parameters at the same time. You can of course still create the individual electronic and metal pools and add them by hand (via File/Random pools), but in that case auto-updating nature can't be utilized, which would be essential to how many of us would like to use this component.
(https://i.imgur.com/pl748ww.png)

Important distinction, which I think was the source of confusion, is that I don't think people want these special playlists to update in real time simultaneously. As long as I'm listening to the metal playlist, I don't care what happens to the electronic playlist and vice versa. All I would like is to be able to specify which pools to take into consideration depending on which playlist I'm currently playing. This is shown on the picture below. The red arrow signifies that the "Autoadd" setting would become the property of each individual pool as opposed to the global setting which it is now.
(https://i.imgur.com/7r11vGm.png)

So the logic of the component would go from:
1) Check the name of the current playlist
2) If playlist name matches the global "Autoadd" setting, populate the playlist according to every pool

To:
1) Check the name of the current playlist
2) If playlist name matches at least one of the Autoadd settings, populate the playlist according to the pools which have a matching "Autoadd" setting

I don't think this modification would fundamentally break any mechanic that the component relies upon and would be fairly simple to implement, relatively speaking anyway. It would however allow us to spawn countless finely tuned auto-playlists which would be great. The functionality is already there, it's just limited to a single playlist currently. Playlist attributes component for example already lets you specify settings for both global and individual playlists, so that side of the equation is already covered.
Title: Re: foo_random_pools
Post by: fbuser on 2018-01-29 22:30:44
I don't think this modification would fundamentally break any mechanic that the component relies upon
Actually, it would just do this. In your example you defined four pools with the same priority. Either of the pools has the same probability to be chosen. You're proposal would in the end lead to different behaviours for adding a pool from all pools manually and adding a pool automatically. I don't think, that this is a good idea.

Sorry, but I won't implement this.
Title: Re: foo_random_pools
Post by: JDPCC on 2018-03-12 18:51:14
Would like to pull an equal number of random tracks from two different genres.  One genre (Rock) has 13261 tracks in the library and the other genre (Blues) has 1852 tracks in the library.  Problem: tracks being pulled are proportionate to number of tracks in each genre.  Out of 200 tracks requested roughly 20 are from the Blues library and the remainder 180 are from the Rock library.  I would like an equal number of tracks pulled from each genre.  Is this possible??
Title: Re: foo_random_pools
Post by: fbuser on 2018-03-12 20:31:47
What are your current pool definitions?
Title: Re: foo_random_pools
Post by: JDPCC on 2018-03-13 17:53:10
Thank you for your reply.  Parameters are as follows:

Blues Genre pool: 
Name = Blues
Group = %artist% and %title%
Determine probability for picking groups based on group size = not checked
Number of groups to add = 200
Filter = %genre" IS Blues
Filter with content of the target playlist = checked
Priority = 1
Number of tracks to add = 1
Number of minutes to add = 0
Number of MBs to add = 0
Sort = %artist% | %album% | %tracknumber%
Sort / limit each group = checked

All parameters for the Rock genre pool are exactly the same as the Blues genre pool with the exception of the Name and the Filter parameters
Name = Rock
Filter = %genre" IS Rock

All parameters for the Blues & Rock genre pool are exactly the same as the Rock or Blues pools with the exception of the Name, the Filter and the Group:
Name = Blues & Rock
Group = %DIRECTORYNAME%  -- (but I have also tried using %artist% and %title% as the group with same results)
Filter = %genre% IS Blues OR %genre% IS Rock

TIA for you help
Title: Re: foo_random_pools
Post by: fbuser on 2018-03-14 20:43:48
In general it is better to use the following properties to get 200 random tracks from a pool:

Group: %library% (or any other non-existing tag)
Number of groups to add: 1
Number of tracks to add: 200

This is especially for large libraries much faster.

However, this will not solve your problem to get a balanced number of tracks from one pool for two different genres. Actually, this is not possible. You need to add separately 100 tracks from the Rock genre pool and 100 tracks from the Blues genre pool to get the result you want.
Title: Re: foo_random_pools
Post by: JDPCC on 2018-03-14 23:26:51
Thank you for your assistance.  I did figure out that by selecting the two different genre pools independently I could add the same number of tracks from each genre to the playlist.  I suspect it is possible to do what I am asking but not without additional coding.  You have already provided foobar users with a great tool, I can understand why an enhancement like this may not be something you want to spend time on.  Thanks again for your help. 

p.s. If I can get a look at the source code I may be able to help with the enhancement should you decide it is worthwhile to include.  
Title: Re: foo_random_pools
Post by: YAP7 on 2018-07-26 23:38:50
I'm new to foo_random_pools and I'm struggling with it right now.
What I'm trying to achieve: define pools (currently with a directory as source) filtering by bpm, to build playlists with "one click" (and maybe fine tune them later, but that's another story).
I've been successful in defining a playlist column to display bpm, but it seems I'm stuck with filter definition, this is what I came up with, which is invalid: $and($num($meta(TEMPO),1) GREATER 100,$num($meta(TEMPO),1) LOWER 180)

It seems I don't have a good enough grasp of the syntax, could you please point me in the right direction?
Title: Re: foo_random_pools
Post by: fabiospark on 2018-07-27 07:24:52
I don't have time to help you now but you should have a look
at "Menu\Library\Search\ and click on the question mark in the upper right corner.
You shoud see what I have attached here, with better formatting, and you should carefully check the syntax
of your query. I suggest you to start with a simple search and only when you see
all of them work by themselves, try to put them together with the boolean operators.

Good work.

Code: [Select]
Query Syntax Help
Conventions in this Document

Queries are written in italics.
Example: %rating% GREATER 3

Query examples may contain placeholders which are enclosed in angle brackets. Their name indicates what they need to be replaced within a real query. If multiple placeholders of the same type occur in the same query example, a number will be appended to the name.
Example: <field> GREATER <number>

The following common types of placeholders are used in the rest of this document:

    <field>
    A reference to a tag field. This can be either a plain field name or a title formatting expression. See Notes for details.
    <number>
    An integer value.
    <string>
    A text value that may be enclosed in double quotation marks. See Notes for details.
    <time>
    A time value or a title formatting expression that evaluates to a time value. See Time Expressions for details.
    <expression>
    A query expression in a composed query. This has to follow the rules described under Advanced Search below.

Simple Search

The simple search mode does not use any keywords.

    <any string>
    Returns only items that have all words from specified string in their metadata or file path.

When using the simple search, any latin characters are matched regardless of their accents, e.g. “foo” will match “foo” as well as “föö” or “fóo”.
Advanced Search

The advanced search allows the construction of more complex queries. It offers several keywords to perform specific types of comparisons and to combine multiple query expressions.
Text Expressions

    <field> HAS <string>
    Returns only items that have all words from <string> in a metadata field named <field>.
    Example: title HAS blah
    <field> IS <string>
    Returns only items where (at least one) metadata field <field> is equal to <string>.
    Example: artist IS blah
    * HAS <string>
    Same as simple search, but can be combined using logical operators (see below).

Numeric Expressions

Perform integral number comparison between the value of a <field> and a <number>, e.g. ”%rating% GREATER 3”.

    <field> GREATER <number>
    <field> LESS <number>
    <field> EQUAL <number>

Metadata Expressions

    <field> MISSING
    Returns only items that don't have a metadata field named <field>.
    Example: genre MISSING
    <field> PRESENT
    Returns only items that have a metadata field named <field>.
    Example: genre PRESENT

Time Expressions

    <time1> BEFORE <time2>
    Returns only items where <time1> value is before <time2>.
    Example: %last_modified% BEFORE 2008
    <time1> AFTER <time2>
    Returns only items where <time1> value is after <time2>.
    Example: %last_modified% AFTER 2008
    <time1> SINCE <time2>
    Returns only items where <time1> value is not before <time2>.
    Example: %last_modified% SINCE 2007
    <time1> DURING <time2>
    Returns only items where <time1> value is a subset of <time2> period.
    Example: %last_modified% DURING 2007
    <time> DURING LAST <number> <time-unit>
    Returns items where <time> value is contained in the specified period.
    <time-unit> can be one of SECONDS, MINUTES, HOURS, DAYS, or WEEKS.
    Example: %last_modified% DURING LAST 2 WEEKS
    If <number> is 1, the expression can be simplified to <time> DURING LAST SECOND/MINUTE/HOUR/DAY/WEEK

Time values used in these expressions must be in one of the following formats: YYYY, YYYY-MM, YYYY-MM-DD, YYYY-MM-DD hh, YYYY-MM-DD hh:mm, YYYY-MM-DD hh:mm:ss.
Composed Queries

    <expression1> AND <expression2>
    Returns only items where both expressions are true.
    Example: artist IS blah AND title HAS blah
    <expression1> OR <expression2>
    Returns only items where at least one expression is true.
    NOT <expression>
    Returns only items where the expression is false.
    Example: NOT %last_played% AFTER %first_played%

Sorting Results

You can put a SORT BY operator at the end of your search expression to produce search results sorted by the specified title formatting pattern.

    SORT BY <sort-pattern>, SORT ASCENDING BY <sort-pattern>
    Sort results in ascending order.
    SORT DESCENDING BY <sort-pattern>
    Sort results in descending order.

Notes

    <field> and <string> in HAS and IS expressions should be enclosed in double quotation marks (”) if they include spaces or parentheses.
    If <field> in HAS, IS, GREATER, LESS, EQUAL includes at least one of #$% characters, it will be treated as a title formatting string.
    Example: %codec% IS MP3
    If <field> in HAS, IS, GREATER, LESS, EQUAL does not include any of #$% characters, it will be treated as a metadata field.
    Example: artist IS Radiohead
    Note that you can't access technical information (such as codec specifications) or component-provided information (playback statistics and such) this way.
    Using title formatting strings instead of simple field names will decrease search speed on large libraries and break multiple field value handling in the IS operator - for example, a track with two artist names: “name1” and “name2”, will be found by artist IS name1 query, but not by %artist% IS name1.
    To control the evaluation order of composed queries, enclose the individual expressions in parentheses.
    Example: ( (artist IS blah) AND (title HAS blah) ) OR (%rating% GREATER 3)
    All search expressions are not case-sensitive. All keywords must be uppercase.

Operator Summary
Operator Syntax Comment
AFTER <time1> AFTER <time2>
AND <expression1> AND <expression2>
BEFORE <time1> BEFORE <time2>
DURING <time1> DURING <time2>
DURING LAST <time> DURING LAST <number> SECONDS/MINUTES/HOURS/DAYS/WEEKS
<time> DURING LAST SECOND/MINUTE/HOUR/DAY/WEEK
EQUAL <field> EQUAL <number>
GREATER <field> GREATER <number>
HAS <field> HAS <string>
* HAS <string>
IS <field> IS <string>
LESS <field> LESS <number>
MISSING <field> MISSING
NOT NOT <expression>
OR <expression1> OR <expression2>
PRESENT <field> PRESENT
SINCE <time1> SINCE <time2>
SORT BY SORT BY <sort-pattern>
SORT DESCENDING BY <sort-pattern> Must be at the end of the query.
Title: Re: foo_random_pools
Post by: anamorphic on 2018-07-27 07:35:02
^ Those documents are also on the wiki with a bit more detail -

Query Syntax (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Query_syntax)
Title Formatting Reference (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Titleformat_Reference)

@YAP7
Title: Re: foo_random_pools
Post by: YAP7 on 2018-07-27 13:55:09
I've made great progress. However I seem to be stuck again. When I add tracks from all pools all tracks will be selected from the just one group.

These are my definitions:
A
Group: $strcmp($lower($directory(path)),'tempo')
Number of groups to add: 1
Filter: ("$num($meta(TEMPO),1)" GREATER 179)
Filter with the content of target pl: yes
Number of minutes to add: 10
Sort/limit each group: yes
B
Group: $strcmp($lower($directory(path)),'tempo')
Number of groups to add: 1
Filter: ("$num($meta(TEMPO),1)" GREATER 100) AND ("$num($meta(TEMPO),1)" LESS 180)
Filter with the content of target pl: yes
Number of minutes to add: 50
Sort/limit each group: yes

With these settings, the 50 minutes of tracks will be added from group B, none from group A. Setting "Number of groups to add: 2" in both groups, 10 minutes of tracks will be added from group A.
I can of course circumvent the problem by just clicking twice but I'd rather understand what I'm doing wrong.

Thanks in advance.
Title: Re: foo_random_pools
Post by: fbuser on 2018-07-27 18:14:46
I've made great progress. However I seem to be stuck again. When I add tracks from all pools all tracks will be selected from the just one group.
Of course, that is how it is designed.
Title: Re: foo_random_pools
Post by: YAP7 on 2018-07-27 18:20:47
My bad, it was my understanding that "all pools" would indeed mix all of them together, proportionally, based on the priority field.
As I said then, it will be two clicks instead of one. :)
Title: Re: foo_random_pools
Post by: tipar on 2018-09-03 18:20:41
Hi. I wanted to make a sort of Spotify's Instant Mix (left out from Spotify from a couple of weeks ago); I want to know if my way is the closest I can be from the Instant Mix-like playlist, have you got more ideas? I used:

First of all, I went to Lastfm to check my top ten artists. I created ten pools, one for each artist with the next configuration:
Quote
Group: %all%;
Filter: artist HAS <yourartist>;
Priority: 1;
Number of tracks to add: 1

My idea here is to check the artists of my top ten on Lastfm from time to time to adjust the pools.

Then I created another pool with the next configuration—each <yourartist> represent one of the top ten artists that already have been added on the previous step so you do not want them on this pool playlist:
Quote
Group: %all%;
Filter: %play_count% LESS 5 AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>" AND NOT artist HAS "<yourartist>"
Priority: 2
Number of tracks to add: 5

In addition, I set to 10 the ''Add, when the playlist has X items or less'' to my playlist Instant Mix.

The next thing I did was going to ''Playlist attributes'' and set the playlist Instant Mix to "Remove and Skip played tracks".

Then I set Foobar2000 in shuffle mode and press Random Pool, start listening and that is all.

I think that this is the closest mode to Spotify's Instant Mix. I thought about to leave playback "default" but his will cause that the five songs pool would reproduce in a row and for me was better to mix it with the other pools so, for instance, F2K would reproduce two of the five and six of the others and one of the five and four of the others and so on. I mean it will, indeed, mix them. In addition, this configuration will cause to fill the playlist in a way that it may not be full of my top ten artists in a given time because it will only add songs when ten songs are left.

Regards.
Title: Re: foo_random_pools
Post by: tipar on 2018-09-06 17:52:23
I have made another pool given that the Daily Mixes and not Instant as I called them adapt to the songs or artists you have been listening in the last couple of days so I decided to go with:

Quote
Group: all
Filter: %last_played% DURING LAST 9 DAYS AND NOT %last_played% DURING LAST 2 DAYS
Priority: 1;
Number of tracks to add: 3

This will add songs heard during last week without counting the last two days before today.

Title: Re: foo_random_pools
Post by: zoumbro on 2018-09-12 10:50:48
what am i doing wrong. Random pools seems not working.
Please advice me some settings, updates, etc
Title: Re: foo_random_pools
Post by: fbuser on 2018-09-12 18:57:12
what am i doing wrong.
You didn't provide any details regarding your problem.
Random pools seems not working.
It does.
Please advice me some settings, updates, etc
Without any further details: no chance.
Title: Re: foo_random_pools
Post by: Ryrynz on 2018-11-15 03:16:45
Just trying to figure this out, I have a random pool called Anime 3+ which looks to select a bunch of random anime style songs that are rated 3+.  In Filter I have %Genre% HAS "Anime" AND %Rating% GREATER 2 and Number of Tracks to add is 5. If I click File - Random Pools Anime 3+ I get 1-5 tracks and they're not random at all, most are from the same album.
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-15 21:24:52
This sounds like you have only a few files in your media library. How many tracks do you get, if you search with the specified filter using the menu "Library -> Search"?
What is are your other settings, especially the setting for "Group"?
Title: Re: foo_random_pools
Post by: Ryrynz on 2018-11-17 06:04:22
Hundreds. What am I doing wrong? https://i.imgur.com/i12kv4A.jpg
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-17 10:39:40
With your settings, you will get up to 5 random tracks from a random album. If you want to have just 5 random tracks you need to group by a tag, which has the same value for each track. This is also the case for any non-existing track, like %all% or %library%, as the title format result in such a case is just a ?
Title: Re: foo_random_pools
Post by: takora on 2018-11-21 23:52:18
I'm searching for a plugin which can create playlists with artist and song repeat protection. But I don't know how to configure random_pools because I got no programming skills. My media library has 49 folders (13 of them are different VA folders). 1372 songs. No folder has less than 18 songs or more than 77 songs. In random_pools I configured 49 groups with autoadd, when the playback position is 1 items or less from the end. Figured out how to get my playlist populated and gave it a try. But I didn't like the results. Within an hour, I got 3 different songs from the same group (which has 24 songs total) and no songs from the biggest groups. All groups are configured similar:
group = %directoryname%
number of tracks to add = 1
determine probability for picking groups based on group size = yes
number of groups to add = 1
filter = %path% HAS "some-string-from-directory-name"
filter with the content of the target playlist = yes
sort/limit each group = yes (but no rules are defined)
priority = 1

And my question is - is it possible to configure this plugin so that within 2 hours no artist are repeated? Total playing time of my library is about 91 hours and no artist has more than 32 songs. Of course I'm probably doing it completely wrong because lack of programming skills...
Title: Re: foo_random_pools
Post by: mgpai on 2018-11-22 04:43:32
(https://i.imgur.com/eE41jXP.gif)

From the 6 groups created by this, I was hoping to get 1 track each from the 3 largest groups (total 3 tracks) at any given time, but I am getting all 3 tracks from 1 largest group.
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-22 20:36:49
And my question is - is it possible to configure this plugin so that within 2 hours no artist are repeated?
No, this is not possible.

From the 6 groups created by this, I was hoping to get 1 track each from the 3 largest groups (total 3 tracks) at any given time, but I am getting all 3 tracks from 1 largest group.
Also this is not possible.
Title: Re: foo_random_pools
Post by: takora on 2018-11-22 20:51:36
If I use option "Add, when the playback position is 1 items or less from the end" and the option "Determine probability for picking groups based on group size" is selected - random_pools will see all the songs (and artists and albums) which were played before. But you say, it can't understand what is artist repeating and how to avoid it?
Title: Re: foo_random_pools
Post by: mgpai on 2018-11-22 21:47:00
From the 6 groups created by this, I was hoping to get 1 track each from the 3 largest groups (total 3 tracks) at any given time, but I am getting all 3 tracks from 1 largest group.
Also this is not possible.

Thanks for the clarification. It was not clear from the description, which said picking groups, which led me to believe it will pick more than one.

...  is it possible to configure this plugin so that within 2 hours no artist are repeated?

Should be possible if you have enough number of artists in your library.

Set group to %artist%
Disable 'Determine possibility for picking groups based on group size'
Number of groups to add: (Should be equal to or greater than the number of artists in your library)
Number of tracks to add: 1
Enable Limit after sorting
Sort: $rand()
Enable Sort/Limit each group
Enable Filter with content of the target playlist
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-22 22:14:07
It was not clear from the description, which said picking groups, which led me to believe it will pick more than one.
Yes, it does. But all groups are independent from each other if you check "Determine probability for picking groups based on group size", while distinct groups are picked, if this option is not checked. In both cases this is not want you want to achieve.
Title: Re: foo_random_pools
Post by: mgpai on 2018-11-22 22:26:56
It was not clear from the description, which said picking groups, which led me to believe it will pick more than one.
Yes, it does. But all groups are independent from each other if you check "Determine probability for picking groups based on group size", while distinct groups are picked, if this option is not checked. In both cases this is not want you want to achieve.

OK. I was hoping to have a single pool where the priority is calculated automatically based on size, rather than having six different pools,, in which case I have to set the priority manually once in a while based on the  number of tracks (which keeps changing) in each group. It's fine though. Thanks again for your reply and the wonderful plugin. :)

P.S: Also because, with six pools I have to set/change the filter (usually same) six times. :)
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-22 22:31:18
...  is it possible to configure this plugin so that within 2 hours no artist are repeated?

Should be possible if you have enough number of artists in your library.

Set group to %artist%
Disable 'Determine possibility for picking groups based on group size'
Number of groups to add: (Should be equal to or greater than the number of artists in your library)
Number of tracks to add: 1
Enable Limit after sorting
Sort: $rand()
Enable Sort/Limit each group
Enable Filter with content of the target playlist
Indeed, with this approach you can come at least close to the reqeust von @takora. But if the number of artist in the library increases, you need to adjust the pool settings accordingly each time. Furthermore, if the number of groups to add becomes too big, you can run into serious performance problems.
Title: Re: foo_random_pools
Post by: takora on 2018-11-23 04:58:05
I tried it with your options, but now I got only one item in my playlist and it would not increase. :D
Title: Re: foo_random_pools
Post by: mgpai on 2018-11-23 06:31:37
I tried it with your options, but now I got only one item in my playlist and it would not increase. :D

Can you please post a screenshot of your settings?
Title: Re: foo_random_pools
Post by: takora on 2018-11-24 18:36:06
It's my mistake. I tried again

group - %artist%
determine probability... - no
number of groups to add - 62
number of tracks to add - 1
limit after sorting - yes
filter - nothing there
filter with the content of the target playlist - yes
sort - $rand()
sort / limit each group - yes
priority - 1

Now I got 62 songs and no artist is repeated (so far), but there is a problem. Most of the songs in generated playlist are from Various Artists albums (only 10 songs are from non-Various Artists albums). But in reality Various Artists albums are less than half of my library. And so the majority of artists got virtually no playtime. I tried to increase number of groups to 128 but with same results.
Title: Re: foo_random_pools
Post by: kode54 on 2018-11-24 21:08:27
Well, you need to adjust your settings, as it appears to have picked out exactly one song by each artist, no more, no less.
Title: Re: foo_random_pools
Post by: takora on 2018-11-24 21:15:23
Sure... Asking for advice, as always. Maybe it has something to do with the fact that in my collection only Various Artists albums got Album Artist tag? (Just a very wild guess...)
Title: Re: foo_random_pools
Post by: fbuser on 2018-11-24 22:39:40
Most of the songs in generated playlist are from Various Artists albums (only 10 songs are from non-Various Artists albums).
That is no big suprise. A Various Artists albums with 20 tracks has usually 20 different artists, so you would need 20 "normal" albums from 20 different artists to have a 50% probability to pick an artist, which is not on a Various Artist album.

You could define two pools like the one you already have, with the following differences:

Pool 1 (for the normal albums):
filter: album artist MISSING
number of groups to add: The number of tracks you want to have from this pool

Pool 2 (for the Various Artists album):
filter NOT album artist MISSING
number of groups to add: The number of tracks you want to have from this pool

After adding a bunch of tracks from both pools to the same playlist you can mix the results with "Edit -> Sort -> Randomize"

Title: Re: foo_random_pools
Post by: kode54 on 2018-11-24 22:51:03
62 tracks also seems like about right for the collection you have, if you have an average of 22 tracks per artist.
Title: Re: foo_random_pools
Post by: mgpai on 2018-11-25 21:19:18
Most of the songs in generated playlist are from Various Artists albums

If the %album artist% tag is present only in your VA albums, you can use $if(%album artist%,%album%,%artist%) to reduce the number of tracks picked from VA album. May result in artist repetitions, but they will be very limited. Total number of groups (tracks) added will also be reduced, depending on average tracks per artist, and the total number of VA albums in your collection.
Title: Re: foo_random_pools
Post by: takora on 2018-11-25 21:20:05
With some tweaking I found the balance when 40 songs are selected from non-Various Artists albums and 22 songs from Various Artists albums. It's more than 4 hours playlist and no artist or song were repeated. But I'm beginning to believe that if I try to get more songs into my playlist there will be trouble. My library structure is not that simple and it includes non-album singles from Various Artists albums (I'm talking about the same artists that are mostly represented with non-Various Artists albums). Anyway, I will try it to see what the results are.
How the radio stations are doing it? Well, first you define some amount of "boxes". Then you put similar songs in the same boxes and define the boxes' order. For example, if I put similar and/or related artists in the same boxes, then there is no way the artist will be repeated before 1 song from all other boxes have been played. In my case, it would be over 4 hours. And the radio station software usually has some kind of additional artist and song repeat protection. Don't know how the song repeat protection works, though. But I guess all songs with the same title are considered the same song.
Thank you all for your patience and advice but I'm afraid random_pools can't replace commercial playlist generator. As they will work very differently. Random pools vs fixed order boxes.
Title: Re: foo_random_pools
Post by: OlegYch on 2018-12-22 01:56:21
Hi all
Is it possible to achieve a kind of shuffled playback order which shuffles artists but only plays a one random album at a time?
IE i have 10 artists in playlist, some with 10 albums, and some with only one, and would like to hear each artist with the same probability, but not more than one album at a time.
Currently if i use 'shuffle albums' i listen artists with 10 albums way more often than artists with one.
Or perhaps this is better done in core foobar or some other component?
Title: Re: foo_random_pools
Post by: fbuser on 2018-12-23 07:34:15
Actually, I see no practical way to achieve what you want, neither with this component nor with any other component.
Sure, you could add for example 100 album to a playlist and remove all "duplicate" artists manually afterwards, but this is far away from convenience, error prone and the final result would give you always an unpredictible number of albums.
Title: Re: foo_random_pools
Post by: OlegYch on 2018-12-23 19:05:03
Thanks, fbuser. I'll try with core foobar.
Title: Re: foo_random_pools
Post by: Daeron on 2019-03-02 04:52:08
Any chance of implementing a global filter which will be appended to each individual pool automatically?

For example, this filter is identical among all my pools:
Code: [Select]
%length_seconds% GREATER 120 AND %length_seconds% LESS 300
Maintaining these during experiments means manual editing and copy-pasting to every pool I have to propagate changes. This is a fairly redundant and painful process if you have more than a couple of them.
Title: Re: foo_random_pools
Post by: Erratic on 2019-05-16 17:16:52
Sorry, user error. :| Ignore post.
Title: Re: foo_random_pools
Post by: Arrivest on 2019-08-22 22:40:33
Hi, I'm a new user of this plugin and it's so amazing! Thanks so much!

I have a particular pattern to listen to my songs and wonder if it can be achieved.

Say I have a folder "D:\to be listened" which contains 10000 songs, I want to randomly take 10 songs from it, listen to them in a playlist, and then for each of them I'll make a decision between either "I like it, move the file to D:\good" or "I don't like it, delete the file from disk". No matter which I choose, the song is removed from the playlist, and also the original folder.

This is my mission, pretty straight forward. It's the simplest pool setting and I already got it working. In the end I imagine the 10000 songs will turn into 1000 songs in D:\good. 

Now my question is, as I am removing songs from the playlist, the playlist shrinks. I'll need to replenish them manually. I hope there's a way to automatic replenish so it keeps at 10 songs, and every time I delete one, a new random one would be automatically added. I tried playing with the auto add feature, but didn't get it to work. I must be missing something really obvious. How should it be done? Thanks so much!
Title: Re: foo_random_pools
Post by: fbuser on 2019-08-23 18:55:03
Is your folder part of the media library? If not auto add can't work. If yes, please post your settings here.
Title: Re: foo_random_pools
Post by: Arrivest on 2019-08-24 16:24:09
I have to admit that because my goal is so simple, I just made the simplest setting that works, without properly learning it:
1. My media library contains only one folder, which is "D:\to be listened" - because I don't use media library for any other purposes other than random pool.
2. I have only 1 pool, and configured this way: Group: %% , Number of groups to add: 1; Limit: 10 0 0 ; Filter: empty ; Sort: empty
Now I'm able to use the "File" menu to add 10 random songs into current playlist.

What I wish to have is whenever I delete a song from the playlist, a new random song is replenished, so that the playlist maintains 10 songs. What I tried: in Autoadd, I picked the desired playlist from the dropdown, then put 10 0 0.  And of course that doesn't work, I think I'm missing some fundamental knowledge about how this component works.
Title: Re: foo_random_pools
Post by: fbuser on 2019-08-24 17:04:54
Three things:
1. You didn't mention the setting for Priority. Therefore and because of the not working Autoadd, I guess it's still 0. As Autoadd is picking its tracks from all pools with a priority greater than 0, you need to increase this value, no matter to what.
2. With your settings for Limit you always add 10 songs to the playlist, when the Autoadd condition is met.  So you probably want to set it to 1 0 0.
3. You should also tick "Filter with the content of the target playlist", if you want to avoid duplicates tracks in the playlist.
Title: Re: foo_random_pools
Post by: Arrivest on 2019-08-24 17:39:17
OMG it's now working!!!!!!! Exactly in the way I hoped, Like a charm!!!!! Thanks so so much!!!!!!!!!!!
Title: Re: foo_random_pools
Post by: bouchacha on 2019-11-28 18:04:55
I use random_pools to jury-rig a "next random album" button that I wish already existed within foobar. The way I have it set up is through a script that clears the playlist, then hits play. As it's set up, random_pools kicks into gear by automatically adding a new random album anytime the playlist is cleared. So far so good.

The only real issue I have is a surprisingly high number of repeats. I saw above the thread ways to get rid of duplicates but that involves summoning the entire pool all at once, and if I do that I won't be able to use my hacked up 'skip to next album' button. Does anyone have a suggestion? Either for random_pools settings or  a better method for a "Skip to next random album" button?
Title: Re: foo_random_pools
Post by: El Kabong on 2020-01-24 19:21:18
Hi all, people!
I'm a longtime f2k user, and been using RP almost from the very beginning of it. (A must-have component, let me say).
Well, technologies have grown way too long and now I see myself forced to jump into the Android version of f2k and (obviously) I would like my RP there too. :D
Do you know if it's fully implemented. If not, will it be?

Thx in advance!
Cheers!

Title: Re: foo_random_pools
Post by: fbuser on 2020-01-24 19:37:47
Do you know if it's fully implemented.
No and there is currently no public SDK, which would make it possible. But even it will be possible in the future,
If not, will it be?
most likely not. At least not from me, but, of course, it would still be possible, that someone else would create a similar plugin for Android.
Title: Re: foo_random_pools
Post by: cipher_nemo on 2021-01-25 20:15:38
I know this thread is a year old, but I just started using this and I am a bit confused with it. I used to use Shuffle (tracks) and noticed how it can reset that shuffle in between sessions of Foobar, which means I end up hearing the same tracks sometimes over and over again before hearing all of the tracks on a playlist. So I had enough of that and thus found random pools.

I got it working: to fill a new playlist with a random sorting of all files from my library. But to do so, I had to manually set the "Number of groups to add" to the total track count and the "Group" to "%folder% - %title%" since the tracks I want to play are organized by folder (artist) and filename (title). This works, but it would be nice not to manually set the number of groups. If it's set to 1 here, it just adds one track.

I tried setting "Group" to %library% to grab everything, then the "Number of groups to add" only needs to be set to 1 and it works, but the randomness is really odd. It starts off random (different tracks from different folders), then it starts to lump entire folders together towards the end. So I'd have one folder with may be two dozen tracks all added to the bottom of the playlist, not anywhere else. For this I have nothing in Filter, nothing in Sort, and "Sort / limit each group" unchecked. Also Limits are all set to 0 to make sure there's no limit. Pretty much everything unchecked.

So, what's the simplest way to fill a new playlist with a random list of all tracks from my Library? Am I missing something? Thanks.
Title: Re: foo_random_pools
Post by: fbuser on 2021-01-25 21:11:22
I got it working: to fill a new playlist with a random sorting of all files from my library. But to do so, I had to manually set the "Number of groups to add" to the total track count and the "Group" to "%folder% - %title%" since the tracks I want to play are organized by folder (artist) and filename (title). This works, but it would be nice not to manually set the number of groups.
Actually, this is not the purpose of this component and you are "misusing" the component a bit.

I tried setting "Group" to %library% to grab everything, then the "Number of groups to add" only needs to be set to 1 and it works, but the randomness is really odd. It starts off random (different tracks from different folders), then it starts to lump entire folders together towards the end.
This sounds strange and does normally not happen. But it's not necessary to go deeper into it as your goal can be achieved much easier:

Add all tracks in your library to a playlist, e.g. by using ALL as query expression. Then select all tracks and execute "Edit -> Selection -> Sort -> Randomize) and start playback in default order.
Title: Re: foo_random_pools
Post by: cipher_nemo on 2021-01-25 21:33:18
I got it working: to fill a new playlist with a random sorting of all files from my library. But to do so, I had to manually set the "Number of groups to add" to the total track count and the "Group" to "%folder% - %title%" since the tracks I want to play are organized by folder (artist) and filename (title). This works, but it would be nice not to manually set the number of groups.
Actually, this is not the purpose of this component and you are "misusing" the component a bit.

I tried setting "Group" to %library% to grab everything, then the "Number of groups to add" only needs to be set to 1 and it works, but the randomness is really odd. It starts off random (different tracks from different folders), then it starts to lump entire folders together towards the end.
This sounds strange and does normally not happen. But it's not necessary to go deeper into it as your goal can be achieved much easier:

Add all tracks in your library to a playlist, e.g. by using ALL as query expression. Then select all tracks and execute "Edit -> Selection -> Sort -> Randomize) and start playback in default order.
Thank you! I was overthinking this and using a plugin that was meant for far more than just a random sort. I stumbled across this plugin because someone online recommended it as a solution to the same issue I faced with the shuffle track play mode. Thank you for providing a much easier solution. :-)
Title: Re: foo_random_pools
Post by: richard3840 on 2021-10-03 08:28:28
I have been using random pools for some time to be able to play songs i like more often than others.

Normally you can define that a specific rating will be played this often compared to other ratings.
But another factor that's good to have in the equation is in how many songs there are with that rating compared to how many there are with other ratings.
No need add a song with rating:3, 20% of the time if it there aren't enough songs with that rating to fill 20% of your listening time. Then you end up hearing the same song more often, for that rating than for other ratings.
I wanted to calibrate the priorities to adjust for that.
I made a spreadsheet for this purpose. Sharing it here in case anyone find it useful.
https://docs.google.com/spreadsheets/d/1kFRW_mjHCAFN1p7XlKMScJcCbGheO_sQPmVDdRTxFD8/edit#gid=842793885 (https://docs.google.com/spreadsheets/d/1kFRW_mjHCAFN1p7XlKMScJcCbGheO_sQPmVDdRTxFD8/edit#gid=842793885)

Green cells are for manual input. Everything else is calculated.
Title: Re: foo_random_pools
Post by: samuelawachie on 2021-10-27 10:51:11
Hello. I've had this component since the day I installed Foobar2000 and I've never really used it before.
I have always been intrigued as to how it works and what use-case I could need it for.
I had another problem with how Foobar does its Shuffle options that is detailed in this thread: https://hydrogenaud.io/index.php?topic=121029.0
Someone on there recommended that I could achieve my aim by using this component. Unfortunately though, I don't know how to use it and don't have any experience using it at all.
How do I achieve what I detailed in that other thread? (Shuffling "artist" category but only as artists not as the songs in that category).
Thanks
Title: Re: foo_random_pools
Post by: onanboy on 2022-02-05 20:13:15
Yeah, I know that this is a pretty old thread but I will try anyways.

I want to randomly pick from my list of albums that still need Replay Gain applied to them.  I tried this but nothing loads.

Using the filter %replaygain_album_gain% IS MISSING

FYI, Group is %album%
# of groups to add is 3
sort is  %path_sort%

My other pools load fine so it must be in the filter expression.

TIA
Title: Re: foo_random_pools
Post by: fbuser on 2022-02-05 21:49:02
My other pools load fine so it must be in the filter expression.
You're guessing right. The correct filter expression is:
%replaygain_album_gain% MISSING
Title: Re: foo_random_pools
Post by: onanboy on 2022-02-05 23:09:02
That works.

I could have sworn that I tried that version but it brought up stuff that did have a RG value so I assumed the expression was incorrect.

Thank you fbuser.  This is one of the most useful plugins I have ever used.
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-13 09:36:59
A new version is out. Please, check the first post for details.

Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-18 14:41:15
With the new version I always get a crash, when I select from the file menu Random Pools -> (my pool)

Further testing shows: crash vanishes after adding foo_sqlite. So either this should be a requirement, checks need to be improved, or I am facing a local problem, which is only exposed in this specific constellation
Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-18 15:33:17
So a limitation with the random pools I discovered is, that the combination of autopopulating a playlist with a number of songs when using multiple pools and the playlist is empty, will always add from pools equally, when I select "Number of Chosen Pools" equalling the pools in the pool set.
However, when setting the Number of Chosen Pools to 1, the random pool functionality will add the number of songs to auto add all from the SAME pool. This is not a problem, when the pool fills up bit by bit, one song at a time. Each time a new song is added (for example because the playback position is X items or less from the end), a new pool is picked and then a new song is added.

This might be a niche usecase, and I can work around that. However it would be nice, if I could set "Add when the playlist has X items or less" to 20, so that 20 songs are added, and the songs are picked one-by-one from the pools according to the priority of the pool.

The limitations only shows when a whole set of items is added at the same time from the pools, because then only one pool gets picked, and all songs are added from that one pool.
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-18 18:22:59
Further testing shows: crash vanishes after adding foo_sqlite. So either this should be a requirement, checks need to be improved, or I am facing a local problem, which is only exposed in this specific constellation
Most likely the crash is caused by a missing check. If possible, could you please post a crash report here. The definition of your pool set could also be helpful to figure out the crash cause.
Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-18 20:43:18
Here are some crash reports and dumps.
This actually happens with very simple pools on my end.

For testing purposes I have this test pool setup: https://imgur.com/a/f0rSmBi
In the test pool, each pool actually only contains one song, and there is no filtering on the target playlist. I wanted to figure out how the pools were behaving when I was initially populating playlist.

My "productive" pool is a bit more complicated: https://imgur.com/a/2615Tki
As you see there is a bit more going on, but it all relates to songs within a certain path and then filtering on the rating. There is no internal grouping being used on the pools in the pool set.

Crashes would occur for either of them
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-19 12:28:30
Here are some crash reports and dumps.
Thanks a lot for your efforts. The problem is fixed now in version 1.0.1.
So a limitation with the random pools I discovered is, that the combination of autopopulating a playlist with a number of songs when using multiple pools and the playlist is empty, will always add from pools equally, when I select "Number of Chosen Pools" equalling the pools in the pool set.
However, when setting the Number of Chosen Pools to 1, the random pool functionality will add the number of songs to auto add all from the SAME pool. This is not a problem, when the pool fills up bit by bit, one song at a time. Each time a new song is added (for example because the playback position is X items or less from the end), a new pool is picked and then a new song is added.
It's actually not a limitation as it works exactly as designed.

This might be a niche usecase, and I can work around that. However it would be nice, if I could set "Add when the playlist has X items or less" to 20, so that 20 songs are added, and the songs are picked one-by-one from the pools according to the priority of the pool.
This doesn't appear logical to me. If you choose to add tracks only from one pool you can't add just one song from each pool.
Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-19 14:12:28
Quote
This doesn't appear logical to me. If you choose to add tracks only from one pool you can't add just one song from each pool.
<-- this is correct. But if I select all pools, items from the pools are not added according to the probability of the pools. If you see my testpool set with 3 pools, and I select all 3 pools and add a whole bunch of items (like 20, because the playlist is empty and I select that it should have at least 20 items), items are added from the three pools equally instead of according to their priority.

As I said,  this is a kinda niche usecase, and I can workaround it by simply binding a key and adding the items one by one.

At the moment I do not have the option, to automatically add 20 items chosen from a poolset at once, items to be selected from all pools according to pool priority. I have to do it one-by-one.

And thank you for the fixes. I am happy I could provide some help. Awesome work on this plugin.
Title: Re: foo_random_pools
Post by: o rly owl on 2022-03-20 09:07:31
Hey! First of all, thanks for making & supporting this plugin. I barely listen to music normally now, I just have my random playlist (via random pools)  that I use to listen the majority of my library  :D

After I've upgraded to 1.0.1, I have noticed something similar that nthmetal is describing: when I populate an empty playlist, priorities don't seem to be respected and each pools is inserted once. This seems to be different from previous versions where pool would be inserted based on priority.

See my setup screenshots attached: notice how in the previous version, Filtered pool (represented by ✔✔✔✔) appears quite often (given that its the highest priority). Whereas in the latest version each Pool is inserted once until the limit of 50 songs is reached.

To replicate this:
I go to my _MonteCarlo playlist, clear it completely, drag a random song in and play it. Usually, performing these steps are enough to trigger the playlist population

When I've upgraded to 1.0.1, my previous settings didn't change. The only thing I needed to tweak is to tick the Media library checkbox in all of my pools. This fact alone makes me think that it should work as it did before but it doesn't - is it a bug or some of functionality has changed? If it's the latter, how can I restore the previous version's behavior to respect the priorities while populating?
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-20 18:36:10
At the moment I do not have the option, to automatically add 20 items chosen from a poolset at once, items to be selected from all pools according to pool priority. I have to do it one-by-one.
Actually, you don't need to do this manually. This will be done automatically, if you set the number of pools to add to 1.

However, you might have the impression, that only one track is added. I now noticed, that in such a scenario quite fast the result from the first queried pool is added to the playlist, but the results from all other queried pools are collected and will be added afterwards at once. Depending on the number of queried pools it might take long enough to give you the impression, that the pools in a poolset are queried only once. You should be able to see relevant messages in the console, directly after a pool was queried.

This is not really the intended behavior, but it is probably caused by internal changes. I will see, if this slightly odd behavior can be changed to avoid confusion.

The only thing I needed to tweak is to tick the Media library checkbox in all of my pools.
You really need to do this manually? Actually, this should've happened automatically.

This fact alone makes me think that it should work as it did before but it doesn't - is it a bug or some of functionality has changed?
See above for an explanation.

If it's the latter, how can I restore the previous version's behavior to respect the priorities while populating?
Set the number of pools to be added for the pool set to 1. Having the possibility to add more than one pool is a new feature, which gives you the possibility to ensure to get results from different pools, which wasn't possible in the previous version. Setting this value to 1 gives you exact the behavior of the old version.

I will rename the option to "Number of different randomly chosen pools to add" to make this clearer although it is described like that in the help file:
Quote
The number of pools to get items from for sending to the target playlist. Each pool will be only chosen once and the maximum number of pools is the number of pools in the pool set even if a bigger number is specified. The pools will be chosen based on their priority, pools with the priority 0 will be ignored.
Title: Re: foo_random_pools
Post by: o rly owl on 2022-03-21 10:04:05
Thank you for your response!

Quote
Set the number of pools to be added for the pool set to 1
That doesn't seem to work for me unfortunately. See the attached screenshot & log. It seems that selecting 1 pool will do just that: pick 1 pool and populate the playlist with songs matching that one pool. However, that's not what I want: I want to have a random playlist composed of randomly selected songs from all pools based on their priority.

So in this regard, the previous version (where I had Number of randomly chosen pools to add = 8 ) was bringing me closer to where I wanted to be. The only thing missing was the priority: I'm expecting my Unplayed penalised pool to appear very rarely (because it has such a low priority) whereas on 1.0.1 songs from that pool show up every 5th position. 0.1.5 did what I wanted: songs from Unplayed penalised appeared very rarely in a generated playlist - is it possible for it to work the same way in 1.0.1?

Maybe it's conflicting with other components somehow? I don't understand it completely but I think it's related with
Quote
you might have the impression, that only one track is added. I now noticed, that in such a scenario quite fast the result from the first queried pool is added to the playlist, but the results from all other queried pools are collected and will be added afterwards at once.
This is what I see as well - a single song gets added and then the rest of the playlist gets populated in one go.

Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-21 13:14:56
That doesn't seem to work for me unfortunately. See the attached screenshot & log. It seems that selecting 1 pool will do just that: pick 1 pool and populate the playlist with songs matching that one pool. However, that's not what I want: I want to have a random playlist composed of randomly selected songs from all pools based on their priority.

That is exactly the behavior I monitored. If you use a pool similar to my testpools, with each pool in the poolset populated by exactly one song, you can easily see that, because the second layer of randomness (picking a song from the chosen pool) is elimiated.

The first screenshots shows the configuration of the poolset.
X
The second shows, what happens when the playlist is then autopopulated after I manually added one song from the pool. As you can see, all the 100 other songs come from the pool "summer", which evaluates to only one song, instead of using all pools.
X
This behavior is reprodudible: Just empty the playlist and watch it automatically fill up with 100 songs. Or add one song manually then watch it fill up.

In contrast, if I alter the setting "Number of Randomly chosen Pools to add" to 3, all pools are used equally:
X

Maybe both behaviors are as according to configuration, however I think user expectation would be different.
O mayber we need an additional option, that when adding a whole number of songs at the same time, after one song is chosen from a pool, the pool selection must be repeated anew, before adding the next song. Moving on like that step by step for each song (or set of songs, in case more than one pool is chosen) until the desired number of songs in the playlist is reached.
This would also make the behavior consistent between initially filling up an empty playlist with 100 (or 20, or whatever you chose) songs in comparison to, when they fill up one by one, because, for example the minimum of remaining songs to the of the playlist is hit.
Title: Re: foo_random_pools
Post by: onanboy on 2022-03-22 19:31:35
My other pools load fine so it must be in the filter expression.
You're guessing right. The correct filter expression is:
%replaygain_album_gain% MISSING

Okay I have something that is not working the same as before the upgrade.  My pool is made up of all of the albums that don't have Replaygain settings yet.  It will load three albums w/o gains like it did before, but now when I apply a RG to an album it doesn't disappear like it did before.  Is there something I forgot to check?
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-22 19:46:55
Is there something I forgot to check?
No, it should work as before, but it might be related to the problem, which was reported by @nthmetal and @o rly owl. Meanwhile I could reproduce the problem and I'm working on a fix.
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-23 21:24:08
@onanboy : I uploaded a new version mainly with the fix for the recently reported problems. However, at least with this new version I cannot confirm your problem. Could you please try again with the new version and let me know the result?
Title: Re: foo_random_pools
Post by: onanboy on 2022-03-24 14:10:12
@onanboy : I uploaded a new version mainly with the fix for the recently reported problems. However, at least with this new version I cannot confirm your problem. Could you please try again with the new version and let me know the result?

In my case it still doesn't disappear an album after I apply the Replaygain numbers. However, I am a idiot when it comes to proper setup. I am sure that it is me and not you that is causing my issue.

(https://i.imgur.com/UgmeImF.png)

(https://i.imgur.com/jbn9Md9.png)
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-24 18:11:01
I am sure that it is me and not you that is causing my issue.
I'm not that sure. What I understand from your description is actually impossible. But maybe you mean something different. So, could you please also describe exactly what you are doing with an example what you get as final result and what you expect?
Title: Re: foo_random_pools
Post by: nthmetal on 2022-03-24 18:27:13
@onanboy : I uploaded a new version mainly with the fix for the recently reported problems. However, at least with this new version I cannot confirm your problem. Could you please try again with the new version and let me know the result?
Great work, this makes the plugin just that tiny bit greater than it already was. :D
Title: Re: foo_random_pools
Post by: onanboy on 2022-03-24 19:16:51
I am sure that it is me and not you that is causing my issue.
I'm not that sure. What I understand from your description is actually impossible. But maybe you mean something different. So, could you please also describe exactly what you are doing with an example what you get as final result and what you expect?

I have a Playlist that I named No RG. I can clear it of all tracks.  Then I choose File>Random Pools>No Gain. It didn't used to but now it pops up a window that makes me select the No Gain pool.

(https://i.imgur.com/kN1x40q.png)

I check the No Gain box and select OK.

It loads three titles.  Usually I listen to the tracks and during the final track I highlight all of the track from the title and then right-click and choose Replay Gain>Scan as single album and then Update the tags after the scan. 

Before it would immeditaley disappear because it no longer qualified as %replaygain_album_gain% MISSING

But now it stays in the playlist until I clear it.
Hope this is clear enough to help.
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-24 20:24:22
Before it would immeditaley disappear because it no longer qualified as %replaygain_album_gain% MISSING
But this was not caused by foo_random_pools. foo_random_pools did never work in this way, that tracks were automatically removed, when the filter didn't match anymore. What you describe is the behavior of an autoplaylist, but it is not possible to add tracks to an autoplaylist. So, you must have used something else to realize the removal of the tracks. Maybe a script in one of the javascript panel components.
But now it stays in the playlist until I clear it.
This is the expected behavior and was also the expteced behavior with the old version.
Hope this is clear enough to help.
It's clear enough, but I fear, that my answers above don't really help you.
Title: Re: foo_random_pools
Post by: onanboy on 2022-03-24 20:42:31
Don't worry about it.  Maybe I am confusing it with the Autoplaylist that is mentioned in the pool list.

Your work is wonderful and still meets my needs.  Thanks for hearing me out and making sure I wasn't doing something dumb.
Title: Re: foo_random_pools
Post by: Sue Dunham on 2022-03-28 16:05:16
I'm getting my old pools set up in the new version (I didn't see that they were already there under Default pool set at first), and I was wondering how best to do it for my purposes. I just have a simple breakdown of five different pools by genre, and I don't actually want to mingle them together. Furthermore, I had made toolbar buttons in a Spider Monkey Panel to add albums from one of the five genres.

So I'm guessing that I want to make five pool sets each with one pool? This would make the File menu look like how it did before and make my buttons function as they did.

My issue then is that I basically don't need to see the Add from pool set dialog and would like to suppress it. Is there a way to do so? I see from your help file that assigning keyboard shortcuts and using those will bypass the dialog, but I'm not sure where that leaves my buttons. It seems a bit hackish to make keyboard shortcuts and investigate some kind of javascript sendkeys functionality for the SMP.

Anyway, between this and all the SQLite stuff, you're a big part of my foobar2000 experience. Many thanks for that.  :D
Title: Re: foo_random_pools
Post by: fbuser on 2022-03-28 18:03:05
So I'm guessing that I want to make five pool sets each with one pool?
Having one pool set with all your pools in is actually, what you had before without the possibility to organize pools in pool sets. Pool sets are just an additional hierarchy level above the pools.

This would make the File menu look like how it did before and make my buttons function as they did.
If it is only for the buttons, then you don't need a file menu entry for each button. See my next answer below for more details.

but I'm not sure where that leaves my buttons. It seems a bit hackish to make keyboard shortcuts and investigate some kind of javascript sendkeys functionality for the SMP.
Of course, but this not necessary. The actions, which are displayed for the keyboard shortcuts, are actually hidden main menu entries. As you are using SMP for your buttons, you could set a button command as follows (just replace the values for the two constants to values that you need):

Code: [Select]
const poolSet = `<pool set>`;
const pool = `<pool from pool set>`;

fb.RunMainMenuCommand(`File/Random pools/Assign keyboard shortcuts/${poolSet}: ${pool}`);
Title: Re: foo_random_pools
Post by: eCo on 2022-05-01 17:31:55
I've recently started using this plugin and love it.  I've been wondering how I could pool my pools, and the new version popped up and voila!  Kudos!

I only do album pools and I'm curious if I can filter a pool to remove duplicate tracks from within albums.  For example, I have many jazz albums that have the same song but alternate 'version' or 'take' - often they're bonus tracks. 

Is there a way to remove these sorta duplicate tracks via the target playlist filter?
Title: Re: foo_random_pools
Post by: fbuser on 2022-05-01 22:30:09
Is there a way to remove these sorta duplicate tracks via the target playlist filter?
No, with this filter it is not possible, as the duplicates are already inside of the group defined by the pool. It would be possible with SQL as source and if the version information is stored in an own tag and not part of the actual title tag. But it is not trivial.

Another possibility would be to add an extra tag to all "duplicates" and just filter them out with the standard filter, if the source is a title format source.
Title: Re: foo_random_pools
Post by: eCo on 2022-05-02 13:37:42
Another possibility would be to add an extra tag to all "duplicates" and just filter them out with the standard filter, if the source is a title format source.
Thanks for the reply - that's what I suspected.  To your latter point, I use Musicbrainz Picard for tagging, so I can write a script to tag tracks with keywords in the title (e.g. "alternate" or "take").  But if I'm using %album% for the pool, will a filter for that tag eliminate the album or just the individual tracks with the new tag?
Title: Re: foo_random_pools
Post by: fbuser on 2022-05-02 18:41:48
But if I'm using %album% for the pool, will a filter for that tag eliminate the album or just the individual tracks with the new tag?
Just the individual tracks.
Title: Re: foo_random_pools
Post by: eCo on 2022-05-02 18:45:09
Perfect.  Thanks again!
Title: Re: foo_random_pools
Post by: AndreaT on 2022-05-20 13:49:56
Hello, I am sorry but I do not understand how to use this component (how to have it working).
Is there a step-by-step instruction document for the absolute beginners?
I am not a SQL expert, nor a programmer... just a regular music listener.
Thanks and regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-05-21 09:24:03
Is there a step-by-step instruction document for the absolute beginners?
No, but there is not that much what is really needed. All options are briefly explained in the help file, which you can find in the help menu. In the end the configuration depends on your actual needs.
I am not a SQL expert, nor a programmer
You don't need SQL at all nor to be a programmer. Although SQL driven pools are more powerful than pure title format pools, there are already a lot of pool definitions possible without SQL. In the end you need SQL only, if you want to use filter conditions, where tracks are picked based on the values of other tracks or if you want to use functions, which are not available in title format, e.g. regular expression functions.

If you have any specific use case and don't know how to define it, feel free to post it here. Possibly you can be helped.
Title: Re: foo_random_pools
Post by: nikolai4ik on 2022-06-05 20:55:27
There's no documentation, I can't get it to work, please help. I want 'rating-weighted' shuffle, is it possible to implement?
These are my settings ,literally nothing happens when I go to file - random pools


OK I figured out GROUP field should be a tag, changed it to %album%. Number of groups to add should be higher than number of something(?) in my library, based on previous posts. I've set it to 9000 in each group and ended up with a playlist of 140k songs (my media library is 20k songs). And I assume if I use foobar's shuffle then the purpose of this component is wasted? So I should just be using the playlist I generated with a normal playback order? Which means songs will never repeat?

So what I want is not possible with this plugin, right?
Title: Re: foo_random_pools
Post by: fbuser on 2022-06-05 21:59:32
There's no documentation
To quote myself:
All options are briefly explained in the help file, which you can find in the help menu.
I want 'rating-weighted' shuffle, is it possible to implement?.
It depends on what you mean with "'rating-weighted' shuffle".

So what I want is not possible with this plugin, right?
It's actually not really clear what you want. You should describe more in detail, what you want to achieve.
Title: Re: foo_random_pools
Post by: nikolai4ik on 2022-06-06 07:07:22
So what I want is not possible with this plugin, right?
It's actually not really clear what you want. You should describe more in detail, what you want to achieve.
[/quote]
Higher rating - higher probability of shuffling algorithm of playing the song.
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-19 19:17:54
Hello "Experts", I am still not able to have random pool working on my setup.

I just would like to create a single playlist of 20 random tracks from my entire library.

Nothing more
Regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-08-19 21:56:15
I just would like to create a single playlist of 20 random tracks from my entire library.
A solution could be:
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-20 20:00:13
Hello @fbuser , thanks for your help, but it is still not running on my setup.
As per my other scripts, "random pool" starts elaborating but never reach the end.
Please see the attached screenshot. The progress bar was running for 3-4 minutes.
Kindly be aware that I am using FB v2 Alpha 2022-08-20 and my library is quite large.
Is there some kind of debugging or log files I can do/collect for you?
Regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-08-21 09:32:27
Kindly be aware that I am using FB v2 Alpha 2022-08-20 and my library is quite large.Is there some kind of debugging or log files I can do/collect for you?
No, thanks, but this is not necessary. Honestly, I was aware, that the proposed solution is not ideal for a large library and it is  even worse for foobar2000 v2. I need to check, if I can implement some performance optimizations for foobar2000 v2.

Anyway, you should get a better performance by changing the following attributes for the pool "20 random tracks" a

The group attribute needs to be a tag, which is not present in your library. If you are using for any reason %library% in your library, you need to choose a different group attribute.

The sorting should actually not be necessary, as the 20 tracks are already randomly picked from the library. But strangely an empty sort attribute seems to have a negative performance impact. This is also something I need to check more deeply.
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-21 15:55:49
Hello @fbuser, thanks, well understood your answer.
FYI, I tried anyway also your new proposed configuration, but I am having exactly the same starving behavior.
I look forward to a final future solution for FB v2.
Kind regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-08-21 16:09:57
FYI, I tried anyway also your new proposed configuration, but I am having exactly the same starving behavior.
How many items does your library have? What are exactly the attributes of your pool? With the new proposed solution I got the result after about 15 seconds with a library of about 900k items for foobar2000 v2.
I look forward to a final future solution for FB v2.
You should not put too much hope on it. There is actually not much room for optimizations.
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-21 16:41:32
Hello @fbuser , my library has a similar size of your testing solution.
Your optimized script takes 45 seconds to complete on my 32bit PC. That's why, in my opinion, it takes anyway to much.
Just to give you a comparison, on the same PC (so also same library, same audio setup and so on), using JRiver MC 29, a similar random playlist is created in less than 10 seconds.
Do you think that installing SQLite would bring any improvement?
Regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-08-21 18:00:50
on my 32bit PC.
So it's probably a quite old and slow PC  ;D

Just to give you a comparison, on the same PC (so also same library, same audio setup and so on), using JRiver MC 29, a similar random playlist is created in less than 10 seconds.
It's quite difficult to make such comparisons. JRiver uses configurable but dedicated rules for creating smartlists while random pools uses title format query syntax, which adds more flexibility but also more overhead. This also leads to not getting always the best approach from the performance point of view for a specific use case. Having this in mind I think the 45 seconds for random pools compared to the 10 seconds of JRiver are explainable.

Do you think that installing SQLite would bring any improvement?
At least on my PC it does. The execution time is reduced by a factor of 10, i.e. 1.5 seconds execution time. For the pool definition have a look at the attached image.

Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-21 20:36:07
Hello @fbuser, that's amazing!
Just 2-3 seconds on my old PC as well!!
Please, recommend to install SQLite to everybody!!
Cheers, Andrea
Title: Re: foo_random_pools
Post by: regor on 2022-08-21 21:41:34
For the record, doing the same with SMP (https://github.com/regorxxx/Playlist-Tools-SMP) on 70K tracks, plus duplicates removal by title|artist|date (reduced to 65K elegible tracks)... takes 500 ms. Just giving options, since some specific use-cases may be covered with other approaches.

Spoiler (click to show/hide)
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-22 13:56:17
Hello @regor, I am sorry but I don't know how to do that within SMP.
Would you be so kind to provide some more details? Or share your scripts?
Regards, Andrea
Title: Re: foo_random_pools
Post by: regor on 2022-08-22 14:40:59
Hello @regor, I am sorry but I don't know how to do that within SMP.
Would you be so kind to provide some more details? Or share your scripts?
Regards, Andrea
I put the link on the reply (also on my sig, Playlist Tools), and the video should be self-explanatory once you install the scripts and got it running.

Further discussion should be handled on its own topic though; I just wanted to add my 2 cents to the performance tests done with random pools, since my scripts essentially use TF and queries too.
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-22 14:44:03
Hello @regor , sorry, I was reading from a smartphone and I missed something.
Regards, Andrea
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-22 16:18:06
Hello @fbuser , ... just a last favor than I will not disturb you anymore...

How to have a similar SQL random pool of 10 albums?

I tried following one of your example of the help file, but I get the message "no table album" as well as "no table artist"...

Kind regards, Andrea
Title: Re: foo_random_pools
Post by: fbuser on 2022-08-23 19:21:06
How to have a similar SQL random pool of 10 albums?
This is a bit more complicated, especially if you want to have a good performance. With the more easier way I get 10 albums in about 35s, with some optimizations I got the 10 album in about 2.5s. So let's have a look at this.


For the mentioned easier way you only need to define the pool as specified in the last point and replace the two occurences of MMediaLibrary by MediaLibrary.
Title: Re: foo_random_pools
Post by: AndreaT on 2022-08-26 14:29:40
Hello @fbuser , thank you so much! It works well even on my old 32bit laptop.
All the best, Andrea
Title: Re: foo_random_pools
Post by: Priest_1 on 2022-09-01 07:03:29
Nice and useful plugin, but what about people who don't have any concept or idea about how works with SQL plugin or about how build SQL database.
So some of us stuck with older and simple plugin of Random Pools.
Title: Re: foo_random_pools
Post by: fbuser on 2022-09-01 18:33:59
Nice and useful plugin, but what about people who don't have any concept or idea about how works with SQL plugin or about how build SQL database.
They simply don't use the SQL feature.
So some of us stuck with older and simple plugin of Random Pools.
You're wrong. The SQL feature is only optional and the current version can be used without. There is no need to use an older version.
Title: Re: foo_random_pools
Post by: Priest_1 on 2022-09-04 14:35:09
Nice and useful plugin, but what about people who don't have any concept or idea about how works with SQL plugin or about how build SQL database.
They simply don't use the SQL feature.
So some of us stuck with older and simple plugin of Random Pools.
You're wrong. The SQL feature is only optional and the current version can be used without. There is no need to use an older version.

Ok. First of all, thank you for sharing this plugin and sacrifice your life time for develop this plugin.
That was misunderstanding of plugin requirements.
Title: Re: foo_random_pools
Post by: cheezopath on 2022-10-01 15:52:43
just signed up to say what a cool plugin this is! being able to pick music in this way really feels like it's refreshed my library.

in the longer term I want to work out how to make a playlist that would walk along camelot numbers, but right now this tool has taken out so much of the legwork in selection. thanks!
Title: Re: foo_random_pools
Post by: regor on 2022-10-01 16:46:35
just signed up to say what a cool plugin this is! being able to pick music in this way really feels like it's refreshed my library.

in the longer term I want to work out how to make a playlist that would walk along camelot numbers, but right now this tool has taken out so much of the legwork in selection. thanks!
https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/playlist-tools-smp/
Title: Re: foo_random_pools
Post by: fbuser on 2022-10-01 16:55:58
just signed up to say what a cool plugin this is! being able to pick music in this way really feels like it's refreshed my library.

in the longer term I want to work out how to make a playlist that would walk along camelot numbers, but right now this tool has taken out so much of the legwork in selection. thanks!
https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/playlist-tools-smp/
Can you please stop hijacking this thread to make propaganda for your script, which is actually NOT a replacement for foo_random_pools?
Title: Re: foo_random_pools
Post by: regor on 2022-10-01 17:00:50
? I'm answering to an user request about camelot keys... wow... too much ego here (?)

EDIT: Let me be even more clear. It can be used along YOUR plugin, after playlist creation. So your comment was totally out of context and not justified at all.
Spoiler (click to show/hide)
Title: Re: foo_random_pools
Post by: fbuser on 2022-10-02 09:28:31
? I'm answering to an user request about camelot keys
By full quoting the user's post and just placing a link to the page of your script without any further comment? Already here (https://hydrogenaud.io/index.php/topic,77460.msg1014006.html#msg1014006) you dropped in with hardly comparable results of your script, but ok.

... wow... too much ego here (?)
Not at all. I probably wouldn't even care, if you would not make the wrong statement on your script's page, that it is a replacement of foo_random_pools. The truth is, that it covers some functionality of foo_random_pools and some related additional functionality, besides a lot of unrelated functionality.

To be clear: I create all my components for my own needs in the first place and I share them, so that someone, who find them useful, can use them too. If nobody wants to use them, then it's also ok for me, although it's of course nice to receive some positive feedback like recently from @cheezopath and @Priest_1.

Let me be even more clear. It can be used along your plugin, after playlist creation.
And why didn't you write this before, instead just posting an uncommented link?

So your comment was totally out of context and not justified at all.
I don't think so, see above.

P.S.: If you want to continue discussing this, please send me a pm. This thread is not the right place to continue this.
Title: Re: foo_random_pools
Post by: regor on 2022-10-02 17:59:52
Spoiler (click to show/hide)
Title: Re: foo_random_pools
Post by: DaveD44 on 2023-01-06 14:46:18
I'm using random pools exclusively for playing albums, Can I get FB to play full albums without using Shuffle (albums) while using random pools?

I have several thousand tracks all arranged as albums, most with multiple tracks, but some with a single track, all classical music. I moved to random pools recently to get around some of the problems of playlists being played by Shuffle (albums) and to implement priority playback by rating. It appears to work well, but I'm not sure that the random pools that I generate do not end up playing in some repeating shuffle order. Must I use the Shuffle (albums) playback mode or is there some other way to get random pools to playback in album mode? Or is it not a problem in that it will play albums in random order in any case?

For each of the pools, set with %rating% IS [number], I load several hundred groups (albums), as it appears to work best that way. Is that itself a potential problem (it takes only a few seconds to load) and should I use the Autoload "Add" options instead?
Title: Re: foo_random_pools
Post by: fbuser on 2023-01-06 21:37:08
I'm using random pools exclusively for playing albums, Can I get FB to play full albums without using Shuffle (albums) while using random pools?
Sure.

Must I use the Shuffle (albums) playback mode or is there some other way to get random pools to playback in album mode?
Random pools is not playing at all. It just fills playlist randomly. In which playback order you play the playlist is up to you. But in your case you should use the default playback order.

Is that itself a potential problem (it takes only a few seconds to load)
No.

and should I use the Autoload "Add" options instead?
Probably not. This option is meant to add groups only to a playlist, when they are needed according to the specified rules. It works ideal together with the "Remove played tracks" function from foo_playlist_attributes to keep the playing playlist small.
Title: Re: foo_random_pools
Post by: DaveD44 on 2023-01-07 13:56:51
fbuser: I played with this for some time, shortening the number of groups in my pool set to add, in each pool, a number that I could easily look through when the playlist was populated. I have three pools, each grouped by album and each based on a rating: 5, 4, and 3. When I load my pool set, it always loads into the playlist as albums in random order per pool, but always contiguously by pool. That is, all of the Album rating 3 might load first, then perhaps Album rating 5, then finally Album rating 4. The order of these random loads may change each time the playlist is populated, but the albums are always loaded contiguous by rating.

Then, when I play them back in Default mode, playback will start at the first album in the list and proceed in the order that they are loaded in the playlist, start to finish. This means that, as in the example above, 3 ratings will all play first, then 5 ratings, then 4 ratings. Playing them in Shuffle (albums) will jump around the list as I would expect it to.

The problem here is there is no playback by priority in any case (as I suspected and as you stated above as "Random pools is not playing at all. It just fills playlist randomly. In which playback order you play the playlist is up to you."). Since random pools suggests that the playback with my setup will be picking albums to play back by priority, with my priorities being 10, 3, and 1, I should be hearing 10 of the rating 5 albums to every 3 of the rating 4 albums and every 1 of the rating 3 albums. But if I set up all my pools to load, for example, 100 groups (defined as albums) each, playback in both default and shuffle will play the same number of albums from each pool. There will be no favoring of the pool with a priority of 10 over the other two, but an equal number from each pool (100 in this example) will play.

The only way I can see that this would work with my setup using Default playback is if random pools would load 10 albums for rating 5 for every 3 albums of rating 4 and 1 album of rating 3, per the priorities, and would load them into the playlist with the various pool albums interspersed instead of in pool order. But with an equal number of albums in each pool, that can't happen.

What am I missing? Do I have a total misconception of how this works? Is there perhaps some other setting in FB or in one of the add-ins that keeps this from working properly?

I can make this work fairly well by adjusting each pool's "Number of groups to add:" to a number that is an even multiple of its priority, then playing back in Shuffle (album) mode. But this obviously isn't the way random pools should work.
Title: Re: foo_random_pools
Post by: regor on 2023-01-16 09:49:15
Quote
What am I missing? Do I have a total misconception of how this works? Is there perhaps some other setting in FB or in one of the add-ins that keeps this from working properly?
About your questions, yep. Priority is not meant to populate a playlist by proportion. If you want 60/20/20 then set your group numbers to those values. Priority sets the probability of a pool being picked when the Pool Set has multiple pools.

About your sorting problem, well that -currently- goes out of scope of this tool standard features. You are asking to configure how items from pools are inserted on the playlist, in your case intercalating them. Unless someone comes with a SQL expression to do it all, with a single pool. There are also other ways of doing that via SMP plugin.

And you should read the docs at:
./profile/user-components/foo_random_pools/help/foo_random_pools_help.html
Title: Re: foo_random_pools
Post by: itisljar on 2023-04-01 20:32:13
I've read last three pages, and I didn't see - will there be 64 bit version of plugin for new foobar?
I like this plugin, but can't use it currently as it is not supported.
Title: Re: foo_random_pools
Post by: fbuser on 2023-04-01 20:41:10
I've read last three pages, and I didn't see - will there be 64 bit version of plugin for new foobar?
Yes, as soon as fb2k v2 becomes stable.
Title: Re: foo_random_pools
Post by: Nojevah on 2023-04-18 17:56:17
Thanks for this component. I use it for some weeks, I hate myself for not having used it all these years, since I use "Shuffle" a lot.
I use the setting "Add when the playback position is X items or less from the end": 1
Ideally I'd like the new item to be added at the end of the last track or when using "Next" command, but I guess it would be too complicated. But I'm fine if I'm spoiled by only 1 track.

But I noticed that sometimes, the playlist stops, meaning plugin did not manage to add a new track.
To avoid that, I use "2" for the setting "Add when the playback position is X items or less from the end".
I don't know if it's a known bug, or if it can be circumvented ?

Some infos; I use Foobar 1.6.16. I don't use foo_sqlite.
My settings in screenshot.


Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-04-22 14:34:48
New version, see first post.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-04-22 14:50:34
To avoid that, I use "2" for the setting "Add when the playback position is X items or less from the end".
I don't know if it's a known bug, or if it can be circumvented ?
This is neither a known bug nor can it be circumvented. It's a just timing problem. Setting the value as you described is the best what you can do.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: AndreaT on 2023-04-25 06:30:20
Hello @fbuser, I just noticed that, with FB v2 beta 34, the "Check for updated components" did not report as new your 3 components: Random Pool 2.0.0., SQLTree 4.0.0 and SQLite Utilities 3.0.2. (this did not prevent me from installing all them manually).
Said that, I also noted that FB v2 beta 34 can detect other updates, thereof I think there is a problem with your components versioning reporting.
Regards, Andrea
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: AndreaT on 2023-04-25 18:28:26
**** Performance problem with new version 2.0.0 ****

Hello @fbuser , my PC is an old 32bit running Win 10.
Stated this, the previous version was able to generate a 50 tracks random playlist in few seconds (I have a large library).
The new V2.0.0 takes 20 times (or so) longer!!!!

To be noted that I have updated the 3 components Random Pool 2.0.0., SQLTree 4.0.0 and SQLite Utilities 3.0.2, and not just the Random Pool.

Can you help me troubleshooting the problem? I really would  like to get back to a decent performance.

Kind regards, Andrea
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: grimes on 2023-04-28 20:59:53
Hello @fbuser, I just noticed that, with FB v2 beta 34, the "Check for updated components" did not report as new your 3 components: Random Pool 2.0.0., SQLTree 4.0.0 and SQLite Utilities 3.0.2. (this did not prevent me from installing all them manually).
Said that, I also noted that FB v2 beta 34 can detect other updates, thereof I think there is a problem with your components versioning reporting.
Regards, Andrea
Seems to work now. Had been also a problem for my components.
Quote
Component update: Checking for: foo_uie_sql_tree / SQL Tree / 4.0.0
Component update: Found a match - 4.0.0 vs 4.0.0
Component update: Checking for: foo_sqlite / SQLite Utilities / 3.0.2
Component update: Found a match - 3.0.2 vs 3.0.2
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: itisljar on 2023-04-28 22:45:36
Yes, as soon as fb2k v2 becomes stable.

Thank you very much for new version of plugin! <3
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-01 20:01:26
my PC is an old 32bit running Win 10.
This in combination with this
I have a large library
is actually the problem.

Can you help me troubleshooting the problem? I really would  like to get back to a decent performance.
This might not be possible, but just let me know, which settings you are using for this

Stated this, the previous version was able to generate a 50 tracks random playlist in few seconds (I have a large library).
The new V2.0.0 takes 20 times (or so) longer!!!!
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: itisljar on 2023-05-13 20:04:18
I've updated plugin today, v2.0.1, and it crashes foobar2000. Windows 11 64 bit, v2.0 works.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-13 21:51:55
I've updated plugin today, v2.0.1, and it crashes foobar2000. Windows 11 64 bit, v2.0 works.
Could you please post the crash report here?
Thanks.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Reith on 2023-05-14 06:05:26
I had the same problem. I was not able to even start foobar without using safe mode and removing the component.

I have multiple crash logs I can upload - let me know if this one works.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-14 13:37:22
I have multiple crash logs I can upload - let me know if this one works.
Thanks, this is sufficient. But I have a few questions:

Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Reith on 2023-05-14 17:04:27
I upgraded from 2.0.0. When foobar relaunched after installing 2.0.1, it immediately crashed.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-14 17:32:09
I upgraded from 2.0.0. When foobar relaunched after installing 2.0.1, it immediately crashed.
Thanks for the info. I should have asked also for this scenario: Did you use a configuration from a fb2k version < 2 when you installed random pools version 2.0.0?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Reith on 2023-05-14 21:51:04
I upgraded from foobar 1.6 where I also had Random Pools installed, so probably yes.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-15 21:32:35
I upgraded from foobar 1.6 where I also had Random Pools installed, so probably yes.
Ok, that explains the cause of the crash. It should be fixed now with the lastet version.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: itisljar on 2023-05-16 07:47:28
Ok, that explains the cause of the crash. It should be fixed now with the lastet version.

Sorry for late reply, it was the same for me - I've migrated config from 1.6 when installing beta 2.0, 32 to 64 bit. randompools weren't available then, so I waited final version of 2.0, installed 2.0 of randompools, it worked, and then upgraded to 2.0.1, had crash.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-16 20:51:53
Sorry for late reply, it was the same for me - I've migrated config from 1.6 when installing beta 2.0, 32 to 64 bit. randompools weren't available then, so I waited final version of 2.0, installed 2.0 of randompools, it worked, and then upgraded to 2.0.1, had crash.
Hmm, this is a different scenario as that vom @Reith and it's a bit suprising.

In case you still have problems also with 2.0.2, could you please post your config.sqlite from your profile folder, so that I can analyze it?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: AndreaT on 2023-05-24 21:39:36
Hello,
I am having problems with the new version, starting from V2.0.
Before that version, my PC was taking 15-20 seconds to create a 50 tracks random playlist, while now, using the today last versions of all the components, it is taking 180 to 240 seconds!

[foo_random_pools] 22:25:23.188: Get new pool database connection, db pool size: 0, available connections: 0 ...
[foo_random_pools] 22:25:23.188: Open database C:\Users\AdmAT\AppData\Roaming\foobar2000-v2\configuration\foo_sqlite.user.db ...
[foo_random_pools] 22:25:23.193: Open database C:\Users\AdmAT\AppData\Roaming\foobar2000-v2\configuration\foo_sqlite.user.db: 0:00.004594
[foo_sqlite] 22:25:23.203: Create MetaDB_Module ...
[foo_sqlite] 22:25:23.204: Create MetaDB_Module: 0:00.000126
[foo_random_pools] 22:25:23.204: Attach database C:\Users\AdmAT\AppData\Roaming\foobar2000-v2\configuration\foo_sqlite.materialize.db as materialize ...
[foo_random_pools] 22:25:23.207: Attach database C:\Users\AdmAT\AppData\Roaming\foobar2000-v2\configuration\foo_sqlite.materialize.db as materialize: 0:00.003770
[foo_random_pools] 22:25:23.207: Get new pool database connection, db pool size: 0, available connections: 0: 0:00.019558
[foo_random_pools] 22:25:23.231: Adding pools from pool set Random Tracks SQL ...
[foo_random_pools] 22:25:23.234: Add pool '050 random tracks' from pool set Random Tracks SQL ...
[foo_random_pools] 22:27:38.751: Add pool '050 random tracks' from pool set Random Tracks SQL: 2:15.517329
[foo_random_pools] 22:27:38.762: Adding pools from pool set Random Tracks SQL: 2:15.530664

Anyone out there can help me understanding what's going wrong?
Regards, Andrea
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-24 21:56:40
Anyone out there can help me understanding what's going wrong?
Please, post your settings. Besides this as you are obviously using a SQL query, ensure that you are using a materialized media library table, not the virtual table directly. This should be always faster on your system.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: AndreaT on 2023-05-24 22:18:38
Anyone out there can help me understanding what's going wrong?
Please, post your settings. Besides this as you are obviously using a SQL query, ensure that you are using a materialized media library table, not the virtual table directly. This should be always faster on your system.

Hello @fbuser, I checked my PC and the file "foo_sqlite.materialize.db" is there and has size of 450MB approximatively, while the "metadb.sqlite" file is about 1GB in size.

Regarding my configuration and queries, I am only using the queries you kindly made for me months ago. As well as the "marialization" of the dBase was made following your instructions.
Since then I didn't change anything, also because I don't know anything of SQL.

The queries and materialization instruction you provided me in: Reply #318 – 2022-08-19 21:56:15 and Reply #331 – 2022-08-23 19:21:06 of this thread.

What really happened, it was that along with the release of the final Foobar V2, you also released the new set of 3 components, Random Pool 2.0.0., SQLTree 4.0.0 and SQLite Utilities 3.0.2, and since then I am having this performance issue.

Kindly understand that, due to my ignorance of SQL, I cannot understand if the problem is within the new Foobar V2 or what else.

Said that, I am very happy to do whatever needed to let you understand what's wrong. Please, just tell me step by step what I shall have to do and/to provide you.

Thanks and regards, Andrea
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-24 22:37:35
The queries and materialization instruction you provided me in: Reply #318 – 2022-08-19 21:56:15 and Reply #331 – 2022-08-23 19:21:06 of this thread.
Ok, can you please open the SQLite console, enter the following statement and let me know the result?
Code: [Select]
WITH
Albums AS (
  SELECT album||'|'||coalesce("album artist",artist) Album
  FROM MMediaLibrary
  GROUP BY 1
  ORDER BY random()
  LIMIT 10
)
SELECT path, subsong FROM
MMediaLibrary
WHERE album||'|'||coalesce("album artist",artist) IN (SELECT album FROM Albums)
ORDER BY album||'|'||coalesce("album artist",artist),coalesce(discnumber,1),tracknumber;
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: AndreaT on 2023-05-25 06:48:03
Hello @fbuser , thanks a lot for your support that allowed me to fix the problem.
I noted that the SQL query you provided me in Reply #318 – 2022-08-19 was making use of MediaLibrary instead of MMediaLibrary.
I then put MMediaLibrary also in those set of "random tracks" queries and now I can have a 50 random tracks playlist created in 10 seconds! Perfect so! About 3 times faster than the old good 2022 performance.

Now, solved my "current performance problem", still remaining the big question: why it was anyway working decently in the past with MediaLibrary and not anymore today?

All the best and thanks a lot again for your help, Andrea
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-05-25 20:11:01
I noted that the SQL query you provided me in Reply #318
It was actually in #324 (https://hydrogenaud.io/index.php/topic,77460.msg1013981.html#msg1013981). In #318 was the initial solution without SQL.

still remaining the big question: why it was anyway working decently in the past with MediaLibrary and not anymore today?
Indeed, especially as the performance for that query on my 6 year old standard notebook is 2.3 seconds for MediaLibrary and 1.7 seconds for MMediaLibrary.

So the performance degretion for you is most likely caused by your slow system in the first place in combination with the internal changes including the changes for SQLite itself. But even on your system this should normally not cause such a huge performance difference between both statement versions.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: BHershey on 2023-10-24 22:28:26
I'm real close to getting what I want, finally, and I can hardly stand it lol. I want a playlist of one song per artist, that song being the oldest played from that artist, played randomly. So my playlist would be sorted by %ARTIST% - %Last_Played%, then play (or put in a playlist) the first song from each artist.
Is this the plugin that will do it?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: BHershey on 2023-10-25 00:29:27
I want a playlist of one song per artist, that song being the oldest played from that artist.

So far I have this for a pool definition...
Group = %artist%
# of groups to add = 1000
# of tracks to add = 1
limit after sorting = yes
sort = %last_played%
sort/limit each group = yes
title format = yes
media library = yes
filter = E:\Music\Brian Music\Albums

One small issue is lots of duplicates, which I can remove with the FB "remove duplicates" menu option. Would there be a SQL Query I could use instead to remove the duplicates? Thank you!
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: BHershey on 2023-10-25 01:46:44
One small issue is lots of duplicates

I fixed the dupes by adding another %artist% filter at the end.

One more thing to tackle, if an artist has only one song it will add to the playlist even if recently played. I could use the skip track plugin to not play recent songs, but is there another way using this plugin?

Thank you!
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: BHershey on 2023-10-25 03:05:08
One more thing to tackle, how to not play recent songs

I fixed that by putting this in each pool filter... "(%path% HAS "E:\Music\Brian Music\Albums") AND ((NOT %last_played% DURING LAST 90 DAYS))"

This plugin changes my life, love it! Let me know how to send you money!
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-23 09:22:15
Hello, I've just found out about this plugin and I have a few questions as to how to utilise these fields...

Firstly the Group field inside the pool's properties... what does this determine?
I've set it to %all% and it's working as expected. But I still don't understand what it's used for or how to use it properly.

Secondly, is it possible to prevent songs from the same album from showing up? I want it something similar to Foobar's shuffle tracks.

I've attached below my pool settings.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-25 10:46:14
Firstly the Group field inside the pool's properties... what does this determine?
It picks a random group with the same values for the specified title format expression from the set of tracks which you define under "Source / Filter" on the right side of the

I've set it to %all% and it's working as expected.
As long as you don't use a tag with the name "all" the title format value will be ? for all tracks, so all tracks are just one group and will be picked completely. If you would set the group to %album% only the tracks of only one randomly selected album would be picked from the set of tracks from the source. If you limit the set of tracks from the source to your needs, %all% (or any anoter not existing tag) is a good choice.

Secondly, is it possible to prevent songs from the same album from showing up?
Yes, change your setting for example as follows to get 20 random tracks from 20 random albums:

WITH
Code: [Select]
CTE AS (
  SELECT DISTINCT
         first_value(path) OVER w_album path,
         first_value(subsong) OVER w_album subsong
  FROM MediaLibrary
  WINDOW w_album AS (PARTITION BY album ORDER BY random())
)

ORDER BY
Code: [Select]
random()

LIMIT
Code: [Select]
20
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-25 20:54:02
Just a small doubt above, I already have a specific SQL query for Random Pools, if I understood the SQLite code properly at the ORDER BY random(), it will entirely randomise my result and not get what I currently have as my SQLite query in this pool?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-26 15:17:04
Just a small doubt above, I already have a specific SQL query for Random Pools, if I understood the SQLite code properly at the ORDER BY random(), it will entirely randomise my result and not get what I currently have as my SQLite query in this pool?
No, but first of all the CTE above was not correct for the described case (a DISTINCT was missing). I updated it.

Now let's have closer looks at your first pool definition with %all% as group and your second pool definition %album% as group:

In both cases the definitions on the right side define the set of tracks which is used to get one random group from this set.

First case (group = %all%)

With the CTE tracks of the media library are reduced to one random track of each album. All other tracks are filtered out. By using the WINDOW definition
Code: [Select]
WINDOW w_album AS (PARTITION BY album ORDER BY random())
the tracks of the media library are virtually partitioned into albums having all tracks of them sorted randomly each.

With the window function first_value() you select from each of these partitions (=album) path and subsong of the first track:
Code: [Select]
first_value(path) OVER w_album path,
first_value(subsong) OVER w_album subsong

As the tracks are sorted randomly for each partition you get an arbitrary track of each album with first_value(). The added DISTINCT eliminates all duplicates as first_value() will be applied to every track of an album with the same result.

Now the set of tracks is reduced to one random track per album. With the ORDER BY
Code: [Select]
random()
these tracks are sorted randomly and with LIMIT
Code: [Select]
20
the first 20 tracks of the randomly sorted tracks are picked. So, the final set of tracks contains 20 random tracks from 20 different albums.

These 20 tracks are now used to pick randomly a group as defined on the left side of the pool definition. As %all% is not an existing tag the title format result is ? for all tracks, so all the tracks are just one single group and they will be used completely.

Second case (group = %album%)

First, the CTE is useless and can be removed. Instead just use "MediaLibrary" instead of "CTE" for "SELECT path, subsong FROM". At this point the set of tracks to pick a random group from is the whole media library.

With the specified where clause you filter out all tracks which were played in the last 5 hours or which are not loved.

The remaining tracks are sorted by the last played timestamp in ascending order (ORDER BY) and with the limit 2 you reduce the remaining tracks just the two tracks, which were played the longest time ago.

From these two tracks you pick either both tracks, if they have the same value for %album% or randomly one of them if their value for %album% is different.

This is for sure not what you want  :)
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-26 15:21:04
Sorry, I failed to understand exactly for the Second Case... just so that we are on the same page I've made two pools one as Least Recently Played and the other as Lowest Play Count, I've shared my settings for Least Recently Played and I wanted to know if it's possible to combine the query you suggested to prevent tracks from the same album playing...

For the group should I change it to %track%? or what would be the best scenario here to set for the Group parameter?

I'll elaborate my Pool settings here as well

Code: [Select]
Name: Least Recently Played
Group: %album%
Determine probability for picking groups based on group size: Untick
Number of groups to add: 1
Number of tracks to add: 0
Number of minutes to add: 0
Number of MBs to add: 0
Limit after sorting: Untick
Sort: Empty
Sort / limit each group: Empty
Source / Filter
Type: SQL (requires foo_sqlite)
Query
WITH: CTE AS(
 SELECT path, subsong, [%jsp3_loved%], COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
 FROM MediaLibrary
)

SELECT path, subsong FROM: CTE

WHERE: [%jsp3_last_played%] < datetime('now', '-300 minutes')
AND [%jsp3_loved%]

ORDER BY: [%jsp3_last_played%]

LIMIT: 2

Filter with the content of the target playlist: Tick
Filter with the content of the target playlist using a title format expression: Empty
Priority: 1

You mentioned not to use CTE as well, but I found out that if I don't include that in "SELECT path, subsong FROM" my COALESCE doesn't take place and replace the NULL values inside the database.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-26 16:08:59
Sorry, I failed to understand exactly for the Second Case... just so that we are on the same page I've made two pools one as Least Recently Played and the other as Lowest Play Count, I've shared my settings for Least Recently Played and I wanted to know if it's possible to combine the query you suggested to prevent tracks from the same album playing...
Definitely not easily. It will become quite complex and probably you will need to create temporary tables in the batch part of the sql definition at least for performance reasons.

For the group should I change it to %track%? or what would be the best scenario here to set for the Group parameter?
No. Besides that you probably meant %title%, it would only rule out, that you get both tracks together from the set of tracks, which you defined with your SQL (as long as %title% for both tracks is different).

You mentioned not to use CTE as well, but I found out that if I don't include that in "SELECT path, subsong FROM" my COALESCE doesn't take place and replace the NULL values inside the database.
Ok, I didn't see the CTE completely, but you still don't need it by setting WHERE to
Code: [Select]
COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') < datetime('now', '-300 minutes')
AND [%jsp3_loved%]
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-26 16:18:45
Definitely not easily. It will become quite complex and probably you will need to create temporary tables in the batch part of the sql definition at least for performance reasons.
Ah, guess it's not worth the trouble...? I'm not sure how feasible it is as I'm still a beginner with SQL queries...

Temp tables in batch part just so that the results are randomised? and then in the query part apply my filter conditions?

No. Besides that you probably meant %title%, it would only rule out, that you get both tracks together from the set of tracks, which you defined with your SQL (as long as %title% for both tracks is different).

I have some tracks which have the same title but from different albums, to rule out this confusion would it be better to have the Group as %path% - %subsong%
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-26 18:27:08
Ah, guess it's not worth the trouble...?
Maybe not. Another problem is, that your SQL reduces the set of tracks already to only two tracks: The two least recently played tracks. From these two tracks you try got get one randomly. Is this really what you want? How many tracks do you actually want to get?

I'm not sure how feasible it is as I'm still a beginner with SQL queries...
It could need several hours to get the wanted result. You should first define exactly the result, that you want to get, without thinking how to implement it. Actually, it is not really clear for me what it is.

Temp tables in batch part just so that the results are randomised? and then in the query part apply my filter conditions?
No, the temp tables needs to be used to simplify the task (and maybe also for performance reasons). Although I have no concrete idea to solve the problem, you will probably end up in deeply nested subselects, if you don't use temp tables.

I have some tracks which have the same title but from different albums, to rule out this confusion would it be better to have the Group as %path% - %subsong%
Probably not. This would get you always only one track independent from the number of tracks in the set of tracks defined with the SQL.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-26 18:35:28
So I've created a really rough Batch and Query SQL queries with basic understanding but could you review it?

Code: [Select]
Batch:
DROP TABLE IF EXISTS tmpRandomLRP;

CREATE TEMPORARY TABLE tmpRandomLRP AS
SELECT DISTINCT
    path,
    subsong,
    [%jsp3_loved%],
    COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
FROM (
    SELECT
        first_value(path) OVER w_album path,
        first_value(subsong) OVER w_album subsong,
        [%jsp3_loved%],
        COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
    FROM MediaLibrary
    WINDOW w_album AS (PARTITION BY album ORDER BY random())
) AS subquery
ORDER BY random();

Code: [Select]
Query:
WITH CTE AS(
 SELECT path, subsong, [%jsp3_loved%], COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
 FROM tmpRandomLRP
)
SELECT path,
       subsong
FROM CTE
WHERE ([%jsp3_loved%]) AND ([%jsp3_last_played%] < datetime('now', '-300 minutes'))
ORDER BY [%jsp3_last_played%]
LIMIT 2

Grouping is still set to %album%, should I switch it back to %all% or not touch it for now?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-26 18:42:53
So I've created a really rough Batch and Query SQL queries with basic understanding but could you review it?
This does not make sense, as long as you don't exactly define what your expected result is, i.e. which and how many tracks should be added to a playlist?
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-26 18:48:02
This does not make sense, as long as you don't exactly define what your expected result is, i.e. which and how many tracks should be added to a playlist?

Okay yeah, after playing through there seems to be a lot more involved in this than simply creating temporary tables. Honestly doubting if it's worth the trouble...

I'm trying to add only two tracks to my playlist and set auto-add to add more tracks if the tracks in the playlist are less or equal to one.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-26 22:16:35
I'm trying to add only two tracks to my playlist and set auto-add to add more tracks if the tracks in the playlist are less or equal to one.
In this case you can use what I proposed, just set the LIMIT to 2. Of course, you will always have only 2 tracks which will come from different albums.

If you add additional tracks to the playlist with auto-add also only the new 2 tracks will not come from the same album. It's absolutely impossible to add only tracks from albums, which were not added before. Two selections from a pool are completely unrelated.

If you for example increase the LIMIT from 2 to 50 you will have at least 50 subsequent tracks from 50 different albums before another track is taken from one of these albums.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-27 06:03:32
In this case you can use what I proposed, just set the LIMIT to 2. Of course, you will always have only 2 tracks which will come from different albums.

I assume the proposed one is this? I've tried this query but couldn't get [%jsp3_loved] WHERE condition to work, I forgot to clarify this earlier but [%jsp3_loved] means tracks which I've favourited... It's a bit weird but the SQL query correctly selects the rows which include my favourite tag and discards the rest.


WITH
Code: [Select]
CTE AS (
  SELECT DISTINCT
         first_value(path) OVER w_album path,
         first_value(subsong) OVER w_album subsong
  FROM MediaLibrary
  WINDOW w_album AS (PARTITION BY album ORDER BY random())
)

ORDER BY
Code: [Select]
random()

LIMIT
Code: [Select]
20
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-27 18:39:34
Hello again fbuser, I've been noticing this issue slowly creep up randomly at times and for no reason, after some point of playback with Random Pools it no longer adds any new tracks to the playlist... Running my SQL query on the SQLite console still retrieves results for the next tracks but the Console Log only shows this indicating no issue when I click on File>Random Pool>Pool name.

It seems to resolve only when I fully restart foobar2000. I have a gut feeling it might be due to active playlists. When I run a Random Pool for another Playlist and I'm on another active playlist then return nothing's been added to the playlist specified in Random Pool.

I've attached some images to look into... note that I haven't changed any settings here from my previous posts.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-11-28 18:12:52
Hello again fbuser, I've been noticing this issue slowly creep up randomly at times and for no reason, after some point of playback with Random Pools it no longer adds any new tracks to the playlist...
This should happen only, if there are no tracks, which can be added. How many possible tracks do yo have for each of the pools (just run the query without the limit in the SQLite console to determine this).

Running my SQL query on the SQLite console still retrieves results for the next tracks but the Console Log only shows this indicating no issue when I click on File>Random Pool>Pool name.
There is a quite small chance that the query runs in the SQLite console again because the 5 hour limit is meanwile not filtering anymore, while it was the case during the execution of the pool's query for the "least recently played" pool but not for the other. Anyway, please provide me also the complete poolset settings and the settings of the second pool (lowest playcount).

Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-28 19:57:55
This should happen only, if there are no tracks, which can be added. How many possible tracks do yo have for each of the pools (just run the query without the limit in the SQLite console to determine this).

There are plenty of tracks when I remove the LIMIT query, of course, the rows shrink once a track has been recently played but around 100+ tracks as an estimate.

There is a quite small chance that the query runs in the SQLite console again because the 5 hour limit is meanwile not filtering anymore, while it was the case during the execution of the pool's query for the "least recently played" pool but not for the other. Anyway, please provide me also the complete poolset settings and the settings of the second pool (lowest playcount).

Code: [Select]
Number of different randomly chosen pools to add: 2

Code: [Select]
-Autoadd-
Add, when the playlist has X items or less: 1
Add, when the playlist duration is X minutes or less: 0
Add, when the playback positions is X items or less from the end: 1
Pool set title SQL filter: [%jsp3_loved%]

Code: [Select]
-Pools-

Name: Least Recently Played
Group: %album%
Determine probability for picking groups based on group size: Untick
Number of groups to add: 1
Number of tracks to add: 0
Number of minutes to add: 0
Number of MBs to add: 0
Limit after sorting: Untick
Sort: Empty
Sort / limit each group: Empty
Source / Filter
Type: SQL (requires foo_sqlite)
Query
WITH: CTE AS(
 SELECT path, subsong, [%jsp3_loved%], COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
 FROM MediaLibrary
)

SELECT path, subsong FROM: CTE

WHERE: [%jsp3_last_played%] < datetime('now', '-300 minutes')

ORDER BY: [%jsp3_last_played%]

LIMIT: 2

Filter with the content of the target playlist: Tick
Filter with the content of the target playlist using a title format expression: Empty
Priority: 1

Code: [Select]
Name: Lowest Play Count
Group: %album%
Determine probability for picking groups based on group size: Untick
Number of groups to add: 1
Number of tracks to add: 0
Number of minutes to add: 0
Number of MBs to add: 0
Limit after sorting: Untick
Sort: Empty
Sort / limit each group: Empty
Source / Filter
Type: SQL (requires foo_sqlite)
Query
WITH: CTE AS(
 SELECT path, subsong, [%jsp3_loved%], COALESCE(NULLIF([%jsp3_playcount%], ''), 0) AS [%jsp3_playcount%], COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
 FROM MediaLibrary
)

SELECT path, subsong FROM: CTE

WHERE: [%jsp3_last_played%] < datetime('now', '-300 minutes')

ORDER BY: [%jsp3_playcount%]

LIMIT: 2

Filter with the content of the target playlist: Tick
Filter with the content of the target playlist using a title format expression: Empty
Priority: 1

Could it be Filter with the content of the target playlist? Since both of the pools have the same WHERE conditions but only the ordering is different.

Also with these two pools defined what I'm trying to achieve is to alternative between the Least Recently Played and Lowest Play Count when I have only a single track or less in my playlist.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-11-30 20:13:45
Hello again, I guess I've resolved this issue by changing my Group to %track% and that seemed to keep my playlist always populated without running out of tracks.

Also with how I defined the probability for my pool does this achieve alternating between two pools by giving them a 1/2 chance of it being selected after one of these conditions is met?
Code: [Select]
Add, when the playlist has X items or less: 1
Add, when the playback positions is X items or less from the end: 1
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-12-02 16:03:58
Hello again, I guess I've resolved this issue by changing my Group to %track% and that seemed to keep my playlist always populated without running out of tracks.
This should not really make a difference, but as long as it works for you it's fine.

Also with how I defined the probability for my pool does this achieve alternating between two pools by giving them a 1/2 chance of it being selected after one of these conditions is met?
The probability for a pool is determined by a pools' priority related to the sum of the priorities for all pools. As you set the priority for both pools to 1 it's already what you want.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-12-03 09:59:14
This should not really make a difference, but as long as it works for you it's fine.
Yeah I'm even more confused now on how changing the title format fixed it.

The probability for a pool is determined by a pools' priority related to the sum of the priorities for all pools. As you set the priority for both pools to 1 it's already what you want.
Thanks for confirming.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-12-05 19:48:18
Hello again fbuser, I guess I'm ready to take up the challenge of preventing songs from the same album...

Before I start, the algorithms mentioned above are taken from a radio station. I was lucky enough to get in touch with the creator and he provided me with some sample SQL queries (as his radio station again uses SQL databases) to help me out.

When I implemented these queries it almost matched with how the Radio station selects songs but an issue crept up where when selecting songs to play from MediaLibrary, the SQL queries would not consider songs that had already been queued, and so I would experience two songs from the same album near one another (usually separated by one other song from another album).

The creator implemented a change into the database to maintain variety when listening and one such change was he made a  custom call to include queued songs when considering what to play next (Perhaps in our use case a custom table which contains the queued songs in Batch part?).

The custom call, allows the creator to look into circles (or album artists) that have played recently since the concept of circles (music groups, bands, etc.) didn’t exist in the program before this.

As a result, the system will attempt to space out songs from the same circle to further increase variety.

Now I know the queries I made will not space out songs from the same circle due to how it's made but would it be possible for you to assist me or know any idea as to how to achieve this to prevent songs from the same album/album artist appearing in a very short period? (If we prevent album artists this ultimately means preventing them from albums anyway hence the creator took this approach)
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2023-12-10 07:45:51
Hello fbuser, disregard the previous post as I've exhausted every option but it seems to be harder to achieve it now, Perhaps I'll try tweaking other values within the Random Pool and change SQL queries to get what I want. Before that, I have a small doubt...

Yes, this is basically correct. There is an easy but only manual solution: Assign to all relevant pools, which you have defined, the same keyboard shortcut. Another more complex solution, which adds more than one pool automatically, could be to utilize function on_playlist_items_removed(playlist, new_count) {} within foo_uie_wsh_panel_mod together with "Remove played tracks" from foo_playlist_attributes.


Is this possible with JScript Panel3? I've asked in the JScript discussion page which is similar to the answer you provided in your old post.
https://hydrogenaud.io/index.php/topic,110516.new.html#info_1036207

I want my playlist to be a mirror's copy of the SQL rows which have been retrieved and it only seems to be possible when assigning a keyboard shortcut which adds in All the pools. Auto-add doesn't seem to work well here and it looks like the only logical approach will be to clear the playlist after each track has been played back.

EDIT: Okay setting Auto-add to 1 and just clearing the playlist is another way of approaching an exact mirror's copy of the SQL rows selected. I have to code up some logic with the JScript Panel. Thanks.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2023-12-10 15:08:53
Is this possible with JScript Panel3? I've asked in the JScript discussion page which is similar to the answer you provided in your old post.
https://hydrogenaud.io/index.php/topic,110516.new.html#info_1036207
See my answer there.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2024-01-25 21:25:54
I wanted to know if it's possible to combine the query you suggested to prevent tracks from the same album playing...

@fbuser continuing from here I guess I'm a bit keener now into implementing one I want to force my MediaLibrary to last_played and then space out music tracks with the same circle (or album artist). Regarding the spacing out is it possible to use the LAG function or any of that sort? Suppose there are 2 rows and both of them have the same circle next to each other would it be possible to space them in a way so that they are maybe 10 minutes apart? or X minutes apart from each other?

Code: [Select]
WITH CTE AS (
    SELECT
        path,
        subsong,
        codec,
        [album artist],
        COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%],
        ROW_NUMBER() OVER (PARTITION BY [album artist] ORDER BY COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') DESC) AS row_num
    FROM MediaLibrary
)
SELECT path,
       subsong
FROM (
    SELECT
        CTE.*,
        LAG([album artist]) OVER (ORDER BY COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') DESC) AS prev_artist
    FROM CTE
) AS T
WHERE (codec <> 'TAGS') AND (([%jsp3_last_played%] < datetime('now', '-300 minutes', 'localtime'))
    AND (
        row_num = 1 OR
        COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') < datetime('now', '-10 minutes', 'localtime')
        AND (prev_artist IS NULL OR prev_artist <> [album artist])
    ))
ORDER BY CONCAT([%jsp3_last_played%], [album artist])

I've been scrolling through SQL functions and checking other forums but it seems harder to implement it... The code I've provided above is still incomplete...

Before this, if I only wanted to retrieve the Least Recently Played this query pretty much did the job.

Code: [Select]
WITH CTE AS(
 SELECT path, subsong, codec, [%jsp3_loved%], COALESCE(NULLIF([%jsp3_last_played%], ''), '1970-01-01 00:00:00') AS [%jsp3_last_played%]
 FROM MediaLibrary
)

SELECT path, subsong FROM CTE
WHERE [%jsp3_last_played%] < datetime('now', '-300 minutes', 'localtime')
ORDER BY [%jsp3_last_played%]

But I want to know if it's possible to space out album artists/circles.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: fbuser on 2024-02-20 19:28:09
But I want to know if it's possible to space out album artists/circles.
Maybe, but you probably go better in general with creating temporary tables with subresults in the batch part as it is becoming quite complex.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: Azuriye on 2024-02-21 14:20:20
Maybe, but you probably go better in general with creating temporary tables with subresults in the batch part as it is becoming quite complex.

It seems alot harder after spending weeks, Currently I'm just sucking it up and shuffling based on Lowest Play Count and Least Recently Played which was already figured but coming to the point.

It took awhile to come up with this SQL query but the gist of it is that if it's possible to know what's being played in playlist and comparing it to media library that should help in spacing out how far apart the same circle should occur every time when the Random Pool is called (currently shuffles random pools after each track).
I feel like maybe another temp table is needed just because we are going to reshuffle order by spacing circles alone

Code: [Select]
-- Create temporary table tmpMediaLibraryFLPC
DROP TABLE IF EXISTS tmpMediaLibraryFLPC;
CREATE TEMPORARY TABLE tmpMediaLibraryFLPC AS
SELECT
    path,
    subsong,
    codec,
    [album artist] AS media_library_circle,
    [%jsp3_loved%],
CAST(COALESCE(NULLIF([%jsp3_playcount%], ''), 0) AS INTEGER) AS [%jsp3_playcount%],
COALESCE(DATETIME(NULLIF([%jsp3_last_played%], '')), '1970-01-01 00:00:00') AS [%jsp3_last_played%],
ROW_NUMBER() OVER (ORDER BY [%jsp3_playcount%]) AS custom_unique_identifier_media_library -- Create a custom unique identifier for MediaLibrary
FROM MediaLibrary
WHERE (codec <> 'TAGS' AND [%jsp3_loved%]) AND [%jsp3_last_played%] < datetime('now', '-300 minutes', 'localtime')
ORDER BY [%jsp3_playcount%];

-- Create temporary table tmpPlaylistFLPC
DROP TABLE IF EXISTS tmpPlaylistFLPC;
CREATE TEMPORARY TABLE tmpPlaylistFLPC AS
SELECT
    [album artist] AS playlist_circle,
    ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS custom_unique_identifier_playlist -- Create a custom unique identifier for Playlist
FROM Playlist;

-- Common Table Expression (CTE)
WITH CTE AS (
    SELECT
        m.path,
        m.subsong,
        m.media_library_circle,
        p.playlist_circle
    FROM tmpMediaLibraryFLPC m
    JOIN tmpPlaylistFLPC p ON m.custom_unique_identifier_media_library = p.custom_unique_identifier_playlist
)
-- Select path, subsong, media_library_circle, and playlist_circle from the CTE
SELECT path, subsong, media_library_circle, playlist_circle
FROM CTE
LIMIT 10;
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: nthmetal on 2024-03-02 21:11:32
Is there any chance, that the random pool could get a retry mechanism?
Background: Some Pools in my setup are influenced by the songs actually being played - like I try to emphasize songs, that haven't been played for a long time. But sooner or later, the pools with the songs not being played for a long time are empty.
What happens, when the random pool plugin tries to keep the playlist topped up (by adding songs when there is less than x minutes or songs remaining), it chooses one of the pools based on probability, and picks an empty pool. No song gets added. A retry mechanism, that would keep going until one song gets added would help with that.
Alternatively, the Random Pool plugin could check if a pool actually has members and if not, automatically eliminate this Pool from the chosen Pool collection and only choose among the rest.

Actually... I take all that back. Somethign different seems to be going on, not sure yet what. I'll keep investigating.
Title: Re: [fb2k v2] Random Pools (foo_random_pools)
Post by: nthmetal on 2024-03-03 00:59:49
And actually it turns out, I had some broken grouping expressions within my pools. Setting up everything correctly, it seems to work fine.