Filed under: Photography, SmartPhones & PDAs, Technology
I’ve been backing up my iPhone photos to my Windows 10 desktop using Microsoft’s OneDrive. The photos are on my local drive as well as the cloud. The downside is that all the photos, movies, and screen shots are dumped into a single directory, and there are a lot of them.
I prefer to have them sorted by date into directories. A directory for each year, with sub-directories for each month. I could do this by hand, but that’s a pain, and I have to remember to do it on a regular basis. Plus I’ll probably want to do the same for my wife’s iPhone photos. So I decided to write a python script to scan the camera roll directory, and copy the files to a directory in my photo archive section. The scrip will create directories if needed and skip files that are already in place.
That part was pretty straight forward. I used os.chdir() to get to source directory and os.listdir() to get the directory contents. Don’t want to create month directories for directories, just files, so I used os.path.isfile() to filter out non-files, and then check the file extension. I only want jpg, mov, png, and tiff files. I use Camera+ most of the time, which produces tiff files instead of jpg files. The png files are screenshots.
I used os.stat() to get the create time, and found files I exported to the camera roll from Camera plus had a create time of when they were exported, not the time the photo was taken. (Once I started having Camera+ dump straight to the camera roll, I didn’t have this problem).
So, I dug a little deeper and found I could get an image created time stamp with a getImageDate() call. Downside was this didn’t work for png, tiff, or mov files. So I had to do some extra sorting, and wrote another function to use on just the jpg files. I called the open() function from the Image library, and extracted the exif data using the _getexif() function. This works most of the time, so when it fails I had it return a ‘?’ rather than the time stamp string. Seeing that caused a fall back to the getImageDate() function.
This extra call to the Image library made the placement of the files more accurate. I had the base time function return the month as a three character string and the year as a 4 characters string. This required some basic string manipulation. Those two parameters were added to predetermined destination and passed to a function I had written for another project that checks if directory exits, and creates it if it does not.
Next was to have the program check to see if the file already existed in the correct destination directory. If it did, don’t bother copying it again. This will make the incremental runs faster and save on unneeded file transfers.
Now I have a functional script that I can set up to automatically run once a week. Once the files are archived off OneDrive, I can removed them there and on the iPhone is order to free up space.
Originally posted to Urbin Technology. I put the source code for the time stamp functions there.
One of my sons got a Saint Bernard, so I had to get a keg for the beast.
The son in question is a Helicopter pilot, the sticker was his idea.
Filed under: Photography, Science Fiction, Star Trek, Sunday SciFi
This is the same image I have loaded on flicker, just punched it up a bit.
A statue of George Washington in the National Museum of American History. Done in the classic Greek style, it’s tending toward the ‘deification’ that Washington was never comfortable with.
It’s been kinda content light here the past couple of weeks, but things have been a bit busy.
For one of those reasons, I’d like to give a shout out to the really top notch team as the Foster Hospital for Small Animals, which is part of the Tufts Cummings School of Veterinary Medicine.
They did some really amazing work with one of my Golden Retrievers.
Speaking of small animals, the cat is actually in the bag…
An actual Film Camera spotted in the wild! The person with the camera was taking a photography class, and some of her assignments required an actual film camera to be used.
One of the stone lions outside the Sigma Alpha Epsilon headquarters in Evanston, IL.
Filed under: Free Speech, Photography, Politics, Tea Party, The Peoples Commonweath
There was a small Tea Party Protest at Lincoln Square in Worcester, MA on September 3, 2009.
This was a warm up for three bus loads of Patriots from the Commonwealth going to Washington, D.C. this week for the 9/12 protests.
I’m also trying to get them posted at PJTV.
A pair of U.S. Army boots.