Skip to content

Instantly share code, notes, and snippets.

@gingerbeardman
Created December 26, 2020 22:08
Show Gist options
  • Save gingerbeardman/0d665dff0d400af913ced679810544bd to your computer and use it in GitHub Desktop.
Save gingerbeardman/0d665dff0d400af913ced679810544bd to your computer and use it in GitHub Desktop.
ia upload script for EPOCH toy instruction manuals
echo "identifier,file,description,subject,title,creator,mediatype,language" > epoch.csv
for file in *.pdf
do
# echo "Processing: $file"
id=`echo $file | awk '{print substr($0,1,5);exit}'`
en=`cat en.txt | grep $id`
trimmed_en=`echo "${en:8}"`
ja=`cat ja.txt | grep $id`
trimmed_ja=`echo "${ja:7}"`
prefix="epoch-manual-"
identifier=`echo "${trimmed_en//[()!\':+]/}"`
identifier=`echo "${identifier//&/and}"`
identifier=`echo "${identifier//\./ }"`
identifier=`echo "${identifier// - / }"`
identifier=`echo "$prefix${identifier//[ ・]/-}"`
identifier=`echo $identifier | tr '[:upper:]' '[:lower:]'`
echo "$identifier"
mediatype="texts"
title="$trimmed_en"
description="Instruction Manual for:<br><br>$trimmed_en<br>$trimmed_ja"
subject="epoch;toy;manual;instructions"
creator="EPOCH"
echo "$identifier,./$file,$description,$subject,$title,$creator,$mediatype,jpn" >> epoch.csv
done
@gingerbeardman
Copy link
Author

Expects PDFs to be stored locally, with titles in two files ja.txt and en.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment