Date: Thu, 28 Mar 2024 09:02:50 -0400 (EDT) Message-ID: <1802498199.2737.1711630970479@3844c1e05b81> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2736_919391501.1711630970478" ------=_Part_2736_919391501.1711630970478 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Picking up where you left off
If you have already completed the installation steps below and are just = trying to run the importer, follow the steps below. Otherwise skip ahead to= "What You'll Need" and proceed from there.
Change to the directory where you created your virutalenv. If you're= having a hard time remembering where this was, use the command:
find . = -type d -name venv
to locate the virtualenv directory. You can copy/paste that path a= nd use the command:
cd PATH= /TO/VENV cd ..
to change to the right directory.
Activate the virtualenv using the following command:
source = venv/bin/activate
If this worked your prompt should be prefixed with "(venv)", like:=
(venv) = sam@multivac:~$
Get a up to date cookie from EditThisCookie (Step 2 below).
Change into the mandala-bii directory:
cd mand= ala-bii
You should now be ready to run the importer!
First:
Then:
Also:
If you're completely new to using python or the command line, these inst= ructions assume you're working on MacOS.
Final result: A password
This will let the importer access your account. It can't do this if you'= re exclusively using NetBadge.
Save for later:
The password you created.
Final result: A KEY and VALUE
Save for later:
The KEY and VALUE you got in step 5.
Final result: python, pip, and brew installed= on your computer
These instructions assume you've never worked with the MacOS Terminal ap= p, or any Unix-based system, or any command line interface.
Terminal is a command line interface for your Mac. Inst= ead of clicking on buttons to accomplish what you need, you'll send small s= nippits of texts instructions to your computer. You'll need to learn the ba= sics of using this interface to run the importer. (Don't worry, if you just= copy and paste commands from this document, you should probably be fine...= )
You should see the terminal now. It will look something like this: =
Last lo= gin: Wed Feb 6 08:11:10 on ttys000 Veronicas-MacBook-Pro:~ veronicakuhn$
Copy and paste the following code into the terminal, then press = Return.
/usr/bi= n/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/= master/install)"
The terminal may ask you to hit Return again = to confirm the installation, then will request your Mac password. Enter it,= then hit Return one last time.
First, we'll check if you already have the right version of Python. Copy=
and paste the following code into the terminal, then press Re=
turn.
python = --version
If the terminal says you're using python 3 or higher, you can skip to th= e next section.
brew in= stall python
if that doesn't work, try:
brew re= install python
(You can do this because you installed homebrew in the previous step. Wo= ohoo.)
The command to install python should have already installed pip, but let= 's make sure. Copy and paste the following code into the terminal, the= n press Return.
pip --v= ersion
You should see the version of pip that's been installed.
Final result: These packages installed onto your comput= er
Run the following :
pip ins= tall virtualenv
Run the following:
brew in= stall imagemagick
Run the following:
brew in= stall dcraw
Run the following:
brew in= stall exiftool
Then:
pip ins= tall pyexifinfo
Using the Terminal, you can create and move into 'directories'. This is = just creating and moving into folders on your computer using the command li= ne. For simplicity's sake, we're going to create a folder directly in your = documents called bhutan-import.
First, navigate into your Documents folder by running the following comm= and in the Terminal:
cd Docu= ments
Now make your new directory, bhutan-import, by running:=
mkdir b= hutan-import
Now navigate into the new directory:
cd bhut= an-import
If you open up Finder, you'll see there's a folder called 'bhutan-import= ' in your Documents.
Run this code to clone the importation code into bhutan-import.
git clo= ne https://github.com/samchrisinger/mandala-bii.git
A folder called mandala-bii will show up in bhu= tan-import once the code is cloned.
If your images have embedded metadata generated with Adobe Bridge, skip =
to the next step (7). If the images were managed using Mediap Pro, contact =
Veronica Kuhn, who will link you to an .xml file from Box. Download the fil=
e.
Put the downloaded file inside the mandala-bii folder that you created in the previous step. You can use the good ol' click=
and drag method, no need to use the Terminal!
Make sure to move the file
That .xml file really needs to be inside the mandala-bii folder, otherwi= se your importation command won't work!
Save for later:
The name of the xml file you downloaded.
Back in the Terminal, run:
virtual= env venv -p `which python3`
Then run:
source = venv/bin/activate
If you've done this correctly, you should see (VENV NAME) at the beginning of the bash prompt.
Enter the mandala-bii directory by running the following:
cd mand= ala-bii
Then run:
pip ins= tall -r requirements.txt
In Mandala, create a collection or subcollection to house the images you= 're importing. As you do this, check the URL in the collections editor. Thi= s lets you find the collection id, which you'll need to direct the import t= o that collection. For example, for the Chuma Laptse collection, I can go into the editor and see t= he URL is https://images.shanti.virginia.edu/no= de/1419391/edit, so the collection id is 14193= 91.
Save for later:
The collection id.
Use the following code, with some substitutions:
python = import.py -s Encoded -c KEY=3DVALUE -i "/IMAGE/FILE/PATH" -u https://images= .shanti.virginia.edu/admin/content/bulk_image_import/api -v -cid COLLECTION= _ID -cv -cw ImageMagick --ftp --ftp_user YOUR_BOX_USER --ftp_pass YOUR_BOX_= PASS
Use the following code, with some substitutions:
python = import.py -s MediaPro -x "XML_FILE_NAME.xml" -c KEY=3DVALUE -i "/IMAGE/FILE= /PATH" -u https://images.shanti.virginia.edu/admin/content/bulk_image_impor= t/api -v -cid COLLECTION_ID -cv -cw ImageMagick --ftp --ftp_user YOUR_BOX_U= SER --ftp_pass YOUR_BOX_PASS
Don't worry if you get a stream of messages along the following li= nes at first:
File LH= _KHOMA_2013_11_21_WALL_PAINTING_IN_BERPA_KHOMA_KHARPHU_LHAKHANG12697.JPG sk= ipped because it has already been imported.
But if the run finishes without ever changing, that's a problem. = p>
You can ignore any other messages as long as the importation is still ru= nning. Any imported images should be immediately visible at your collection= on Mandala.
Sometimes an image is imported incorrectly during importation. This can = occur because of an issue with converting the image, or for other reasons. = The importer script provides a way to selectively re-upload or "repair" an = already imported image. Use the steps below to do so:
Get a list of the images you want to repair- you will need a CSV file wi= th an entry containing the node id, task id, and filename for all of the im= ages. The easiest way to get this list for a catalog is to:
Log in to Acquia Cloud and visit the detail page for the Prod environmen= t (https://cloud.acquia.com/a= pp/develop/applications/14584a7f-64a0-4816-ad7f-b1d9a6da429a/environments/2= 3134-14584a7f-64a0-4816-ad7f-b1d9a6da429a)
Copy the "SSH URL" to your clipboard, and from = a terminal run:
ssh&nbs= p;SSH URL
replacing SSH URL with your clipboard content= s.
Run:
cd /var= /www/html/shanti.prod/docroot/sites/images/
You are about to run some commands in MySQL. Please proceed= with caution. Updates and deletes are committed to the Produ= ction database immediately.
To find your catalog name run:
drush s= qlq "select distinct(catalog) from bulk_image_import_task;"
Then run:
drush s= qlq "select node_id, tid, filename from bulk_image_import_task where catalo= g =3D 'YOUR CATALOG NAME';" > /home/shanti/import.tsv
Enter CTRL-d to exit the SSH session
To copy the file down locally, run:
scp sha= nti.prod@ded-18858.prod.hosting.acquia.com:/home/shanti/import.tsv ~/Downlo= ads/import.tsv
Then run:
cat ~/D= ownloads/import.tsv | tr "\\t" "," > ~/Downloads/import.csv
You now have a file (import.csv) that contains a list of node id, task i= ds, and filenames for each entry in your catalog. You can now run the impor= ter's repair script:
python = import.py -s Repair --csv "import.csv" -c COOKIE=3DVAL -i "PATH TO IMAGES F= OLDER" -u https://images.shanti.virginia.edu/admin/content/bulk_image_impor= t/api -v --ftp --ftp_user YOUR USERNAME --ftp_pass 'XXXXXX' -cv -cw ImageMa= gick