Skip to main content

Notice

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

playlist generation using %rand()

I would like to generate a playlist where songs are more likely to appear if they are higher-rated. I have a procedure I use to do this, but I'd like to automate it. I thought one way to do this using facets might be to use the $rand() feature.  However, it doesn't seem to work like I expect when I run the following:

((%rating% IS 1) AND ("$rand()" GREATER 1717986918)) OR ((%rating% IS 2) AND ("$rand()" GREATER 1288490188)) OR ((%rating% IS 3) AND ("$rand()" GREATER 858993459))  OR ((%rating% IS 4) AND ("$rand()" GREATER 429496729)) OR ((%rating% IS 5))

My understanding, from the documentation, is that $rand() is not [0,1) bounded but goes to very large numbers. But it's also available only in some contexts. What light can you shed on the problem?

Thank y'all. fb2k is a great product.
stephen


 

Re: playlist generation using %rand()

Reply #2
You can create such playlists with my scripts (Playlist Tools) and probably with random pools component too.

But you can also create semi-random queries with other TF expressions, like:
Code: [Select]
(%rating% IS 3) AND ("$mod($crc32(%TITLE%),256)" GREATER 128)

Which would always give the same output, but it's a random playlist. Substitute title with a tag changed after playback, like %last_played%, and the query will also change everytime you play the track.

Code: [Select]
(%rating% IS 3) AND ("$mod($crc32(%last_played%),256)" GREATER 128)
Apply the same for every rating and you have your playlist.

You can also filter it even more, to directly exclude any track played recently
Code: [Select]
((%RATING% IS 3 AND "$mod($crc32(%LAST_PLAYED%),256)" GREATER 128) OR (%RATING% IS 4 AND "$mod($crc32(%LAST_PLAYED%),256)" GREATER 64) OR (%RATING% IS 5)) AND NOT %LAST_PLAYED% DURING LAST 2 WEEKS