Skip to main content

Topic: foo_random (Read 30751 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
The component adds support for playlist entries that map to a random entry of a subset of the Media Library on playback.

The component adds a decoder for URIs of the form
Code: [Select]
random:|query|
where query is a valid playlist generator query. The component provides a main menu command to add ("Playlist/Add randomized entry...") and a playlist context menu command to edit ("Edit randomized entries...") entries of this form. The context menu command replaces the existing entry with the new one. It is recommended that you use these commands to manipulate randomized entries instead of the "Add location..." command, as they also check that the query is syntactically valid.

The use of random: paths is limited to playback, i.e. you cannot use them with the Replaygain scanner or the converter. This is by design.

When a randomized entry is played, it will fiter the contents of the Media Library using the specified query and randomly chose one of them. During playback, the static metadata of the chosen track is made available to the player as dynamic information of the random: entry. This works similar to audio streams on the Internet. The dynamic metadata is augmented with "played_path" and "played_subsong" tech info fields that hold the location of the chosen track. The dynamic data of the chosen track is not available.

Note that dynamic metadata is available in (some) titleformatting scripts, including the playlist, main window caption and statusbar. It is however not available to the DSP pipeline, so Replaygain is applied by foo_random using the core settings.

There are a number of error conditions that can lead to the component not being able to play a "real" track. If the Media Library is empty or no tracks are left after filtering its contents, the component will raise a "Not found" type error. An error occurs as well, if the query is not syntactically correct. More information is printed on the console under these conditions.
If you try to use the Replaygain scanner or the converter on a randomized entry, the component will raise an "Access denied" type error. The same happen, if you try to change the tags of a randomized entry.
  • Last Edit: 28 August, 2005, 04:56:14 PM by foosion
http://foosion.foobar2000.org/ - my components for foobar2000

  • Silverbolt
  • [*][*][*][*]
foo_random
Reply #1
Thanks, foosion.
f to c to f to c

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #2
Updated to version 1.1.

The component now outputs which file it picked for playback.

There is an issue with full file buffering affecting this component. If you get a "Not found" type error without any console messages originating from foo_random, try turning full file buffering off. This should be fixed in the next beta.
http://foosion.foobar2000.org/ - my components for foobar2000

  • Killmaster
  • [*][*][*][*]
foo_random
Reply #3
Hey this is pretty cool, thanks

  • mixderax
  • [*][*]
foo_random
Reply #4
1) When playing random song if pause is presed, the position slider goes to begining but when resuming jumps back.
2) When resume playback on start is enabled, when started a new song is chosen and it starts playing from place where the one that played before exiting. Yust wondering what will happend when the song chosen on startup is shorter than the progress on song playing before exiting.
fb2k 0.9 beta 13.

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #5
Quote
1) When playing random song if pause is presed, the position slider goes to begining but when resuming jumps back.[a href="index.php?act=findpost&pid=324001"][{POST_SNAPBACK}][/a]
That is an issue in the user interface. Nothing that can be solved in foo_random.

Quote
2) When resume playback on start is enabled, when started a new song is chosen and it starts playing from place where the one that played before exiting. Yust wondering what will happend when the song chosen on startup is shorter than the progress on song playing before exiting.[a href="index.php?act=findpost&pid=324001"][{POST_SNAPBACK}][/a]
It will attemp to seek to the remembered point, hit the end of the file and skip to the next song (as determind by the playback order).
http://foosion.foobar2000.org/ - my components for foobar2000

  • mixderax
  • [*][*]
foo_random
Reply #6
Thank's
fb2k 0.9 beta 13.

  • hunted
  • [*][*][*][*]
foo_random
Reply #7
I know this is pretty trivial, but is there a chance of being able to set a title for the query, that is displayed when the track is not playing. If I were to make a really long query, it will get truncated.  I like the 'Random:' part, but if we could give it our own title, that might making the playlists easier to read.
I guess if you plan on releasing the source like you have with your other components, I will add this myself, but maybe other people would find this useful.

  • NEMO7538
  • [*][*][*][*][*]
  • Developer
foo_random
Reply #8
When a track is playing it would be nice also that Right Click --> Properties provides with the properties of the currently playing track (not the query).

.... if this is feasible.

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #9
hunted:
I'll think about it.

NEMO7538:
Unfortunately not.
http://foosion.foobar2000.org/ - my components for foobar2000

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #10
foo_random updated for 0.9 RC 2006-03-11.
http://foosion.foobar2000.org/ - my components for foobar2000

foo_random
Reply #11
foo_random updated for 0.9 RC 2006-03-11.


This is an awesome plug-in, and I'm totally psyched to be able to use a custom ratings-weighted shuffle. It looks like foo_random doesn't play especially well with playlist statistics or with audioscrobber. I imagine this is a pretty hard problem. Any insight into why this is the case, or suggested workarounds? It's not mission critical for me: this is a great bit of code and, as is, I really appreciate it.

stephen

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #12
The problem is that foo_random adds an additional layer of indirection that obscures what track is playing to all components that are not aware of what foo_random does - which means virtually every component in existence. This obfuscation is an (unavoidable) side-effect and not a deliberate attempt to prevent these other components from working.
http://foosion.foobar2000.org/ - my components for foobar2000

foo_random
Reply #13
Sorry for reviving an old topic.

Is there a way to make foo_random truly random?

That is, a query that make foo_random pick rnadomly from my whole database? I'm currently struggling to find a plugin that offers truly random playback qualities.

(foo_dbshuffle?  )

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #14
You just need to devise a query that selects all songs, like "%path% IS *" or "NOT all IS golden".
http://foosion.foobar2000.org/ - my components for foobar2000

foo_random
Reply #15
Aha, thank you. I will try it as soon as I finish processing the ReplayGains of my music collection.

LATER:

The component adds a decoder for URIs of the form
Code: [Select]
random:|query|
where query is a valid playlist generator query. The component provides a main menu command to add ("Playlist/Add randomized entry...") and a playlist context menu command to edit ("Edit randomized entries...") entries of this form. The context menu command replaces the existing entry with the new one. It is recommended that you use these commands to manipulate randomized entries instead of the "Add location..." command, as they also check that the query is syntactically valid.

I'm non-computer programming literate. What is a 'syntactically valid' query? Is there anywhere I could look to help me learn these queries? I'm struggling to find a query that defines a random playlist by genre, or another tag field.

The use of random: paths is limited to playback, i.e. you cannot use them with the Replaygain scanner or the converter. This is by design.

Could I ask why?
  • Last Edit: 07 June, 2006, 11:22:56 AM by Fiend Angelical

  • Squeller
  • [*][*][*][*][*]
foo_random
Reply #16
I'm non-computer programming literate. What is a 'syntactically valid' query? Is there anywhere I could look to help me learn these queries?

http://www.hydrogenaudio.org/forums/index....ndpost&p=400521

  • Squeller
  • [*][*][*][*][*]
foo_random
Reply #17
Could you maybe offer a variable which indicates the number of matches of the query. Unlike Autoplaylists or search results, here we don't have information about the number of matches. I want to display it in panels.

  • Squeller
  • [*][*][*][*][*]
foo_random
Reply #18
Another question: tracks played by foo_random do not update playback statistics data, as those tracks are not recognized as Media Library tracks. Can you change this?

  • GreenSmurf
  • [*]
foo_random
Reply #19
Can anyone explain why Queen's "You're my Best Friend" does not appear with this query?

"title HAS best friend"

It only plays two songs and neither have the words "best" or "friend" in them.

Thanks to anyone who can help.

-Brandon

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #20
Could you maybe offer a variable which indicates the number of matches of the query. Unlike Autoplaylists or search results, here we don't have information about the number of matches. I want to display it in panels.
The benefit of having this information does not justify the development and runtime cost to provide it, which is quite significant.

Another question: tracks played by foo_random do not update playback statistics data, as those tracks are not recognized as Media Library tracks. Can you change this?
No. Effectively a randomized playlist entry is a radio station that plays tracks from your media library. It comes with the same limitations (w.r.t. playback statistics tracking) as a normal web radio station. See also post #13 in this thread.

Sorry for the late replies. Apparently I didn't get a notification for this topic.

Can anyone explain why Queen's "You're my Best Friend" does not appear with this query? ...
Have you tried this query in the media library search?
You can also try the plugin's built-in troubleshooting tool. In the context menu preferences, you have to add the command "Random Encounter" to your context menu. Now when you open the context menu for a single random entry, there will be a "Random Encounter" submenu that lists up to 10 matches for your query. If this submenu is missing, the plugin found no matches. In that case, the foobar2000 console will show an error message:
Quote
Failed to open random entry. No items left after applying filter: this IS an example
http://foosion.foobar2000.org/ - my components for foobar2000

foo_random
Reply #21
Hello foosion,

here a short list of some issues i experienced with foo_random:

1. (an old one i mentioned over one year ago in the database search thread): "There is a little but annoying usability issue with foo_random: when choosing a query preset from the dropdown list you can't access the OK button as long as you don't add a space sign(f.e) to the query text)"

2. foo_random seems to have a conflict with two newer features of foobar core.
a) I typed "ALL" as query to get back an random entry of whole library but foo_random interpretes that as string "all"
b) Furthermore it also looks in fields that are not in the search restriction field in advanced preferences.

3. The seekbar doesn't work - on the other side you can seek in a playing track by "seek ahead by ..." command
  • Last Edit: 20 June, 2009, 12:37:41 PM by q-stankovic
german support forum: www.foobar-users.de / user: qwert73

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #22
1. (an old one i mentioned over one year ago in the database search thread): "There is a little but annoying usability issue with foo_random: when choosing a query preset from the dropdown list you can't access the OK button as long as you don't add a space sign(f.e) to the query text)"
Reproduced. I will look into it, but please report such issues in the correct topic in the future.

2. foo_random seems to have a conflict with two newer features of foobar core.
a) I typed "ALL" as query to get back an random entry of whole library but foo_random interpretes that as string "all"
b) Furthermore it also looks in fields that are not in the search restriction field in advanced preferences.
I can't reproduce this with the latest version from my website (currently 1.2.3) and foobar2000 0.9.6.8.

Edit: I'll have to try this when I'm back home. The media library on my laptop only contains songs in "C:\Documents and Settings\All users\...".

3. The seekbar doesn't work - on the other side you can seek in a playing track by "seek ahead by ..." command
Known/won't fix. This is due to how foo_random works.
  • Last Edit: 21 June, 2009, 09:16:24 AM by foosion
http://foosion.foobar2000.org/ - my components for foobar2000

  • foosion
  • [*][*][*][*][*]
  • Moderator
foo_random
Reply #23
foo_random 1.3.0

Changes:
  • Fixed usability issue in GUI.
  • The component now uses the standard search filter API. New filter expressions - including ALL - will work now.
  • The entries in the "Random Encounter" context menu submenu start playback of the specified song. This is equivalent to using the built-in "Play" context menu command on a song.
http://foosion.foobar2000.org/ - my components for foobar2000

  • Guhndahb
  • [*]
foo_random
Reply #24
I'm totally psyched to be able to use a custom ratings-weighted shuffle.
How can this be attained?  I've been trying to find a way to do ratings-weighted random but it seems that the method people have previously used, utilizing foo_skip, does not work anymore.  Is using foo_random the only current option?  If so, I'm unsure how to make a playlist generator query that works to achieve ratings-weighted random unless rand() will work with this plugin.  But I thought rand() doesn't currently work in most situations.

Also, foosion, can I assume from the fact that you had to design foo_random the way you did (as a kind of channel) that there's no way currently to add playlist order options or modify the behavior of those that exist?  I'm unsure if I can live with the understandably necessary limitations that foo_random imposes such as limited compatibility with functionality and other plugins that I like (such as audioscrobbler and the seek bar).  I was going to look into writing a plugin to do what I wanted, but if someone as experienced as yourself found this the best option I'm guessing what I want to do is currently impossible.

Thank you.