Small fix for video timestamps, refactored PhotoaAlbum.py & added reference for xwipe
This commit is contained in:
parent
a648b931bb
commit
f79eda5ec6
@ -201,7 +201,9 @@ class Photo(object):
|
|||||||
value = value[0]
|
value = value[0]
|
||||||
if isinstance(value, str) or isinstance(value, unicode):
|
if isinstance(value, str) or isinstance(value, unicode):
|
||||||
value = value.strip().partition("\x00")[0]
|
value = value.strip().partition("\x00")[0]
|
||||||
if (isinstance(decoded, str) or isinstance(decoded, unicode)) and decoded.startswith("DateTime"):
|
if ((isinstance(decoded, str) or
|
||||||
|
isinstance(decoded, unicode)) and
|
||||||
|
decoded.startswith("DateTime")):
|
||||||
try:
|
try:
|
||||||
value = datetime.strptime(value, '%Y:%m:%d %H:%M:%S')
|
value = datetime.strptime(value, '%Y:%m:%d %H:%M:%S')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@ -210,15 +212,17 @@ class Photo(object):
|
|||||||
continue
|
continue
|
||||||
exif[decoded] = value
|
exif[decoded] = value
|
||||||
|
|
||||||
|
_pm = self._photo_metadata
|
||||||
|
|
||||||
if "Orientation" in exif:
|
if "Orientation" in exif:
|
||||||
self._orientation = exif["Orientation"]
|
self._orientation = exif["Orientation"]
|
||||||
if self._orientation in range(5, 9):
|
if self._orientation in range(5, 9):
|
||||||
self._attributes["size"] = (
|
self._attributes["size"] = (
|
||||||
self._attributes["size"][1], self._attributes["size"][0])
|
self._attributes["size"][1], self._attributes["size"][0])
|
||||||
if self._orientation - 1 < len(
|
if self._orientation - 1 < len(
|
||||||
self._photo_metadata.orientation_list):
|
_pm.orientation_list):
|
||||||
self._attributes["orientation"] = (
|
self._attributes["orientation"] = (
|
||||||
self._photo_metadata.orientation_list[
|
_pm.orientation_list[
|
||||||
self._orientation - 1])
|
self._orientation - 1])
|
||||||
if "Make" in exif:
|
if "Make" in exif:
|
||||||
self._attributes["make"] = exif["Make"]
|
self._attributes["make"] = exif["Make"]
|
||||||
@ -238,46 +242,63 @@ class Photo(object):
|
|||||||
self._attributes["iso"] = exif["PhotographicSensitivity"]
|
self._attributes["iso"] = exif["PhotographicSensitivity"]
|
||||||
if "ExposureTime" in exif:
|
if "ExposureTime" in exif:
|
||||||
self._attributes["exposureTime"] = exif["ExposureTime"]
|
self._attributes["exposureTime"] = exif["ExposureTime"]
|
||||||
if "Flash" in exif and exif["Flash"] in self._photo_metadata.flash_dictionary:
|
if exif.get("Flash") in _pm.flash_dictionary:
|
||||||
try:
|
try:
|
||||||
self._attributes["flash"] = self._photo_metadata.flash_dictionary[exif["Flash"]]
|
self._attributes["flash"] = _pm.flash_dictionary[exif["Flash"]]
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if "LightSource" in exif and exif["LightSource"] in self._photo_metadata.light_source_dictionary:
|
if exif.get("LightSource") in _pm.light_source_dictionary:
|
||||||
try:
|
try:
|
||||||
self._attributes["lightSource"] = self._photo_metadata.light_source_dictionary[exif["LightSource"]]
|
self._attributes["lightSource"] = _pm.light_source_dictionary[
|
||||||
|
exif["LightSource"]]
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if "ExposureProgram" in exif and exif["ExposureProgram"] < len(self._photo_metadata.exposure_list):
|
if "ExposureProgram" in exif and exif["ExposureProgram"] < len(
|
||||||
self._attributes["exposureProgram"] = self._photo_metadata.exposure_list[exif["ExposureProgram"]]
|
_pm.exposure_list):
|
||||||
|
self._attributes["exposureProgram"] = _pm.exposure_list[
|
||||||
|
exif["ExposureProgram"]]
|
||||||
if "SpectralSensitivity" in exif:
|
if "SpectralSensitivity" in exif:
|
||||||
self._attributes["spectralSensitivity"] = exif["SpectralSensitivity"]
|
self._attributes["spectralSensitivity"] = exif[
|
||||||
if "MeteringMode" in exif and exif["MeteringMode"] < len(self._photo_metadata.metering_list):
|
"SpectralSensitivity"]
|
||||||
self._attributes["meteringMode"] = self._photo_metadata.metering_list[exif["MeteringMode"]]
|
if "MeteringMode" in exif and exif["MeteringMode"] < len(
|
||||||
if "SensingMethod" in exif and exif["SensingMethod"] < len(self._photo_metadata.sensing_method_list):
|
_pm.metering_list):
|
||||||
self._attributes["sensingMethod"] = self._photo_metadata.sensing_method_list[exif["SensingMethod"]]
|
self._attributes["meteringMode"] = _pm.metering_list[
|
||||||
if "SceneCaptureType" in exif and exif["SceneCaptureType"] < len(self._photo_metadata.scene_capture_type_list):
|
exif["MeteringMode"]]
|
||||||
self._attributes["sceneCaptureType"] = self._photo_metadata.scene_capture_type_list[exif["SceneCaptureType"]]
|
if "SensingMethod" in exif and exif["SensingMethod"] < len(
|
||||||
if "SubjectDistanceRange" in exif and exif["SubjectDistanceRange"] < len(self._photo_metadata.subject_distance_range_list):
|
_pm.sensing_method_list):
|
||||||
self._attributes["subjectDistanceRange"] = self._photo_metadata.subject_distance_range_list[exif["SubjectDistanceRange"]]
|
self._attributes["sensingMethod"] = _pm.sensing_method_list[
|
||||||
|
exif["SensingMethod"]]
|
||||||
|
if "SceneCaptureType" in exif and exif["SceneCaptureType"] < len(
|
||||||
|
_pm.scene_capture_type_list):
|
||||||
|
self._attributes["sceneCaptureType"] = _pm.scene_capture_type_list[
|
||||||
|
exif["SceneCaptureType"]]
|
||||||
|
if "SubjectDistanceRange" in exif and exif[
|
||||||
|
"SubjectDistanceRange"] < len(_pm.subject_distance_range_list):
|
||||||
|
self._attributes[
|
||||||
|
"subjectDistanceRange"] = _pm.subject_distance_range_list[
|
||||||
|
exif["SubjectDistanceRange"]]
|
||||||
if "ExposureCompensation" in exif:
|
if "ExposureCompensation" in exif:
|
||||||
self._attributes["exposureCompensation"] = exif["ExposureCompensation"]
|
self._attributes["exposureCompensation"] = exif[
|
||||||
|
"ExposureCompensation"]
|
||||||
if "ExposureBiasValue" in exif:
|
if "ExposureBiasValue" in exif:
|
||||||
self._attributes["exposureCompensation"] = exif["ExposureBiasValue"]
|
self._attributes["exposureCompensation"] = exif[
|
||||||
|
"ExposureBiasValue"]
|
||||||
if "DateTimeOriginal" in exif:
|
if "DateTimeOriginal" in exif:
|
||||||
try:
|
try:
|
||||||
self._attributes["dateTimeOriginal"] = datetime.strptime(exif["DateTimeOriginal"], '%Y:%m:%d %H:%M:%S')
|
self._attributes["dateTimeOriginal"] = datetime.strptime(
|
||||||
|
exif["DateTimeOriginal"], '%Y:%m:%d %H:%M:%S')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self._attributes["dateTimeOriginal"] = exif["DateTimeOriginal"]
|
self._attributes["dateTimeOriginal"] = exif["DateTimeOriginal"]
|
||||||
if "DateTime" in exif:
|
if "DateTime" in exif:
|
||||||
try:
|
try:
|
||||||
self._attributes["dateTime"] = datetime.strptime(exif["DateTime"], '%Y:%m:%d %H:%M:%S')
|
self._attributes["dateTime"] = datetime.strptime(
|
||||||
|
exif["DateTime"], '%Y:%m:%d %H:%M:%S')
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@ -432,6 +453,13 @@ class Photo(object):
|
|||||||
raise
|
raise
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
self._attributes["dateTimeVideo"] = datetime.strptime(
|
||||||
|
info['format']['tags']['creation_time'],
|
||||||
|
'%Y-%m-%d %H:%M:%S.%fZ')
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
def _photo_thumbnail(self, original_path, thumb_path, size, square=False):
|
def _photo_thumbnail(self, original_path, thumb_path, size, square=False):
|
||||||
try:
|
try:
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/*
|
||||||
|
Xwiper
|
||||||
|
|
||||||
|
Provided by https://github.com/uxitten/xwiper/
|
||||||
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||||
|
Loading…
Reference in New Issue
Block a user