Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Publisher field #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ To avert confusion and ensure consistency across different PDF handlers it is im
| Year | CreateDate | Date |
| Keywords | Keywords | Subject |
| Subject | Subject | Description |
| Publisher | Producer | Publisher |

### Purging metadata

Expand Down
4 changes: 4 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ BinPath="$InstallPath/bin"
LauncherPath="$InstallPath/share/applications"
IconPath="$InstallPath/share/icons/hicolor/scalable/apps"

mkdir -p "$BinPath"
mkdir -p "$LauncherPath"
mkdir -p "$IconPath"

Application="PDFMtEd"
InstallationFiles=("desktop/pdfmted-editor.desktop" "desktop/pdfmted-inspector.desktop"\
"desktop/pdfmted.svg" "pdfmted-editor" "pdfmted-inspector" "pdfmted-thumbnailer")
Expand Down
20 changes: 13 additions & 7 deletions pdfmted-editor
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ gui_metadata_entry_multi(){
--field="Year:":NUM "$YEAR_ORIGINAL[!0..3000[!1]]" \
--field="Keywords:" "$KEYWORDS_ORIGINAL" \
--field="Subject:" "$SUBJECT_ORIGINAL" \
--field="Publisher:" "$PUBLISHER_ORIGINAL" \
--field "$TEXT_BTTN_CLRALL!gtk-clear!$TEXT_HOVR_CLRALL":FBTN \
"@bash -c gui_clear_fields" \
--field="":LBL "" \
Expand Down Expand Up @@ -459,6 +460,7 @@ duplicate_metadata () {
TITLE_ORIGINAL="$TITLE"
YEAR_ORIGINAL="$YEAR"
SUBJECT_ORIGINAL="$SUBJECT"
PUBLISHER_ORIGINAL="$PUBLISHER"
KEYWORDS_ORIGINAL="$KEYWORDS"
}

Expand All @@ -470,9 +472,10 @@ process_yad_formchoices(){
YEAR="$(echo "$NEW_METADATA" | cut -d '|' -f6 | cut -d ',' -f1 | cut -d '.' -f1)"
KEYWORDS="$(echo "$NEW_METADATA" | cut -d '|' -f7)"
SUBJECT="$(echo "$NEW_METADATA" | cut -d '|' -f8)"
SAVECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f14)"
RENAMECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f15)"
DUPLICATECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f16)"
PUBLISHER="$(echo "$NEW_METADATA" | cut -d '|' -f9)"
SAVECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f15)"
RENAMECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f16)"
DUPLICATECHOICE="$(echo "$NEW_METADATA" | cut -d '|' -f17)"
MODIFYDATE="$(date +"%Y:%m:%d %H:%M:%S")"
if [[ "$YEAR" = "0" ]]; then
CREATEDATE=""
Expand All @@ -485,7 +488,7 @@ process_yad_formchoices(){

read_metadata() {
echo "#Reading embedded metadata..."
exiftool -e -S -PDF:Title -PDF:Author -PDF:Subject \
exiftool -e -S -PDF:Title -PDF:Author -PDF:Subject -PDF:Producer \
-PDF:Keywords -PDF:CreateDate -PDF:ModifyDate \
"$FILE" > "$PROGPIPE"
}
Expand All @@ -498,7 +501,8 @@ print_original_metadata() {
echo "Year: $YEAR_ORIGINAL"
echo "Creation date: $CREATEDATE_ORIGINAL"
echo "Modification date: $MODIFYDATE_ORIGINAL"
echo "Subject: $SUBJECT_ORIGINAL"
echo "Subject: $SUBJECT_ORIGINAL"
echo "Publisher: $PUBLISHER_ORIGINAL"
echo "Keywords: $KEYWORDS_ORIGINAL"
}

Expand All @@ -510,6 +514,7 @@ evaluate_original_metadata() {
YEAR_ORIGINAL="${CREATEDATE_ORIGINAL:0:4}"
MODIFYDATE_ORIGINAL="$(echo "$METADATA_PDF" | sed -n 's/ModifyDate: //p')"
SUBJECT_ORIGINAL="$(echo "$METADATA_PDF" | sed -n 's/Subject: //p')"
PUBLISHER_ORIGINAL="$(echo "$METADATA_PDF" | sed -n 's/Producer: //p')"
KEYWORDS_ORIGINAL="$(echo "$METADATA_PDF" | sed -n 's/Keywords: //p')"
}

Expand All @@ -524,9 +529,9 @@ write_metadata(){
echo "#Writing new metadata"
exiftool -e -overwrite_original -password "$PASSWORD" -sep ";" \
-PDF:Title="$TITLE" -PDF:Author="$AUTHOR" \
-PDF:Subject="$SUBJECT" -PDF:Keywords="$KEYWORDS" \
-PDF:Subject="$SUBJECT" -PDF:Producer="$PUBLISHER" -PDF:Keywords="$KEYWORDS" \
-PDF:ModifyDate="$MODIFYDATE" -PDF:CreateDate="$CREATEDATE" \
-XMP-dc:Subject="$KEYWORDS" -XMP-dc:Description="$SUBJECT" -XMP-dc:Title="$TITLE" \
-XMP-dc:Subject="$KEYWORDS" -XMP-dc:Publisher="$PUBLISHER" -XMP-dc:Description="$SUBJECT" -XMP-dc:Title="$TITLE" \
-XMP-dc:Creator="$AUTHOR" -XMP-dc:Date="$CREATEDATE" \
"$FILE"
echo "$?" > "$ERRORPIPE1"
Expand All @@ -547,6 +552,7 @@ print_updated_metadata() {
echo "Creation date: $CREATEDATE"
echo "Modificaiton date: $MODIFYDATE"
echo "Subject: $SUBJECT"
echo "Publisher: $PUBLISHER"
echo "Keywords: $KEYWORDS"
}

Expand Down
2 changes: 1 addition & 1 deletion uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ echo "Uninstalling $Application ..."
[[ -f "$LauncherPath/pdfmted-inspector.desktop" ]] && sudo rm -v "$LauncherPath/pdfmted-inspector.desktop"
[[ -f "$IconPath/pdfmted.svg" ]] && sudo rm -v "$IconPath/pdfmted.svg"

echo "Done."
echo "Done."