LocnRox (Enhanced with Vovchik)

Stuff that has yet to be sorted into a category.
Post Reply
Message
Author
seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

LocnRox (Enhanced with Vovchik)

#1 Post by seaside »

There is an outstanding program for simple searchs that aragon uploaded called Mlocate. Thanks aragon and vovchik.

This is a very nice, compact program which produces a small indexed database of all files on your system and is lightning fast. You just enter a search term and bang! it shows all the hits.

For me, the drawback is that I don't necessarily just want to know what files are there and where they are - I'd also like to take some further action on the files found.

To that end, I've created LocnRox.

LocnRox is a Gtkdialog interface that quickly -

1) Pops up a highlighted search box.

2) You key in the search term and hit enter.

The bottom part of the dialog then instantly shows all the found files.

Double-click on any found file and Rox will open in that directory. Now, you can DO SOMETHING with your "found" files - copy,move,delete,symlink,run,edit.. whatever.

The LocnRox pet contains the Mlocate program (Locate), the file "00-update-mlocatedb" in the /Startup directory which runs the updatedb command at boot, so that the index is always up to date.

LocnRox is under Menu > Filesystem and after you install the pet, be sure to press the "update database" button before using the first time (after that it will update at every boot, or you can update anytime that you've added additional drives or files during a session..

Restart JWM, and it should be in the menu system.


(What would really be great is to have this integrated into the Pfind program, for even greater capabilities......) :roll:
Attachments
locnrox.pet
locnrox - locate files and open Rox
(74.3 KiB) Downloaded 1005 times
Last edited by seaside on Sat 03 Oct 2009, 14:50, edited 1 time in total.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#2 Post by vovchik »

Dear seaside,

I like your file find utility very much. I think I made it a little prettier, added slocate to the mix, a help screen and little C file I wrote some time back to show an animated gif while slocate is doing its work. Please have a look and tell me what you think. It should be unpacked into /usr/local. It could start with a little bash script that does a cd to the pfilefind dir and then launches the real prog.

I have added two screenshots.

With kind regards,
vovchik
Attachments
Pfilefind.tar.gz
(47.21 KiB) Downloaded 926 times
pfilefind2.jpg
(74.4 KiB) Downloaded 1583 times
pfilefind1.jpg
(48.79 KiB) Downloaded 1524 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#3 Post by seaside »

vovchik,

Thanks very much.

That looks much better with help and an update of the database buttons.

I will download it and take a look.

Regards,
s

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#4 Post by seaside »

vovchik,

Very nicely done and some additional changes are needed to make it work -

**setup**

Add command "addgroup slocate"

Create directory "/var/lib/slocate"

Add file "/etc/updatedb.conf" (default config file)

Change --

Code: Select all

function findfiles()
# ------------------------
{
	slocate "$ENTRY" | sort > /tmp/locatefoundfiles
}	

Since "slocate" is not in the path, it needs a "./bin/slocate"

The "waiting" and pacing cat is great, but shouldn't it be a Puppy? :D :D

Isn't Gtkdialog great for tool making?

Cheers,
s

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#5 Post by vovchik »

Dear seaside,

Do you want to make the changes or shall I? I have been using slocate forever, so I didn't remember the installation steps. And it was in my path, so I got no errors. Oops! Sorry about that.

As for the puppy gif, how about some of the ones below?

With kind regards,
vovchik

PS. If you make the changes, you could post a new pet. I have never created one.
Attachments
dog-rover-gait.gif
(40.21 KiB) Downloaded 1476 times
dog-stir-crazy.gif
(23.57 KiB) Downloaded 1450 times
dog-butch.gif
(19.96 KiB) Downloaded 1563 times
dog-pup-tailwag.gif
(11.23 KiB) Downloaded 1570 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#6 Post by seaside »

vovchik,

My inclination is to favor Mlocate as it seems to have more speed and efficiency over Slocate see -

http://carolina.mff.cuni.cz/~trmac/blog/mlocate/

Those attached Puppies are all so good, it's very hard to pick one. Although my wife likes the last one the best. :D

I could repackage the LocnRox pet with Mlocate and your enhancements or you could make a pet with Slocate -

Making a pet is really the same as a Tar.

Open terminal at level of DIRNAME

dir2pet DIRNAME - mostly hit enter for a couple of questions and it makes a pet.

Regards,
s

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#7 Post by vovchik »

Dear seaside,

You might be right about mlocate being faster - although it has been a long time since I compared and I now have a 1.5 TB disk with 12 partitions and had 100 GB before, so circumstances have changed. Why don't you go ahead and package the mlocate version? Just for your info, I also like the last pup in that gif series. Incidentally, the reason I wrote that little gif launcher is that gtkdialog is notoriously hard to kill and may lead to undesirable consequences if another gtkdialog prog is loaded. It's a cheap kluge but works as expected. Otherwise, gtkdialog, via gdk-pixbuf, displays animated gifs nicely (but you probably know that):

Code: Select all

#! /bin/bash
mypic=$1
echo $mypic
mypic1=`basename $mypic`
export wait_splash='
<window title="Showing: '$mypic1'" icon-name="gtk-refresh">
<vbox>
 <frame>
  <pixmap><input file>'$mypic'</input></pixmap>
  <text use-markup="true"><label>"<b>Please be patient...</b>"</label></text>
 </frame>
</vbox></window>
'
gtkdialog3 --program=wait_splash --center
I am eager to see your finished pet. I will try to do an slocate one too.

With kind regards,
vovchik

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#8 Post by seaside »

vovchik wrote:Dear seaside,

You might be right about mlocate being faster - although it has been a long time since I compared and I now have a 1.5 TB disk with 12 partitions and had 100 GB before, so circumstances have changed. Why don't you go ahead and package the mlocate version? Just for your info, I also like the last pup in that gif series. Incidentally, the reason I wrote that little gif launcher is that gtkdialog is notoriously hard to kill and may lead to undesirable consequences if another gtkdialog prog is loaded. It's a cheap kluge but works as expected. Otherwise, gtkdialog, via gdk-pixbuf, displays animated gifs nicely (but you probably know that):
Vovchik,

I have updated LocnRox with your enhancements at the first post.

Yes, gtkdialog sometimes needs alot of "sweeping up" after. That's a handy program you made to visually pass some time - (on my system the dog only takes a half wag and it's done) :D

I did not know about running animated gifs (but then again, there is no end to things that I don't know) :D

Regards,
s

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#9 Post by vovchik »

Dear seaside,

Very nice. I do need the screen gif because mlocate indexing on my machine took a good 7 minutes. It produced a file of 23 mb, whereas the slocate db is 13 mb. Incidentally, mlocate does not recognize wildcards in the way that slocate does (e.g. /icons*glass*png), so there are plusses and minuses with each of them.

With kind regards,
vovchik

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#10 Post by Keef »

Evening All,

Tried this in 214X14.1, but nothing appears. Below is what is running according to htop, the first using 100% CPU:

Code: Select all

gtkdialog -i /usr/local/LocnRox/locnrox
/usr/sbin/gtkdialog3 -e /usr/local/LocnRox/locnrox
/bin/sh /usr/local/LocnRox/locnrox
sh -c source /usr/local/LocnRox/locnrox; gtkdialog -i /usr/local/LocnRox/locnrox
If I try running it from a terminal, I get:

Code: Select all

# locnrox
Tinylogin v1.4 (2005.08.02-19:41+0000) multi-call binary
Usage: addgroup  [OPTIONS]  <group_name>
... which seems a little strange.
In htop, only the gtkdialog line is showing, but again running at 100%

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#11 Post by Bert »

seaside wrote:vovchik,
Those attached Puppies are all so good, it's very hard to pick one. Although my wife likes the last one the best. :D
s
So do I!
Looks a bit like my sister when she was younger :)

Dog 1 is not receiving enough nourishment
Dog 2 looks like my brother-in-law when he gets nervous
Dog 3 needs a special-care kennel
:lol:
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#12 Post by seaside »

Keef wrote: If I try running it from a terminal, I get:

Code: Select all

# locnrox
Tinylogin v1.4 (2005.08.02-19:41+0000) multi-call binary
Usage: addgroup  [OPTIONS]  <group_name>
... which seems a little strange.
In htop, only the gtkdialog line is showing, but again running at 100%
Hi Keef,

Let's try typing in a terminal in the locnrox directory - "addgroup mlocate" and then "./locnrox" and see what happens.

Perhaps there is a problem with that puppy version as this was tested and made on 4.12.

Did you by any chance try the first LocnRox version with success?

Good luck,
s

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#13 Post by seaside »

vovchik wrote:Dear seaside,

Very nice. I do need the screen gif because mlocate indexing on my machine took a good 7 minutes. It produced a file of 23 mb,
vovchik
Vovchik,

Now, I just have to ask you?

Are you going to believe your own eyes and experience, or the author of Mlocate's website showing his benchmarks demonstrating a clear superiority over Slocate :D :D

Regards,
s
(hmmmm, maybe we do need a slocate version... or you'll just have to cut out your huge drive :D .)

Note: if I recall correctly the first run of Mlocate is the worst, but further runs are faster -maybe?
Last edited by seaside on Sat 03 Oct 2009, 20:28, edited 1 time in total.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#14 Post by Keef »

Seaside,

Just tried your suggestion, but no change - exactly same result as before (get the Tinylogin output again after running "addgroup mlocate")
I've only tried the most current version.
I'll try it on some other pups just for comparison (3.01, 301X and slaxer)

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#15 Post by seaside »

Keef,

Here's the first version pet.

See if that works :D
Attachments
LocnRoxOLD.pet
LocnRox - first version
(31.15 KiB) Downloaded 925 times

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

Bert wrote:
seaside wrote:vovchik,
Those attached Puppies are all so good, it's very hard to pick one. Although my wife likes the last one the best. :D
s
So do I!
Looks a bit like my sister when she was younger :)

Dog 1 is not receiving enough nourishment
Dog 2 looks like my brother-in-law when he gets nervous
Dog 3 needs a special-care kennel
:lol:
Bert,

Do we have any assurances that you are in fact a human?

(There have been rumors floating around that real puppies are trolling the internet and speaking their thoughts on family members and others :D :D )

Regards,
s
(Confidentially, my brother-in-law reminds me of that "king Charles" spaniel model) :D

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#17 Post by Keef »

seaside,

No joy with the older version.
Tried the latest one on slaxer and 301X where it worked, but it didn't on 3.01.
After finding out that Tinylogin was part of Busybox, I installed the busybox-20090725.pet to see what happened. It solved the 'addgroup' problem, but... still no dialog box or gyrating puppies.

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#18 Post by seaside »

Keef wrote:seaside,

No joy with the older version.
Tried the latest one on slaxer and 301X where it worked, but it didn't on 3.01.
After finding out that Tinylogin was part of Busybox, I installed the busybox-20090725.pet to see what happened. It solved the 'addgroup' problem, but... still no dialog box or gyrating puppies.
Keef,

Ah...... I'm sorry it's not working and I'm at a loss to think of anything else to try.

Not to lead you off this, but have you tried "searchmonkey", it's not an indexed search, yet it's reasonable fast and well featured.

Wait.. one more idea .... Gtkdialog versions...the puppy 4 has Gtkdialog3 - perhaps yours have earlier ones.

Cheers,
s

rollo5
Posts: 4
Joined: Thu 07 Mar 2013, 18:56

multiple keywords support

#19 Post by rollo5 »

Hello seaside,

thank you for this little tool. For a long time I was looking for something like this. My needs are: fast search, open the filemanager on clicking, multiple keywords, possibility to sort files for filename, date and size.

I added support for multiple keyword search. Now you can type in for example "spot dir" (without quotes) and it shows you all files with spot and dir in the filename. Of course you can search for extensions like "firefox png".

Code: Select all

#! /usr/sbin/gtkdialog3 -e

# ------------------
# PROGRAM:	locnRox (pfilefind)
# AUTHORS:	Seaside (locnrox) and Vovchik
# PURPOSE:	GUI to find files
# DEPENDS:	bash, gtkdialog, showsplash, Mlocate
# PLATFORM:	Linux
# DATE:		29 September
# VERSION:	v.0.1a
# ------------------

# ------------------------
# INITIALIZATION
# ------------------------

## gtkdialog3 has to be linked to gtkdialog in usr/sbin

if [ ! -f /usr/sbin/gtkdialog ]; then ln -s /usr/sbin/gtkdialog3 /usr/sbin/gtkdialog ; fi 

TITLE="LocnRox"
VERSION="V. 0.1a"

PFILEFIND_HELP_TEXT="
<b>LocnRox</b> helps you to find files on your storage media \
(hard disks, USB sticks, main file system) using the <b>Mlocate</b> utility. 

<b>Operation:</b>
  
1. First, mount the drives you wish to catalogue and press the <b>Update</b> \
button to create the mlocate database. Once you have done this <i>- and \
this procedure may take up to five minutes with a lot of partitions \
mounted -</i> , you can search for files.

2. Enter a file name or partial file name (wildcards - * - are permitted) in \
the <b>Input Box</b>.

3. Press the <b>Search</b> button. 

4. The program will search its database and present you with a list \
of matching files. When you click on a file name in the list, the program \
will launch <b>Rox Filer</b> in that file's directory.

5. To exit the program, press the <b>Cancel</b> button."

# ------------------------
# END INITIALIZATION
# ------------------------


# ------------------------
# FUNCTIONS
# ------------------------

# ------------------------
function findfiles()
# ------------------------
{
# added support for multiple keywords: first word is searched by locate. The
# output is saved to the file "search_$key_word_number". Now grep searches
# the output for the other keywords.


	key_words_array=($ENTRY)

	typeset -i key_word_number=0
	typeset -i old_key_word_number
	typeset -i key_words_array_size_minus_one

	locate -i ${key_words_array[$key_word_number]} > /tmp/search_$key_word_number

	key_words_array_size_minus_one=${#key_words_array[@]}-1

	while [ $key_word_number -lt $key_words_array_size_minus_one ]
	do
		old_key_word_number=$key_word_number
		key_word_number=$key_word_number+1
		grep -i ${key_words_array[$key_word_number]} /tmp/search_$old_key_word_number > /tmp/search_$key_word_number
	done

	mv /tmp/search_$key_word_number /tmp/locatefoundfiles

#	./bin/locate "$ENTRY" | sort > /tmp/locatefoundfiles
}	

# ------------------------
function roxview()
# ------------------------
{
	rox -s "$FILE"
}

# ------------------------
function dbupdate()
# ------------------------
{	
	var1="./img/dog-pup-tailwag.gif"
	var2="<b>Indexing files. Please be patient</b>"
	var3="LocnRox Update"
	./bin/showsplash "$var1" "$var2" "$var3"&
	./bin/updatedb
	killall showsplash
}

# ------------------------
# END FUNCTIONS
# ------------------------

# ------------------------
#  HELP WINDOW	 
# ------------------------
	
export PFILEFIND_HELP_DIALOG='
<window title="LocnRox Help" icon-name="gtk-help">
	<vbox>
		<pixmap>
			<input file>"./img/logo.png"</input>
		</pixmap>
		<text use-markup="true"> 
			<label>"<b>'$TITLE' HELP</b>"</label> 
		</text>
		<frame>
		<text use-markup="true" wrap="true">
			<label>"'$PFILEFIND_HELP_TEXT'"</label>
		</text>
		</frame>
		<hbox>
			<button cancel>
				<action>closewindow:PFILEFIND_HELP_DIALOG</action>
			</button>
		</hbox>
	</vbox>
</window>
'
# ------------------------
#  MAIN WINDOW	 
# ------------------------

export MAIN_DIALOG='
<window title="LocnRox" decorated="true" window_position="1" icon-name="gtk-find">
	<vbox>
		<frame>
			<pixmap>
				<input file>"./img/logo.png"</input>
			</pixmap>
			<vbox> 
				<text use-markup="true"> 
					<label>"<b>'$TITLE'</b>"</label> 
				</text> 
				<text use-markup="true"> 
					<label>"<i>Locate file and launch Rox Filer</i>"</label> 
				</text>
				<text use-markup="true"> 
					<label>"<b>'$VERSION'</b>"</label> 
				</text> 
			</vbox>
		</frame>
		<frame>
			<hbox>
      			<text>
        			<label>Search term:</label>
      			</text>
					<entry activates-default="true">
					<default>Enter search term</default>
					<variable>ENTRY</variable>
					</entry>
				<button can-default="true" has-default="true">
					<input file>"./img/find.png"</input>
					<label>Search</label>
					<action>findfiles</action>
					<action>refresh:FILE</action>
				</button>
			</hbox>
		</frame>
		<frame Choose your file>
			<tree headers_visible="false" rules_hint="true">
				<label>Found files</label>
				<height>250</height><width>500</width>
				<input>cat /tmp/locatefoundfiles</input>	
				<variable>FILE</variable>
				<action>roxview</action>	
			</tree>
		</frame>
		<hbox>
			<button help>
				<action>launch:PFILEFIND_HELP_DIALOG</action>
			</button>
			<button>
				<input file>"./img/go.png"</input>
				<label>Update DB</label>
				<action>dbupdate</action>
			</button>
			<button cancel>
				<action type="exit">QUIT</action> 
			</button>
		</hbox>
	</vbox>
</window>
'

I'm a beginner in bash scripting - maybe there is a better solution.

If i have time I would make the sorting feature (sorting by size and date). Do you have an I idea how I could make this?

regards, rollo

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: multiple keywords support

#20 Post by seaside »

rollo5 wrote:Hello seaside,

If i have time I would make the sorting feature (sorting by size and date). Do you have an I idea how I could make this?

regards, rollo
rollo,

Nice enhancement.

Rox has some nice built-in SOAP RPC facilities for invoking sort functions as described in the Rox manual.

http://rox.sourceforge.net/Manual/Manua ... .html#soap

For example to sort by date -

Code: Select all

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
  <OpenDir>
   <Filename>/mnt/sdb6</Filename>
   <Sort>Date</Sort>
  </OpenDir>
 </env:Body>
</env:Envelope>
EOF
Cheers,
s

Post Reply