First:
Then:
Also:
If you're completely new to using python or the command line, these instructions 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.
Keep this password somewhere safe. You'll need it when you start the import.
Final result: A KEY and VALUE
Keep your KEY and VALUE somewhere safe. You'll need them when you start the import.
Final result: python, pip, and brew installed on your computer
These instructions assume you've never worked with the MacOS Terminal app, or any Unix-based system, or any command line interface.
Terminal is a command line interface for your Mac. Instead of clicking on buttons to accomplish what you need, you'll send small snippits of texts instructions to your computer. You'll need to learn the basics 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 login: 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/bin/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 Return.
python --version |
If the terminal says you're using python 3 or higher, you can skip to the next section. |
brew install python |
if that doesn't work, try:
brew reinstall python |
(You can do this because you installed homebrew in the previous step. Woohoo.)
The command to install python should have already installed pip, but let's make sure. Copy and paste the following code into the terminal, then press Return.
pip --version |
You should see the version of pip that's been installed.
Final result: These packages installed onto your computer
Run the following :
pip install virtualenv |
Run the following:
brew install imagemagick |
Run the following:
brew install dcraw |
Run the following:
brew install exiftool |
Then:
pip install 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 line. 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 command in the Terminal:
cd Documents |
Now make your new directory, bhutan-import, by running:
mkdir bhutan-import |
Now navigate into the new directory:
cd bhutan-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 clone https://github.com/samchrisinger/mandala-bii.git |
A folder called mandala-bii will show up in bhutan-import once the code is cloned.
Contact Sam Chrisinger, who will link you to an .xml file from Box. Download the file.
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!
That .xml file really needs to be inside the mandala-bii folder, otherwise your importation command won't work! |
Save the file name for later.
Back in the Terminal, run:
virtualenv 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 mandala-bii |
Then run:
pip install -r requirements.txt |
Use the following code, with some substitutions:
python import.py -s MediaPro -x "XML_FILE_NAME.xml" -c KEY=VALUE -i "/Image Uploads/Bhutan/Bhutan Year X/XML_FILE_NAME" -u https://images.shanti.virginia.edu/admin/content/bulk_image_import/api -v -cid 619101 -cv -cw ImageMagick --ftp --ftp_user YOUR_BOX_USER --ftp_pass YOUR_BOX_PASS |
Don't worry if you get a stream of messages along the following lines at first:
File LH_KHOMA_2013_11_21_WALL_PAINTING_IN_BERPA_KHOMA_KHARPHU_LHAKHANG12697.JPG skipped because it has already been imported. |
But if the run finishes without ever changing, that's a problem.
You can ignore any other messages as long as the importation is still running. Any imported images should be immediately visible at https://images.shanti.virginia.edu/collection/oral-cultures-bhutan.