Posts tagged with “terminal”

Small improvements in Otto

Up until now, Otto could either geotag photos by city or geocorrelate them using GPX files. The latest version introduces a new -l option that allows you to geotag photos using the provided geographical coordinates and altitude. It looks something like this:

otto -d "/path/to/source/dir" -l "48.355,11.773,494"

Another new -r option can be used to transfer only RAW files as follows:

otto -d "/path/to/source/dir" -r NEF

Speaking of RAW files, Otto now uses the exiv2 tool to write EXIF metadata (copyright, author, description, etc.) to RAW files — something that wasn't possible before.

Instead of rsync, Otto now uses wget to fetch notes. This means that you no longer need to have rsync installed on the machine hosting notes, and you don't have to deal with login credentials.

And that's about it. As always, you'll find the latest version of Otto on GitHub.

Get your exact position with a Bash one-liner

Need to get the geographical coordinates of your current position? On a Debian and Linux Mint, install the geoclue-2-demo package using the sudo apt install geoclue-2-demo command, then run the following one-liner:

/usr/libexec/geoclue-2.0/demos/where-am-i | grep -e 'Latitude' -e 'Longitude' | tail -n 2

If you need the latitude and longitude values only, use this one-liner instead:

/usr/libexec/geoclue-2.0/demos/where-am-i | \
grep -e 'Latitude' -e 'Longitude' | tr -d ' ' | \
cut -d':' -f2 | tr -d ° | tail -n 2

Otto now supports backups by date and EXIF stats

Ideally when you travel, you'd want to use a fresh card with your camera each day. This way, if you lose the card, or the data on it becomes corrupted, the damage would be limited to a single day. This strategy might not be feasible for longer travels (if you travel for a month and you use two cameras, you'd need 60 storage cards), but it can be practical for shorter trips.

Otto can now handle this particular scenario. Specify the -i parameter, and the script creates a directory with the current date as its name (for example, 2023-05-01) and backs up the content there. The script is clever enough to distinguish between cards coming from different cameras, thus keeping things tidy while avoiding inadvertently overwriting data coming from multiple sources. Here is how it works. Say, you use a Nikon D800, and you use the following command to back up data:

otto -i -d "/media/$USER/NIKON D800/DCIM/101ND800"

This command creates the 101ND800 directory first, followed by a subdirectory with the current name as its name. The data from the specified source is then backed up to the 101ND800/2023-05-01 subdirectory.

In addition to transferring and organizing JPEG and RAW files, Otto can now generate statistics by analyzing the EXIF metadata of files in a given directory. Say, you want to know what lenses you use most. Run the command below, and Otto generates a CSV-formatted text file containing all lenses used to take photos in the given directory along with the count for each lens.

otto -d "/path/to/dir/with/photos/" -s LensID

Want to know what focal length you use (most)? Here's the command to use:

otto -d "/path/to/dir/with/photos/" -s FocalLength

How about camera models? There's a command for that, too:

otto -d "/path/to/dir/with/photos/" -s Model

Each of these commands generates a .csv file that uses the EXIF tag as its name (LensID.csv, FocalLength.csv, Model.csv, etc) in your home directory. You can then import the file into a spreadsheet application like LibreOffice Calc and generate a graph. Or you can use web tools like cvs-graph to create a pie chart using the generated CSV file.

You'll find Otto in its own GitHub repository.

For all things photography and Linux, read the Linux Photography book.

Check battery health on Linux

Nothing lasts forever, including laptop batteries. But how do you know when your laptop's battery is ripe for a replacement? Easy: install the acpi package (sudo apt install acpi on Ubuntu and Linux Mint), run the acpi -V command, and check the line that looks something like this:

Battery 0:  design capacity 4867 mAh, last full capacity 4584 mAh = 94%

In this case, the battery is at 94% of its designed capacity, so there is no cause for concern. If the value is nearing 50%, you should probably start saving for a new battery.

Since it makes sense to run battery checks regularly, you can create an alias for that. Open the .bashrc file for editing using the nano ~/.bashrc command and add the following alias:

alias chkbat="acpi -V | grep Battery"

Save the changes, reopen the terminal, and run the chkbat command.