View Single Post
Old 03-31-2008, 05:27 PM   #7
Megatron-UK
Connoisseur
Megatron-UK began at the beginning.
 
Posts: 76
Karma: 22
Join Date: Mar 2008
Location: uk
Device: Sony PRS505
I've recursed through all of my PDF documents and ran the following script:

Quote:
#!/bin/bash

find . -name "*.pdf" -print | grep -v .pdf.new | while read PDFPATH
do
DIR=`echo $PDFPATH | awk -F/ '{print $2}'`
FILE=`echo $PDFPATH | awk -F/ '{print $3}'`
AUTHOR=`echo $FILE | awk -F\- '{print $1}' | sed 's/ *$//'`
VAR2=`basename "$FILE" .pdf | awk -F\- '{print $2}' | sed 's/ *$//' | sed 's/^ //'`
VAR3=`basename "$FILE" .pdf | awk -F\- '{print $3}' | sed 's/ *$//' | sed 's/^ //'`
if [ "$VAR3" = "" ]
then
TITLE=$VAR2
SERIES=""
else
TITLE=$VAR3
SERIES=$VAR2
fi

echo "InfoKey: Author
InfoValue: $AUTHOR
InfoKey: Title
InfoValue: $TITLE" > ./metadata

pdftk "$DIR"/"$FILE" update_info metadata output "$DIR"/"$FILE".new

done
This correctly sets the PDF metadata, based on my known-good filename format of:

AUTHOR - SERIES - TITLE.pdf

or

AUTHOR - TITLE.pdf

However... libprs500 is still displaying the PDF files that I have correctly set the metadata on in the form of "author - title". Almost as if it is ignoring both the metadata *and* the filename regex pattern matching altogether and simply using the filename, minus the pdf extension.
Megatron-UK is offline   Reply With Quote