Howdy,
I'm writing a little script that uploads the most recent photo to a cloud service, grabs, the direct URL, then throws that through bitly. I can't seem to figure out how to get the filename, so I'm setting it manually via console.alert, and I'm a little confused on what the file extension should be.
For example, in photos.get_metadata(-1) from a screenshot, I see a dictionary key {PNG} (not sure if backticks make code blocks on this forum...), which is correct, so I set the file extension to png. However, for photos taken with the camera, photos.get_metadata(-1) returns a few keys, including exif data, and a {TIFF} key.
However, I'm pretty sure that those are .jpg and not .tiff files... so is there any way I can detect what the proper file extension is for each file? I tried looking into the mimetypes module, but it looks like you need a file read to use that, and unfortunately I'm achieving that with photos.save to a StringIO... and I think the photos.save requires an extension (http://omz-software.com/pythonista/docs/ios/Image.html).
Also, I don't see any pattern that resembles the filenames that photos have when imported through iPhoto or what have you (IMG_XXXX.jpg). Is there any way to find what a photo's filename is?
Something that could retrieve the path to the file would accomplish both of these, but I'd be surprised if Apple hadn't sandboxed that ability.
Thanks for any help!