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]
|
||||
if isinstance(value, str) or isinstance(value, unicode):
|
||||
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:
|
||||
value = datetime.strptime(value, '%Y:%m:%d %H:%M:%S')
|
||||
except KeyboardInterrupt:
|
||||
@ -210,15 +212,17 @@ class Photo(object):
|
||||
continue
|
||||
exif[decoded] = value
|
||||
|
||||
_pm = self._photo_metadata
|
||||
|
||||
if "Orientation" in exif:
|
||||
self._orientation = exif["Orientation"]
|
||||
if self._orientation in range(5, 9):
|
||||
self._attributes["size"] = (
|
||||
self._attributes["size"][1], self._attributes["size"][0])
|
||||
if self._orientation - 1 < len(
|
||||
self._photo_metadata.orientation_list):
|
||||
_pm.orientation_list):
|
||||
self._attributes["orientation"] = (
|
||||
self._photo_metadata.orientation_list[
|
||||
_pm.orientation_list[
|
||||
self._orientation - 1])
|
||||
if "Make" in exif:
|
||||
self._attributes["make"] = exif["Make"]
|
||||
@ -238,46 +242,63 @@ class Photo(object):
|
||||
self._attributes["iso"] = exif["PhotographicSensitivity"]
|
||||
if "ExposureTime" in exif:
|
||||
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:
|
||||
self._attributes["flash"] = self._photo_metadata.flash_dictionary[exif["Flash"]]
|
||||
self._attributes["flash"] = _pm.flash_dictionary[exif["Flash"]]
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
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:
|
||||
self._attributes["lightSource"] = self._photo_metadata.light_source_dictionary[exif["LightSource"]]
|
||||
self._attributes["lightSource"] = _pm.light_source_dictionary[
|
||||
exif["LightSource"]]
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
pass
|
||||
if "ExposureProgram" in exif and exif["ExposureProgram"] < len(self._photo_metadata.exposure_list):
|
||||
self._attributes["exposureProgram"] = self._photo_metadata.exposure_list[exif["ExposureProgram"]]
|
||||
if "ExposureProgram" in exif and exif["ExposureProgram"] < len(
|
||||
_pm.exposure_list):
|
||||
self._attributes["exposureProgram"] = _pm.exposure_list[
|
||||
exif["ExposureProgram"]]
|
||||
if "SpectralSensitivity" in exif:
|
||||
self._attributes["spectralSensitivity"] = exif["SpectralSensitivity"]
|
||||
if "MeteringMode" in exif and exif["MeteringMode"] < len(self._photo_metadata.metering_list):
|
||||
self._attributes["meteringMode"] = self._photo_metadata.metering_list[exif["MeteringMode"]]
|
||||
if "SensingMethod" in exif and exif["SensingMethod"] < len(self._photo_metadata.sensing_method_list):
|
||||
self._attributes["sensingMethod"] = self._photo_metadata.sensing_method_list[exif["SensingMethod"]]
|
||||
if "SceneCaptureType" in exif and exif["SceneCaptureType"] < len(self._photo_metadata.scene_capture_type_list):
|
||||
self._attributes["sceneCaptureType"] = self._photo_metadata.scene_capture_type_list[exif["SceneCaptureType"]]
|
||||
if "SubjectDistanceRange" in exif and exif["SubjectDistanceRange"] < len(self._photo_metadata.subject_distance_range_list):
|
||||
self._attributes["subjectDistanceRange"] = self._photo_metadata.subject_distance_range_list[exif["SubjectDistanceRange"]]
|
||||
self._attributes["spectralSensitivity"] = exif[
|
||||
"SpectralSensitivity"]
|
||||
if "MeteringMode" in exif and exif["MeteringMode"] < len(
|
||||
_pm.metering_list):
|
||||
self._attributes["meteringMode"] = _pm.metering_list[
|
||||
exif["MeteringMode"]]
|
||||
if "SensingMethod" in exif and exif["SensingMethod"] < len(
|
||||
_pm.sensing_method_list):
|
||||
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:
|
||||
self._attributes["exposureCompensation"] = exif["ExposureCompensation"]
|
||||
self._attributes["exposureCompensation"] = exif[
|
||||
"ExposureCompensation"]
|
||||
if "ExposureBiasValue" in exif:
|
||||
self._attributes["exposureCompensation"] = exif["ExposureBiasValue"]
|
||||
self._attributes["exposureCompensation"] = exif[
|
||||
"ExposureBiasValue"]
|
||||
if "DateTimeOriginal" in exif:
|
||||
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:
|
||||
raise
|
||||
except TypeError:
|
||||
self._attributes["dateTimeOriginal"] = exif["DateTimeOriginal"]
|
||||
if "DateTime" in exif:
|
||||
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:
|
||||
raise
|
||||
except TypeError:
|
||||
@ -432,6 +453,13 @@ class Photo(object):
|
||||
raise
|
||||
except TypeError:
|
||||
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):
|
||||
try:
|
||||
|
@ -1,3 +1,9 @@
|
||||
/*
|
||||
Xwiper
|
||||
|
||||
Provided by https://github.com/uxitten/xwiper/
|
||||
*/
|
||||
|
||||
'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; }; }();
|
||||
|
Loading…
Reference in New Issue
Block a user