Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#6960 : Random (album) selection in Database



FS#6960 - Random (album) selection in Database

Attached to Project: Rockbox
Opened by Mark Reiche (Porphyr) - Monday, 02 April 2007, 19:42 GMT
Last edited by Steve Bavin (pondlife) - Friday, 21 December 2007, 13:32 GMT
Task Type Patches
Category Music playback
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No


I implemented something because I desparately wanted random album selection.
My code simply adds another menu item called "<Random>" to each level of the Database lookup tree, just beneath the "<All tracks>" entry. This entry just randomly selects one of the actual menu entries from below it. (This adds some flexibility to my original request - you now can select music from a random year, a random genre, .... basicly everything)

Now I know that the code is not ready for integration into the main source - it should probably be configurable - it definitivly lacks i18n.
I don't know who decides which code goes into the main source and which not; if there is interest to integrate this kind of functionality, I am ready to finish the missing stuff to make it ready for integration.

However, for me it works for me.
I read some similiar requests in the forum - maybe it would help others, too.

This task depends upon

Closed by  Steve Bavin (pondlife)
Friday, 21 December 2007, 13:32 GMT
Reason for closing:  Accepted
Additional comments about closing:  Thanks.
Comment by Hepdog (007quick) - Tuesday, 03 April 2007, 15:39 GMT
I think the idea is that you do the work and then they say, "ah, this patch seems worthy of our time" Asking if they want it isn't the right way. They want us to make something good! then make it easy for them to implement.
Comment by Mark Reiche (Porphyr) - Tuesday, 03 April 2007, 17:09 GMT
Hmmm. Dunno who is "us" and "they" - don't know if I want to belong to either...

As I said the code does almost what I want from it - If someone else wants it: fine - if not: fine, too - I don't really care.

If somebody wants this code - fine! I am ready to continue the work to make it easier to integrate. If nobody wants it on the other hand - I am fine, too.

The next thing I'll probably focus is to make the <Random> option configurable in the tagnavi.config.
Comment by Gary Light (evilg123) - Wednesday, 04 April 2007, 06:49 GMT
Although I can't lend a hand coding, I'd say that this is an interesting feature, there are a lot of rockbox users that just want to randomly play something. But having the feature to randomly play a folder from the current list sounds cool. I would probably start using the database more ;) .
Comment by Mark Reiche (Porphyr) - Wednesday, 04 April 2007, 21:32 GMT
Thanks for the encouragement. You could help me still if you try out this patch and give me suggestion on what you like /dislike / want to have changed.

Minor update: I need to call srand - otherwise the random selection will be very deterministic...
I also tried to make the <Random> entry configurable in the tagnavi.config. However, after this, my rockbox did not boot :-(

So here is the patch for real random selection (with srand - without the broken config stuff)
Comment by Miika Pekkarinen (miipekk) - Monday, 09 April 2007, 10:36 GMT
That looks interesting. I will investigate it soon when I have some time.
Comment by Mark Reiche (Porphyr) - Monday, 09 April 2007, 16:51 GMT
Actually, this feature was one of the main reasons for choosing an iPod. Surprisingly many players do not offer random album selection...

Anyway, the next things I am targetting at are:
- Allow to skip the title display at the end of a filter chain (i.e. if I have selected an album, I normally want to start listening with the first track)
- Suppress the <All tracks> item on the first level (does not make much sense without any filters applied)
- Make the <Random> item switchable in the tagnavi.conf

Unfortunately, my experiments most of the time lead to locking up the Rockbox - I still don't have a clue what I did wrong :-(
Comment by Mark Reiche (Porphyr) - Monday, 09 April 2007, 20:38 GMT
Small addition: Now displays the randomly chosen title instead of "<Random>" as statusbar title.
Comment by Gary Light (evilg123) - Saturday, 14 April 2007, 20:23 GMT
just wanted to say that I have tried out this patch and that it's a very neat feature. It's like putting your albums on shuffle but still gives you some degree of control. I could see this being a valuable tool for making a playlist from a large collection. Keep up the good work
Comment by matt shaffer (magnumforce2006) - Friday, 04 May 2007, 02:48 GMT
Hi there, Using this patch with the Evil G 5-02-07 Ice Build, and I believe this patch has caused a breakdown in the database.

I have tried building the database several times now, and this results in freezing or glitching when I try to access the Database OR the filetree after initialization.
Comment by Steve Bavin (pondlife) - Friday, 04 May 2007, 07:05 GMT
Try using it with a plain SVN build and retest.
Comment by Jose Celestino (japc) - Tuesday, 04 September 2007, 22:50 GMT
Nice one. Will try it as soon as I have the time.
Comment by Anonymous Submitter - Friday, 07 September 2007, 13:45 GMT
Can you change the patch so, that it add the options not only when browsing artits, but also Album Artists? Thanks
Comment by Mark Reiche (Porphyr) - Friday, 07 September 2007, 15:01 GMT
Quotation from the original posting

"My code simply adds another menu item called "<Random>" to each level of the Database lookup tree, just beneath the "<All tracks>" entry."

This is not just random album selection, it allows you to select randomly whatever you like (random year, random genre, random ... anything, and also random album artist). Just try it out!
Comment by Anonymous Submitter - Friday, 07 September 2007, 15:08 GMT
No, there are no "Random" or "All tracks" when I browser by album arist at all!
Comment by Anonymous Submitter - Friday, 07 September 2007, 15:10 GMT
Ok, nevermind. It's there, I could swear it wasn't when I looked last time lol.
Comment by Anonymous Submitter - Saturday, 22 September 2007, 14:21 GMT
Hey, it would be nice, if when I select "all tracks" it would sort the tracks not alphabetical, but by album and tracknumber.
Comment by Xinlu Huang (polygonal) - Friday, 28 September 2007, 23:58 GMT
To the devs: I think this patch is very interesting and would love to see it accepted into svn. Since it had been on the tracker for a while, I would like to know what hold against its inclusion: the lack of customization option? unacceptable implementation? or simply code/feature bloat? or something else?

To porphyr: You mentioned that you tried including the option in tagnavi files; do you mind elaborate on what you did exactly? I'm interested in trying to do this, and it is always nice to know what had been done. I read through tagtree.c a bit and I think I have an idea how to do it.
Comment by Steve Bavin (pondlife) - Thursday, 01 November 2007, 12:36 GMT
I like this patch, and would like to see it committed. One small improvement that could be made would be to suppress the <Random> entry if there is only a single option available.
Comment by Thomas Martitz (kugel.) - Saturday, 17 November 2007, 15:05 GMT
I vote for commit too.