|
@@ -424,14 +424,16 @@ class Item(models.Model):
|
424
|
424
|
for key in self.MODEL_TO_MEDIA_DATA:
|
425
|
425
|
value = data.get(key)
|
426
|
426
|
if key == media.metadata.KEY_GPS: # Split GPS data in lon and lat
|
427
|
|
- if value is not None:
|
428
|
|
- for k in self.MODEL_TO_MEDIA_DATA[key]:
|
429
|
|
- setattr(self, self.MODEL_TO_MEDIA_DATA[key][k], value[k])
|
|
427
|
+ for k in self.MODEL_TO_MEDIA_DATA[key]:
|
|
428
|
+ value_k = value[k] if value is not None else None
|
|
429
|
+ setattr(self, self.MODEL_TO_MEDIA_DATA[key][k], value_k)
|
430
|
430
|
else:
|
431
|
|
- if key == media.metadata.KEY_TIME: # convert time to datetime
|
432
|
|
- if data.get(media.metadata.KEY_TIME_IS_SUBSTITUTION) and self.type == TYPE_IMAGE: # don't use time substitution for images
|
433
|
|
- break
|
434
|
|
- value = datetime.datetime.fromtimestamp(value, tz=datetime.timezone.utc)
|
|
431
|
+ if value is not None:
|
|
432
|
+ if key == media.metadata.KEY_TIME: # convert time to datetime
|
|
433
|
+ if data.get(media.metadata.KEY_TIME_IS_SUBSTITUTION) and self.type == TYPE_IMAGE: # don't use time substitution for images
|
|
434
|
+ value = None
|
|
435
|
+ else:
|
|
436
|
+ value = datetime.datetime.fromtimestamp(value, tz=datetime.timezone.utc)
|
435
|
437
|
setattr(self, self.MODEL_TO_MEDIA_DATA[key], value)
|
436
|
438
|
|
437
|
439
|
def __update_other_file_data__(self, full_path):
|