|07-25-2007, 11:36 PM||#1|
Join Date: Jul 2007
Device: Sony PRS-900, Sony PRS-600, T-Mobile G1, Kindle v1, iPad
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.
|07-26-2007, 12:04 AM||#2|
Join Date: Nov 2006
Location: Virginia, USA
Device: Sony PRS-500
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.
|07-26-2007, 12:30 PM||#3|
Creator of calibre
Join Date: Oct 2006
Location: Mumbai, India
You should add an option to specify the field delimiter so that it's not restricted to hyphens.
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Anyone interested in a little competition?||BeTePoK||Lounge||6||02-04-2010 05:54 AM|
|Interested in Old Periodicals?||KindleKid||Workshop||8||08-03-2009 02:21 AM|
|ebook interested||Saraguin Harper||Introduce Yourself||2||01-26-2009 01:38 PM|
|I'm interested mainly in pdf's, which one then ?||eisho||Which one should I buy?||8||08-05-2008 08:56 AM|
|Not backlit? Not interested.||ColdSun||News||36||01-18-2008 03:02 PM|