FS#1231 - file search (grep)

Attached to Project: Rockbox
Opened by Stefan Meyer (calpefrosch) - Friday, 18 April 2003, 13:59 GMT
Last edited by Linus Nielsen Feltzing (linusnielsen) - Tuesday, 13 July 2004, 14:26 GMT
Task Type Patches
Status Closed
Assigned To Björn Stenberg (zagor)
Operating System
Severity Medium
Priority High
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


This is a simple file search algorithm.

You have to create a file like index.idx with the
following command under linux:

find ./ -name *.mp3 > index.idx

If you navigate and open this file you have to type in
the search string and then the filename of the result

Enjoy and have fun.

This task depends upon

Closed by  Linus Nielsen Feltzing (linusnielsen)
Tuesday, 13 July 2004, 14:26 GMT
Reason for closing:  Accepted
Additional comments about closing:  Logged In: YES

Thanks Stefan!

I have (finally) made this into a viewer plugin and
committed it.
Comment by Stefan Meyer (calpefrosch) - Friday, 18 April 2003, 20:55 GMT

Sorry, the patch contains an empty file. My system destroyed
the content, so I have to rewrite it :-(
Comment by Stefan Meyer (calpefrosch) - Saturday, 19 April 2003, 15:16 GMT

Now we have the new and right content...
Comment by Anonymous Submitter - Saturday, 19 April 2003, 21:46 GMT

that is one of the best thing since a long time ... 5 days :)
Comment by Anonymous Submitter - Sunday, 20 April 2003, 01:26 GMT

Very nice! Been playing around with it, got a few ideas though

rather than using the file to launch the search why not have a
search item in the menu system which
uses /.rockbox/search.idx and saves the results
to /.rockbox/results.m3u, this I could do

then have the result either play automatically (couldn't get
this working)

or display a list for the user to select (never even attempted
this one)

:D All in all very nice

Stephen Ball
Comment by Anonymous Submitter - Monday, 05 May 2003, 16:24 GMT

Cool feature! I've been waiting for it for a veeeery long time.

Another idea would be to get rid of this .idx file
It would be better to look directly in the directories
(recursively), with a menu item

Moreover, we might be able to search into the ID3 tags (and
not only the file names). But that should be more difficult

Anyway, that's a feature the Archos was missing a lot!
Thanks for the work, I hope this will be implemented in the
next version of RockBox
Boris Maras
Comment by Anonymous Submitter - Monday, 05 May 2003, 23:48 GMT

After disussing on IRC, searching into directories would be a
bit long. The best would be to be able to search into a
standard playlist : Rockbox can already create a root.m3u
with all the files.
Thus, the search feature can be used without any plugged
computer : you generate the m3u and then you can search
into it (with the On+play keys for example)

It seems like your feature almost already works on any
playlist. We would only have to skip commented lines
(beginning with #).
I tried a few modifications in your code but did not manage to
make it work (I'm a newby on Rockbox)

Another improvement we could make is to use a better
search algorithm. I was told to use the Boyer-Moore

I did not manage to have a debug mode on the Archos (or the
simulator) so I have difficulties to understand your code

Feel free to contact me if I can help.

Boris Maras
Comment by Björn Stenberg (zagor) - Thursday, 05 June 2003, 08:38 GMT

Nice feature, but I feel it could be improved in a few ways:

1) Don't search an .idx file, search ordinary .m3u files instead
(via the on+play menu). Then instead of making a special .idx
file, we can simply search using "allfiles.m3u".

2) The search code is very complex. Why not just read_line(),
check_line(), fprintf()? (check_line() could be a simple stristr
at first, and then improved to use Boyer-Moore or similar)

I think having a fixed filename is fine. If you want to save
your result, it's very simple to rename the file. Having to enter
a result name for every search would be too tedious.
Comment by Remo Hofer (remo_hofer) - Thursday, 05 June 2003, 13:17 GMT

I'd like to enhance this idea to search also "some" id3
tag information. This could be done by supporting the
winamp #EXTM3U playlist format for searching.

Create playlist could also be enhanced to optionally
create the #EXTINF comments. Yes, I know this could
be slow, but it's only an option and the playlists could
also be created on the pc. A small perl script in the
rockbox distribution could do the trick.
Comment by Björn Stenberg (zagor) - Thursday, 05 June 2003, 13:40 GMT

I dislike polluting the clean and simple .m3u format with file
metadata. A real id3 search feature should scan and index
mp3 files, not use hacked .m3u files.
Comment by Anonymous Submitter - Monday, 16 June 2003, 01:19 GMT

gives me an error every time, most of the time the
search_results.m3u is just an empty playlist. Got my hopes
up for nothing :(
Comment by Linus Nielsen Feltzing (linusnielsen) - Tuesday, 13 July 2004, 14:26 GMT

Thanks Stefan!

I have (finally) made this into a viewer plugin and
committed it.