JPG photo filenames after an iPhone to "Photos app" import Since years, we centralize all our family photos on a (local) disk readable from Windows, Linux and Mac OS X. The filenames are usually something like D:\Photos\2020-05\IMG_76843.jpg or D:\Photos\2020-05\20200502_1256_2.jpg, when coming from various digital cameras or Android smartphones. 

Now I have an iPhone, and I imported nearly 10 GB of photos with the Macbook "Photos" app. I don't want to keep them inside this app, my final goal is to manage the JPG files myself, and move them on the external disk (mentioned above). So I took all files from ~/Pictures/Photos Library.photoslibrary/Masters/ and moved them to the external disk. 
(or ~/Pictures/Photos Library.photoslibrary/originals/ with Catalina). This worked. 
After that I deleted Photos Library.photoslibrary (no longer needed, I will recreate a new photo library when importing next time; again, I don't want to use Photos app except for importing from the iPhone).

Question: I now have files like:

DE017ACB-5ABD-4113-B110-95DABF7F28F7.jpeg
DE017ACB-5ABD-4113-B110-95DABF7F28F7_1_105_c.jpeg
DE017ACB-5ABD-4113-B110-95DABF7F28F7_4_5005_c.jpeg


and there are two problems:


they are duplicates of different sizes (this is probably simple, I can do a script to remove the smaller files *_1_105_c.jpgand keep the original big file only)
the files are in  a totally random order! 


Before I roll my own Python script (examining EXIF and recreate "new filenames" according to the datetime of the photo), are there tricks/things to know/techniques to recover better photo filenames from these random-looking filenames: DE017ACB-5ABD-4113-B110-95DABF7F28F7.jpeg?

More generally, is it possible to have less a mess with JPG filenames when importing photos from an iPhone?

Sidenotes: 


I do automated backups, both locally and distant
we don't want to use a cloud solution to manage photos, and also not a cataloguing software (like Lightroom or similar)
Reason for this "I want to handle photo files myself": with this "plain JPG files in folders" method, photos can be read on every device (Win, Linux, Mac, etc.) without requiring a specific software that would probably be unmaintained/unavailable in year 2079, when my children will want to open them ;)
"Just JPG files in a folder" is probably the method that maximizes the chance of being opened in 50 or 100 years.
for my next import from iPhone, is there another software than "Photos" app that directly sets better filenames when importing? This seems to show that "Image Capture" would work better in my case: How do I import photos in OS X without using Photos.app?
For future iPhone -> computer imports

Using "Image Capture" app instead of "Photos" app solves most of the problems indeed (as explained here: How do I import photos in OS X without using Photos.app?).  Notes:


Set "Keep originals" to disabled in order to have HEIC files automatically converted to JPG during import (I'm not sure if my children's computers will be able to understand HEIC files easily in 70 years, but surely JPG will be supported!)
"Delete after import" is important.   
At the end of the import, I had "Error 9937" for a few MOV files. Then redo the export for these files with "Keep originals" enabled. 


For an export already done with random filenames

1) First run a script that groups variations of the same photo, such as:

DE017ACB-5ABD-4113-B110-95DABF7F28F7.jpeg
DE017ACB-5ABD-4113-B110-95DABF7F28F7_1_105_c.jpeg
DE017ACB-5ABD-4113-B110-95DABF7F28F7_4_5005_c.jpeg


This can be done easily with Python with:

import glob, os
H = dict()
for f in glob.glob('*.jpeg'):
    h = f[:36]  
    H.setdefault(h, []).append(f)


Then for each group, you can keep the file with the shortest filename (e.g. DE017ACB-5ABD-4113-B110-95DABF7F28F7.jpeg) and delete the others (with os.remove(...)).

2) Run a Python script that transforms a random filename DE017ACB-5ABD-4113-B110-95DABF7F28F7.jpeg to 20200502_120003.jpg based on the datetime stored in the EXIF metadadata

import glob, os, PIL.Image, datetime

for f in glob.glob('*.jpeg'):
    with PIL.Image.open(f) as img:
        exif_data = img._getexif()
    if exif_data == None:
        # do something here
        continue
    model, software, dt = exif_data.get(272, ''), exif_data.get(305, ''), exif_data.get(306, '')
    newfname = datetime.datetime.strptime(dt, '%Y:%m:%d %H:%M:%S').strftime('%Y%m%d_%H%M%S') + '.jpg' if dt != '' else f
    # rename the file with the new filename
    # and also move it in a specific folder according to model/software
    # special case to handle: filename collisions