Coding fun - photo sorting using Python
From year 2000 I started to create digitalized photos. After 21 years, there are huge amount of photos and videos and also plenties of backups in different media - CD-RW, DVD+RW, harddisk, RAID, NAS and Cloud storages from different time. Earlier this month I started to use my Google Pixel 3 to backuy those beautiful memories of my family and myself to Google Photo. It is really amazing that managed to get all those photos uploaded and sorted with date and time - with some defects but overcome eventually. Took me almost 2 weeks to finish the work - copying from different medias to phone and then backup.
Cloud backup is good, but from experience I still need other local backup and archive it in another cheaper cloud storage such as AWS S3 Glacier. Googe Photo provide a way to download all pictures. I could just use this but I still want to do it myself since I really cannot affort losing any pictures.
Prior to this recent Google Photo backup, there were many times I tried to sort those pictures. Therefore there are many different backup locations and many duplications such as same file with different file names. I even wrote a small C program to parse/get photo EXIF. It was robust and stable, but still the effort was in vain because I did not manage to find a way to extract video information.
While doing Google Photo backup, I started the idea of writing a Python program to do this. And I managed to create it today ! It took me 2 days on this Taiwan National Day holiday to accomplish it.
The way it work is easy. Extract all photo/video information, create hash based on these information, sort by hash, remove duplications to create a database that all the files are unique. Then perform copy the unique files by creation date.
Original estimation is to finish the implementation yesterday (10/10/2021), and spend one day today (10/11/2021) to clean up the code to create a github project. But while implementating it, there are still some stupid mistakes I made that delayed the work :
Recommended by LinkedIn
But other than these, it is really a good and enjoyable experience doing this Python coding practice. It will take me much more time if I have to program it in C. There are many features I can finish in few lines in Python, but requires a lot of implementations in C. Perhaps C is faster and robust, but it is still much faster to code in Python especially like this kind of project.
So now the work is done. Feeling confidence again on my coding skill. And I'm happy to see my photos and videos are safe and secure. But still after all these efforts, I still keep these un-sorted files in somewhere. Perhaps I will create another tool to identify if there are still missing files that this tool does not copy...