Skip to content

Instantly share code, notes, and snippets.

@stringhamc
stringhamc / rename-jpg.py
Created September 3, 2018 01:52
Wrote a quick hack to rename images to the datetime string used in Android 8.1 based on EXIF data. This way I can easily merge pictures from my phone and my wife's iPhone.
#!/usr/bin/env python
"""Wrote a quick hack to rename images to the datetime string used in
Android 8.1 based on EXIF data. This way I can easily merge pictures from my
phone and my wife's iPhone.
Copyright 2018 Craig Stringham
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
import os
import subprocess
import select
from termcolor import colored, cprint
import time
# from http://stackoverflow.com/questions/7729336/how-can-i-print-and-display-subprocess-stdout-and-stderr-output-without-distorti
def make_async(fd):
'''Helper function to add the O_NONBLOCK flag to a file descriptor'''