View Single Post
Old 08-15-2009, 04:11 AM   #11
myle00
Connoisseur
myle00 has a complete set of Star Wars action figures.myle00 has a complete set of Star Wars action figures.myle00 has a complete set of Star Wars action figures.myle00 has a complete set of Star Wars action figures.myle00 has a complete set of Star Wars action figures.
 
myle00's Avatar
 
Posts: 71
Karma: 422
Join Date: Jun 2009
Device: Palm Treo
I was bored enough that I wrote it anyway. You can run using a folder with files or a text file listing the files to process. I attached the java file. You need to run the java file from command line with input.

However, first you need to compile the java file. I don't know if you know how to do that so here is the instructions. Go here http://java.sun.com/docs/books/tutor...ava/win32.html start at the section "Compile the Source File into a .class File" and follow the instructions. Basically you need to run this in cmd
Code:
javac SwitchCalTA.java
(Assuming you're in the directory where SwitchCalTA.java is in).

If cmd cannot recognize javac than you'll have to set it in the path. Go to Start>Right click Computer>properties>Advanced system settings>Environment Variables. Find Path in the System variables list, click edit and at the end of the "variable value" field enter ";C:\Program Files\Java\jdk1.6.0_07\bin;" DO NOT DELETE the text in that field, just append to the end. This assumes java is in that folder, else find where java is in your computer and add the path to the bin folder in path. Now run the javac code again. If it was compiled you'd see a class type file in your current folder.

Once it's complied you can run the program. To run it type
Code:
java SwitchCalTA "Folder.with.books or txt.file.with.books.list" "Folder.where.a.log.will.be.saved.to"
the command is composed of "java" than the name of the java file, followed by the folder path where the books are or a text file listing the full path of the files you wish to switch metadata, and followed by a folder where a log will be saved to. It will than start editing and printing the metadata it's changing. Here's how it looked on my cmd
Code:
C:\Users\xxxxxxxxxxxx>cd C:\22

C:\22>javac SwitchCalTA.java

C:\22>java SwitchCalTA "C:\Tests" "C:\Books"
I have 39 files to process


File: 0


"ebook-meta "C:\Tests\tAaa\Failed.txt""
Title               : Failed
Author(s)           : Unknown
"ebook-meta "C:\Tests\tAaa\Failed.txt" -t "Unknown""
Original metadata::
        Title               : Failed
        Author(s)           : Unknown

Changed metadata::
        Title               : Failed
        Author(s)           : Unknown
.......
.......
If you input a folder instead of a file list, it will edit the metadata for ALL the files in the directory, even those in sub-directories. Of course calibre ignores files that it cannot change metadata. Before you run it make sure you test it on a few individual files. You should probably also run it on a copy of the files and if it's ok, delete the originals.

Let me know if you have any questions.
Attached Files
File Type: zip SwitchCalTA.zip (2.3 KB, 374 views)
myle00 is offline   Reply With Quote