Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 07-25-2007, 10:36 PM   #1
coleman
Connoisseur
coleman began at the beginning.
 
Posts: 95
Karma: 38
Join Date: Jul 2007
Device: Android tablets and phones, Windows tablet, Kobo Aura One
Would anyone be interested in this script...

So I haven't received my reader yet, but I'm already preparing for it.

I hope I didn't just do something that someone else already did, but I wrote a script today that acting as a wrapper to the various 2lrf programs, which allows you to easily batch process a large number of files which have things that you'd want in metadata, in their file names. e.g.
Say I have these files:
Bob, Smith - Bob's Books - Book 1.txt
Bob, Smith - Bob's Books - Book 2.txt
Bob, Smith - Bob's Books - Book 3.txt
Jones, Sam - Sam's Books - Book 1.lit
Jones, Sam - Sam's Books - Book 2.lit

using my script, you can say:
File2LRF "Bob, Smith - Bob's Books - Book 1.txt" a,t,s

The script will deconstruct the file name, identify what type it is based on the extension, then call txt2lrf(in this case, it will work with lit, rtf, and htm/html), and add the metadata fields for the author and title.

The "a,t,s" stands for author, title, and subtitle. You're just describing where each token is in the file name, so if the author had been last, it would read, "t,s,a" instead.

Ok...now, that in of itself isn't that great of a time saver, but what you can then do(I was too lazy to add file name support directly in the script) is use the FOR command with the wrapper to process a bunch of files that have the same general token layout, and end up with LRF files that have meta data in them, i.e. to do all 3 of those(or any arbitrary number as long as the token layout is the same) I could then do this at the command prompt:

FOR %x IN (BOB*.*) DO File2LRF "%x" a,t,s

and that would process all 3 of the Bob files. Now, the extra cool part, since the Sam files in the example have the same token structure, i.e. author, followed by title, followed by subtitle, in my FOR, I could have specified *.* as the file spec, and it would work on all 5 files.

So it's important you choose the wildcard spec in the FOR carefully, because all the files that match it MUST meet the token spec. If they don't, you'll either get weird broken behavior at worst, or at best, you'll get a file, but it'll have metadata in the wrong spots. You could do a whole directory at once as long as the file names are all structured the same. The script will ignore/discard files with extensions it doesn't have a way to handle(i.e. PDF right now).

Let's see...that's everything, it's not thoroughly tested, but a couple of tries on my own stuff and it seems to work. If it would be helpful to anyone else, let me know and we can arrange for you to get a copy, or if there's enough interest I'll put it up somewhere.

Maybe libprs500 had an easy way to do this, but I didn't find it if it did.
coleman is offline   Reply With Quote
Old 07-25-2007, 11:04 PM   #2
RWood
Technogeezer
RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.RWood ought to be getting tired of karma fortunes by now.
 
RWood's Avatar
 
Posts: 7,233
Karma: 1601464
Join Date: Nov 2006
Location: Virginia, USA
Device: Sony PRS-500
Interesting.

You can post a copy here as an attachment and let other people try it and help debug/expand it. That's what happened with Stingo's Word Macro, it evolved over a short period of time. Perhaps something like it will make its way into libprs500.
RWood is offline   Reply With Quote
Advert
Old 07-26-2007, 11:30 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You should add an option to specify the field delimiter so that it's not restricted to hyphens.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone interested in a little competition? BeTePoK Lounge 6 02-04-2010 04:54 AM
Interested in Old Periodicals? KindleKid Workshop 8 08-03-2009 01:21 AM
ebook interested Saraguin Harper Introduce Yourself 2 01-26-2009 12:38 PM
I'm interested mainly in pdf's, which one then ? eisho Which one should I buy? 8 08-05-2008 07:56 AM
Not backlit? Not interested. ColdSun News 36 01-18-2008 02:02 PM


All times are GMT -4. The time now is 10:46 AM.


MobileRead.com is a privately owned, operated and funded community.