Thread: impfind
View Single Post
Old 09-01-2008, 11:46 AM   #1
derrell
Jack O' Apes
derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.derrell once ate a cherry pie in a record 7 seconds.
 
derrell's Avatar
 
Posts: 227
Karma: 1939
Join Date: Dec 2007
Location: Oklahoma
Device: Ebookwise 1150, Nokia N810, EZ-Reader, HTC Droid Incredible, Archos 70
impfind and impfindGUI

This is short command line perl script and a longer gui version, that will search a directory for imp ebooks and display information about them. It uses switches to determine what you want to search for and how. Place the script somewhere in your path and set the executable bit.

There are a few caveats for now.
Searching for more than one field doesn't work right now.
In version 0.2 the default behaviour is to search all fields. The a, c, and t switches can be used to search for author only category only or title only.

Searches are always case sensitve.
In version 0.2 the -S switch can be used to force case sensitive searches, otherwise the default behaviour is case insensitive.

The script works in windows xp with perl installed but doesn't display the path seperators correctly.
Path seperators in version 0.2 should work in whatever os you are using.

I also don't know how it wil handle truly large numbers of files. I didn't test it with more than about 50.


Examples:

Code:
impfind.pl -h

impfind version 0.2
impfind [-hRSflact] directory space seperated list of keywords to search for
impfind -i path to book 

-h help this short help list and the version
-R Recurse through subdirectories
-l list the information for all located books. Category, Title, Author
-S Sensitive to Case Searching
-f full search results the default is just to give a list of paths
-V Verbose gives lots of information very little of which is much use to 
        most people.  Used for a closer look at what is going on for debugging
-i path to a book to show information about
        If the following switches are omitted impfind will search all three
        of fields for any of the keywords.
-a Search only the Author field for the keywords
-t Search only the Title field for the keywords
-c Search only the Category field for the keywords
To search a directory for books with the word moon in the title, author, or category fields recursively.
Code:
impfind.pl -R /home/derrell/Books/EB1150 moon

Searching /home/derrell/Books/EB1150
for files ending with .imp
Searching through sub directories.
Getting information for 37 Books
Found 1 Books
Containing moon
/home/derrell/Books/EB1150/Ringo/East_of_the_Sun_and_West_of_the_Moon.imp
To search a directory for books with the word moon in the title, author, or category fields recursively and display the full book info.
Code:
impfind.pl -Rf /home/derrell/Books/EB1150 moon

Searching /home/derrell/Books/EB1150
for files ending with .imp
Searching through sub directories.
Getting information for 37 Books
Found 1 Books
Containing moon
Path: /home/derrell/Books/EB1150/Ringo/East_of_the_Sun_and_West_of_the_Moon.imp
Category: Science Fiction
Title: East of the Sun West of the Moon
Author: John Ringo
To search a directory for books with the words, tarzan moon apes son, in the title, author, or category fields recursively.
Code:
impfind.pl -R /home/derrell/Books/EB1150 tarzan moon apes son 

Searching /home/derrell/Books/EB1150
for files ending with .imp
Searching through sub directories.
Getting information for 37 Books
Found 11 Books
Containing tarzan moon apes son
/home/derrell/Books/EB1150/Burroughs/Tarzan/Tarzan_of_the_Apes_hd.imp
/home/derrell/Books/EB1150/Burroughs/Tarzan/Tarzan_of_the_Apes.imp
/home/derrell/Books/EB1150/Burroughs/Tarzan/Beasts_of_Tarzan.imp
/home/derrell/Books/EB1150/Ringo/East_of_the_Sun_and_West_of_the_Moon.imp
/home/derrell/Books/EB1150/Burroughs/Tarzan/The_Son_of_Tarzan.imp
/home/derrell/Books/EB1150/Burroughs/Tarzan/The_Son_of_Tarzan_hd.imp
/home/derrell/Books/EB1150/bookshelf/shelf/The_Return_of_Tarzan.imp
/home/derrell/Books/EB1150/bookshelf/shelf/Beasts_of_Tarzan.imp
/home/derrell/Books/EB1150/Burroughs/Tarzan/The_Return_of_Tarzan.imp
/home/derrell/Books/EB1150/bookshelf/shelf/Tarzan_of_the_Apes.imp
/home/derrell/Books/EB1150/bookshelf/shelf/The_Son_of_Tarzan.imp
Using the directory that impfind.pl was started in and searching for books by Author Scalzi
Code:
impfind.pl -a Scalzi

Searching /home/derrell/Books/EB1150/
for files ending with .imp
Getting information for 7 Books
Searching Author fields for: Scalzi
Found 1 Books
/home/derrell/Books/EB1150/JohnScalzi-Old_Mans_War.imp
Add the -R switch to make it look through all of the directories below where it was started.
Code:
impfind.pl -Ra Scalzi

Searching /home/derrell/Books/EB1150/
for files ending with .imp
Searching through sub directories.
Getting information for 37 Books
Searching Author fields for: Scalzi
Found 1 Books
/home/derrell/Books/EB1150/JohnScalzi-Old_Mans_War.imp


You can request information on a specific book with -i switch. No other switches will be looked at when -i is used.
Code:
impfind.pl -i /home/derrell/Books/EB1150/Ringo/East_of_the_Sun_and_West_of_the_Moon.imp

Information for
/home/derrell/Books/EB1150/Ringo/East_of_the_Sun_and_West_of_the_Moon.imp
id: ebook:guid-bfbf259a5b8111ddff910013d4244fc9
category: Science Fiction
sub_category: outPages=585&inPages=904
title: East of the Sun West of the Moon
author_last: 
author_mid: 
author_first: John Ringo
Edit/
09/01/08 added version 0.2 of the script and changed the instructions on how to use it.

Edit/
09/02/08 Fixed bug with single command line switch. Version 0.2.1

Edit:
09/13/08 Added gui version 0.3

Edit:
09/13/08 Added version 0.3.1 to fix windows help bug.

Edit:
09/19/08 Uploaded version 0.4 many improvements and new bugs

Edit:
09/21/08 Uploaded version 0.4.1 changed things around some more.
Attached Files
File Type: pl impfind.pl (3.9 KB, 1210 views)
File Type: zip impfind-0.2.zip (5.6 KB, 1362 views)
File Type: zip impfind-0.2.1.zip (2.3 KB, 1324 views)
File Type: zip impfind-0.3.zip (11.1 KB, 1327 views)
File Type: zip impfind-0.3.1.zip (18.4 KB, 1368 views)
File Type: zip impfind-0.4.zip (19.9 KB, 1370 views)
File Type: zip impfind-0.4.1.zip (32.5 KB, 1312 views)

Last edited by derrell; 09-21-2008 at 08:56 AM. Reason: attaching script
derrell is offline   Reply With Quote