Commit 6a8b2b3a authored by Félix Hartmann's avatar Félix Hartmann
Browse files

When images are loaded, they are now sorted according to their

timestamp (if there is any, and if the option has been chosen).
parent 134bef39
......@@ -4843,38 +4843,37 @@ class Interekt:
reset_graph_data()
# Loading image names
files_to_process = [f.encode(sys.getfilesystemencoding())
for f in files]
# ENCODING DUMMY
files_to_process = [f.encode(sys.getfilesystemencoding()) for f in files]
if self.get_photo_datetime.get():
# Try to sort the photos according to their date
try:
files_to_process = sorted(files_to_process,
key=h5store.get_photo_time)
time_sorted = True
except:
time_sorted = False
# Try to sort images with their numbers
files_with_number = []
files_without_number = []
for f in files_to_process:
# Otherwise try to sort the photos according to the number
# in their name
if not self.get_photo_datetime.get() or not time_sorted:
try:
if python2:
number = ''.join(finddigits.findall(f.split('/')[-1]))
files_to_process = sorted(
files_to_process,
key=lambda x: int(
''.join(finddigits.findall(x.split('/')[-1]))))
else:
number = ''.join(finddigits.findall(f.decode().split('/')[-1]))
print(int(number))
files_to_process = sorted(
files_to_process,
key=lambda x: int(
''.join(finddigits.findall(x.decode().split('/')[-1]))))
except:
print("No number in file name")
try:
if python2:
files_to_process = sorted(
files_to_process,
key=lambda x: int(
''.join(finddigits.findall(x.split('/')[-1]))))
else:
files_to_process = sorted(
files_to_process,
key=lambda x: int(
''.join(finddigits.findall(x.decode().split('/')[-1]))))
except:
print("""Pas de tri des photos... car pas de numéros dans le nom """
"""des images!""")
# Boucle sur les fichier image pour les ajouter dans un nouveau fichier HDF
print("""The images have not been sorted, because no """
"""number was found in their names.""")
# Loop over the photo files for adding them to a new HDF file
Nimgs = len(files_to_process)
for i, f in enumerate(files_to_process):
# On affiche l'état d'avancement
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment