Uploading photos to archive.org with titles from filenames

Travel books, nomad research and archive.org related scripts
Santeri
Posts: 315
Joined: 2017-7-5 09:58

Unread post by Santeri » 2024-1-12 20:24

By default, when you add photos to archive.org, they do not have any titles. One solution would be to use titles embedded in image files, and add those to archive.org titles when items are uploaded. However, archive.org is not currently doing that.

I prefer having titles in filenames as I use the same system with our public photo albums. Here is a small shell command using ai command tool to grab titles from filenames and add them arhive.org metadata. You need to install python and the ia tool first.

Here is the command:

Code: Select all

ia search -i 'collection:<TYPE YOUR COLLECTION ID HERE>' 'mediatype:image' | \
while read identifier
do
  ia list $identifier --format=JPEG | \
  while read filename
  do
    title=${filename%.*}
    ia metadata $identifier --target="files/$filename" --modify="title:$title"
  done
done
Replace <TYPE YOUR COLLECTION ID HERE> with your collection ID before running the command.
Uploading photos to archive.org with titles from filenames If you don't have a collection, you can limit the item set by adding creator or uploader (the email address you use for logging in) to the first ia search command like this:

Code: Select all

ia search -i 'mediatype:image' 'creator:Santeri Kannisto'  | \

Code: Select all

ia search -i 'mediatype:image' 'uploader:<TYPE YOUR LOGIN EMAIL ADDRESS HERE>'  | \
Let me know if you need help or more scripts, I am happy to help.

Happy archiving,

Santeri