equal
deleted
inserted
replaced
43 if [[ -z "$streamletFields" ]]; then |
43 if [[ -z "$streamletFields" ]]; then |
44 streamletFields=( "File:MIMEType" "exiftool_xml" ); |
44 streamletFields=( "File:MIMEType" "exiftool_xml" ); |
45 fi |
45 fi |
46 |
46 |
47 for (( i=0; i<${#streamletFields[@]}; i++)); do |
47 for (( i=0; i<${#streamletFields[@]}; i++)); do |
48 # TODO: data type mappings (integers, booleans) |
48 local exifIntegerFields="^(PNG:ImageWidth|PNG:ImageHeight|PNG:BitDepth|File:ImageWidth|File:ImageHeight|File:BitsPerSample|File:ColorComponents)$"; |
49 send OUTPUT_ATTRIBUTE_METADATA "${outputAttributeAliases[$i]-$pdfPrefix${streamletFields[$i]}}" "string" |
49 if [[ "${streamletFields[$i]}" =~ "$exifIntegerFields" ]]; then type="integer"; |
|
50 else type="string"; |
|
51 fi |
|
52 send OUTPUT_ATTRIBUTE_METADATA "${outputAttributeAliases[$i]-$pdfPrefix${streamletFields[$i]}}" "$type" |
50 done |
53 done |
51 |
54 |
52 send WAITING_FOR_INPUT_ATTRIBUTES |
55 send WAITING_FOR_INPUT_ATTRIBUTES |
53 } |
56 } |
54 |
57 |
68 # TODO: validate parameter or use parametrized XPath |
71 # TODO: validate parameter or use parametrized XPath |
69 # TODO: use real namespaces |
72 # TODO: use real namespaces |
70 fi |
73 fi |
71 |
74 |
72 # n.b. for some files exiftools returns exit code, however it provides some basic properties like file timestamps and <ExifTool:Error>Unknown file type</ExifTool:Error> which is also valid XML and might be useful |
75 # n.b. for some files exiftools returns exit code, however it provides some basic properties like file timestamps and <ExifTool:Error>Unknown file type</ExifTool:Error> which is also valid XML and might be useful |
73 if [[ ! "x$streamletValid" == "x0" ]] && [[ "x$value" == "x" ]]; then value=""; isNull="true"; |
76 if [[ ! "x$streamletValid" == "x0" ]] || [[ "x$value" == "x" ]]; then isNull="true"; |
74 else isNull="false"; |
77 else isNull="false"; |
75 fi |
78 fi |
76 |
79 |
77 send OUTPUT_ATTRIBUTE "$value" "$isNull"; |
80 send OUTPUT_ATTRIBUTE "$value" "$isNull"; |
78 done |
81 done |
79 |
82 |