From 6f482f8f78508c1e6245b0ff8770d6eaed9d6286 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 20 Dec 2013 22:40:25 -0500 Subject: [PATCH 01/19] Add support for videos using ffmpeg for transcoding to webm format and HTML5 video tag. --- scanner/PhotoAlbum.py | 174 +++++++++++++++++++++++++++++------- web/css/000-controls.css | 7 +- web/index.html | 5 ++ web/js/010-libphotofloat.js | 4 + web/js/011-display.js | 55 ++++++++---- 5 files changed, 194 insertions(+), 51 deletions(-) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index aeb3087..368b1d5 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -6,6 +6,8 @@ import os.path from PIL import Image from PIL.ExifTags import TAGS import gc +import tempfile +import subprocess class Album(object): def __init__(self, path): @@ -102,12 +104,13 @@ class Album(object): if trim_base(path) == photo._path: return photo return None - + class Photo(object): thumb_sizes = [ (75, True), (150, True), (640, False), (800, False), (1024, False) ] def __init__(self, path, thumb_path=None, attributes=None): self._path = trim_base(path) self.is_valid = True + image = None try: mtime = file_mtime(path) except KeyboardInterrupt: @@ -120,17 +123,26 @@ class Photo(object): return self._attributes = {} self._attributes["dateTimeFile"] = mtime + self._attributes["mediaType"] = "photo" try: image = Image.open(path) except KeyboardInterrupt: raise except: + self._video_metadata(path) + + if isinstance(image, Image.Image): + self._photo_metadata(image) + self._photo_thumbnails(image, thumb_path, path) + elif self._attributes["mediaType"] == "video": + self._video_metadata(path) + self._video_thumbnails(thumb_path, path) + self._video_transcode(thumb_path, path) + else: self.is_valid = False - return - self._metadata(image) - self._thumbnails(image, thumb_path, path) - def _metadata(self, image): + + def _photo_metadata(self, image): self._attributes["size"] = image.size self._orientation = 1 try: @@ -160,8 +172,8 @@ class Photo(object): 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._metadata.orientation_list): - self._attributes["orientation"] = self._metadata.orientation_list[self._orientation - 1] + if self._orientation - 1 < len(self._photo_metadata.orientation_list): + self._attributes["orientation"] = self._photo_metadata.orientation_list[self._orientation - 1] if "Make" in exif: self._attributes["make"] = exif["Make"] if "Model" in exif: @@ -180,32 +192,32 @@ 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._metadata.flash_dictionary: + if "Flash" in exif and exif["Flash"] in self._photo_metadata.flash_dictionary: try: - self._attributes["flash"] = self._metadata.flash_dictionary[exif["Flash"]] + self._attributes["flash"] = self._photo_metadata.flash_dictionary[exif["Flash"]] except KeyboardInterrupt: raise except: pass - if "LightSource" in exif and exif["LightSource"] in self._metadata.light_source_dictionary: + if "LightSource" in exif and exif["LightSource"] in self._photo_metadata.light_source_dictionary: try: - self._attributes["lightSource"] = self._metadata.light_source_dictionary[exif["LightSource"]] + self._attributes["lightSource"] = self._photo_metadata.light_source_dictionary[exif["LightSource"]] except KeyboardInterrupt: raise except: pass - if "ExposureProgram" in exif and exif["ExposureProgram"] < len(self._metadata.exposure_list): - self._attributes["exposureProgram"] = self._metadata.exposure_list[exif["ExposureProgram"]] + if "ExposureProgram" in exif and exif["ExposureProgram"] < len(self._photo_metadata.exposure_list): + self._attributes["exposureProgram"] = self._photo_metadata.exposure_list[exif["ExposureProgram"]] if "SpectralSensitivity" in exif: self._attributes["spectralSensitivity"] = exif["SpectralSensitivity"] - if "MeteringMode" in exif and exif["MeteringMode"] < len(self._metadata.metering_list): - self._attributes["meteringMode"] = self._metadata.metering_list[exif["MeteringMode"]] - if "SensingMethod" in exif and exif["SensingMethod"] < len(self._metadata.sensing_method_list): - self._attributes["sensingMethod"] = self._metadata.sensing_method_list[exif["SensingMethod"]] - if "SceneCaptureType" in exif and exif["SceneCaptureType"] < len(self._metadata.scene_capture_type_list): - self._attributes["sceneCaptureType"] = self._metadata.scene_capture_type_list[exif["SceneCaptureType"]] - if "SubjectDistanceRange" in exif and exif["SubjectDistanceRange"] < len(self._metadata.subject_distance_range_list): - self._attributes["subjectDistanceRange"] = self._metadata.subject_distance_range_list[exif["SubjectDistanceRange"]] + 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"]] if "ExposureCompensation" in exif: self._attributes["exposureCompensation"] = exif["ExposureCompensation"] if "ExposureBiasValue" in exif: @@ -215,15 +227,38 @@ class Photo(object): if "DateTime" in exif: self._attributes["dateTime"] = exif["DateTime"] - _metadata.flash_dictionary = {0x0: "No Flash", 0x1: "Fired",0x5: "Fired, Return not detected",0x7: "Fired, Return detected",0x8: "On, Did not fire",0x9: "On, Fired",0xd: "On, Return not detected",0xf: "On, Return detected",0x10: "Off, Did not fire",0x14: "Off, Did not fire, Return not detected",0x18: "Auto, Did not fire",0x19: "Auto, Fired",0x1d: "Auto, Fired, Return not detected",0x1f: "Auto, Fired, Return detected",0x20: "No flash function",0x30: "Off, No flash function",0x41: "Fired, Red-eye reduction",0x45: "Fired, Red-eye reduction, Return not detected",0x47: "Fired, Red-eye reduction, Return detected",0x49: "On, Red-eye reduction",0x4d: "On, Red-eye reduction, Return not detected",0x4f: "On, Red-eye reduction, Return detected",0x50: "Off, Red-eye reduction",0x58: "Auto, Did not fire, Red-eye reduction",0x59: "Auto, Fired, Red-eye reduction",0x5d: "Auto, Fired, Red-eye reduction, Return not detected",0x5f: "Auto, Fired, Red-eye reduction, Return detected"} - _metadata.light_source_dictionary = {0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten"} - _metadata.metering_list = ["Unknown", "Average", "Center-weighted average", "Spot", "Multi-spot", "Multi-segment", "Partial"] - _metadata.exposure_list = ["Not Defined", "Manual", "Program AE", "Aperture-priority AE", "Shutter speed priority AE", "Creative (Slow speed)", "Action (High speed)", "Portrait", "Landscape", "Bulb"] - _metadata.orientation_list = ["Horizontal (normal)", "Mirror horizontal", "Rotate 180", "Mirror vertical", "Mirror horizontal and rotate 270 CW", "Rotate 90 CW", "Mirror horizontal and rotate 90 CW", "Rotate 270 CW"] - _metadata.sensing_method_list = ["Not defined", "One-chip color area sensor", "Two-chip color area sensor", "Three-chip color area sensor", "Color sequential area sensor", "Trilinear sensor", "Color sequential linear sensor"] - _metadata.scene_capture_type_list = ["Standard", "Landscape", "Portrait", "Night scene"] - _metadata.subject_distance_range_list = ["Unknown", "Macro", "Close view", "Distant view"] - + _photo_metadata.flash_dictionary = {0x0: "No Flash", 0x1: "Fired",0x5: "Fired, Return not detected",0x7: "Fired, Return detected",0x8: "On, Did not fire",0x9: "On, Fired",0xd: "On, Return not detected",0xf: "On, Return detected",0x10: "Off, Did not fire",0x14: "Off, Did not fire, Return not detected",0x18: "Auto, Did not fire",0x19: "Auto, Fired",0x1d: "Auto, Fired, Return not detected",0x1f: "Auto, Fired, Return detected",0x20: "No flash function",0x30: "Off, No flash function",0x41: "Fired, Red-eye reduction",0x45: "Fired, Red-eye reduction, Return not detected",0x47: "Fired, Red-eye reduction, Return detected",0x49: "On, Red-eye reduction",0x4d: "On, Red-eye reduction, Return not detected",0x4f: "On, Red-eye reduction, Return detected",0x50: "Off, Red-eye reduction",0x58: "Auto, Did not fire, Red-eye reduction",0x59: "Auto, Fired, Red-eye reduction",0x5d: "Auto, Fired, Red-eye reduction, Return not detected",0x5f: "Auto, Fired, Red-eye reduction, Return detected"} + _photo_metadata.light_source_dictionary = {0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten"} + _photo_metadata.metering_list = ["Unknown", "Average", "Center-weighted average", "Spot", "Multi-spot", "Multi-segment", "Partial"] + _photo_metadata.exposure_list = ["Not Defined", "Manual", "Program AE", "Aperture-priority AE", "Shutter speed priority AE", "Creative (Slow speed)", "Action (High speed)", "Portrait", "Landscape", "Bulb"] + _photo_metadata.orientation_list = ["Horizontal (normal)", "Mirror horizontal", "Rotate 180", "Mirror vertical", "Mirror horizontal and rotate 270 CW", "Rotate 90 CW", "Mirror horizontal and rotate 90 CW", "Rotate 270 CW"] + _photo_metadata.sensing_method_list = ["Not defined", "One-chip color area sensor", "Two-chip color area sensor", "Three-chip color area sensor", "Color sequential area sensor", "Trilinear sensor", "Color sequential linear sensor"] + _photo_metadata.scene_capture_type_list = ["Standard", "Landscape", "Portrait", "Night scene"] + _photo_metadata.subject_distance_range_list = ["Unknown", "Macro", "Close view", "Distant view"] + + def _video_metadata(self, path, original=True): + try: + p = subprocess.check_output(['/usr/bin/ffprobe', '-show_format', '-show_streams', '-of', 'json', '-loglevel', '0', path]) + except KeyboardInterrupt: + raise + except: + return + info = json.loads(p) + for s in info["streams"]: + if 'codec_type' in s and s['codec_type'] == 'video': + if original: + self._attributes["mediaType"] = "video" + self._attributes["originalSize"] = (int(s["width"]), int(s["height"])) + self._attributes["duration"] = s["duration"] + if "tags" in s: + # creation_time only in UTC! + # https://code.google.com/p/android/issues/detail?id=60225#c6 + #self._attributes["dateTime"] = s["tags"]["creation_time"] + if "rotate" in s["tags"]: + self._attributes["rotate"] = s["tags"]["rotate"] + else: + self._attributes["size"] = (int(s["width"]), int(s["height"])) + def _thumbnail(self, image, thumb_path, original_path, size, square=False): thumb_path = os.path.join(thumb_path, image_cache(self._path, size, square)) info_string = "%s -> %spx" % (os.path.basename(original_path), str(size)) @@ -268,7 +303,7 @@ class Photo(object): message("save failure", os.path.basename(thumb_path)) os.unlink(thumb_path) - def _thumbnails(self, image, thumb_path, original_path): + def _photo_thumbnails(self, image, thumb_path, original_path): mirror = image if self._orientation == 2: # Vertical Mirror @@ -293,6 +328,73 @@ class Photo(object): mirror = image.transpose(Image.ROTATE_90) for size in Photo.thumb_sizes: self._thumbnail(mirror, thumb_path, original_path, size[0], size[1]) + + def _video_thumbnails(self, thumb_path, original_path): + (tfd, tfn) = tempfile.mkstemp(); + try: + subprocess.check_call(['/usr/bin/ffmpeg', '-i', original_path, '-f', 'image2', '-vsync', '1', '-vframes', '1', '-an', '-loglevel', 'quiet', tfn]) + except KeyboardInterrupt: + os.unlink(tfn) + raise + except: + message("couldn't extract video frame", os.path.basename(original_path)) + os.unlink(tfn) + return + try: + image = Image.open(tfn) + except KeyboardInterrupt: + raise + except: + message("couldn't open video thumbnail", tfn) + os.unlink(tfn) + return + mirror = image + if "rotate" in self._attributes: + if self._attributes["rotate"] == "90": + mirror = image.transpose(Image.ROTATE_270) + elif self._attributes["rotate"] == "180": + mirror = image.transpose(Image.ROTATE_180) + elif self._attributes["rotate"] == "270": + mirror = image.transpose(Image.ROTATE_90) + for size in Photo.thumb_sizes: + if size[1]: + self._thumbnail(mirror, thumb_path, original_path, size[0], size[1]) + os.unlink(tfn) + + def _video_transcode(self, transcode_path, original_path): + transcode_path = os.path.join(transcode_path, cache_base(self._path) + '.webm') + transcode_cmd = ['/usr/bin/ffmpeg', '-i', original_path, '-c:v', 'libvpx', '-crf', '10', '-b:v', '800k', '-c:a', 'libvorbis', '-f', 'webm', '-threads', '2', '-loglevel', '0', '-y'] + filters = [] + info_string = "%s -> webm" % (os.path.basename(original_path)) + message("transcoding", info_string) + if os.path.exists(transcode_path) and file_mtime(transcode_path) >= self._attributes["dateTimeFile"]: + return + if "originalSize" in self._attributes and self._attributes["originalSize"][1] > 720: + filters.append("scale=trunc(oh*a/2)*2:min(720\,iw)") + if "rotate" in self._attributes: + if self._attributes["rotate"] == "90": + filters.append('transpose=1') + elif self._attributes["rotate"] == "180": + filters.append('vflip,hflip') + elif self._attributes["rotate"] == "270": + filters.append('transpose=2') + if len(filters): + transcode_cmd.append('-vf') + transcode_cmd.append(','.join(filters)) + transcode_cmd.append(transcode_path) + try: + subprocess.call(transcode_cmd) + except KeyboardInterrupt: + raise + except: + message("transcoding failure", os.path.basename(original_path)) + try: + os.unlink(transcode_path) + except: + pass + return + self._video_metadata(transcode_path, False) + @property def name(self): return os.path.basename(self._path) @@ -303,7 +405,15 @@ class Photo(object): return self._path @property def image_caches(self): - return [image_cache(self._path, size[0], size[1]) for size in Photo.thumb_sizes] + caches = [] + if "mediaType" in self._attributes and self._attributes["mediaType"] == "video": + for size in Photo.thumb_sizes: + if size[1]: + caches.append(image_cache(self._path, size[0], size[1])) + caches.append(cache_base(self._path) + '.webm') + else: + caches = [image_cache(self._path, size[0], size[1]) for size in Photo.thumb_sizes] + return caches @property def date(self): if not self.is_valid: diff --git a/web/css/000-controls.css b/web/css/000-controls.css index 66fe6d6..1aee05b 100644 --- a/web/css/000-controls.css +++ b/web/css/000-controls.css @@ -91,9 +91,14 @@ a:hover { right: 0; text-align: center; } -#photo-box { +#photo-box, #video-box { display: inline; } +#video-box-inner { + position: absolute; + top: 50%; + width: 100%; +} #photo-links { background-color: #000000; font-weight: bold; diff --git a/web/index.html b/web/index.html index 388609b..ab9b61d 100644 --- a/web/index.html +++ b/web/index.html @@ -21,6 +21,11 @@
+
+
+ +
+
diff --git a/web/js/010-libphotofloat.js b/web/js/010-libphotofloat.js index 30cf889..a4ad3db 100644 --- a/web/js/010-libphotofloat.js +++ b/web/js/010-libphotofloat.js @@ -144,6 +144,9 @@ suffix = size.toString(); return "cache/" + PhotoFloat.cachePath(PhotoFloat.photoHash(album, photo) + "_" + suffix + ".jpg"); }; + PhotoFloat.videoPath = function(album, video) { + return "cache/" + PhotoFloat.cachePath(PhotoFloat.photoHash(album, video) + ".webm"); + }; PhotoFloat.originalPhotoPath = function(album, photo) { return "albums/" + album.path + "/" + photo.name; }; @@ -176,6 +179,7 @@ PhotoFloat.prototype.photoHash = PhotoFloat.photoHash; PhotoFloat.prototype.albumHash = PhotoFloat.albumHash; PhotoFloat.prototype.photoPath = PhotoFloat.photoPath; + PhotoFloat.prototype.videoPath = PhotoFloat.videoPath; PhotoFloat.prototype.originalPhotoPath = PhotoFloat.originalPhotoPath; PhotoFloat.prototype.trimExtension = PhotoFloat.trimExtension; PhotoFloat.prototype.cleanHash = PhotoFloat.cleanHash; diff --git a/web/js/011-display.js b/web/js/011-display.js index f0ddd77..007eb32 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -145,6 +145,7 @@ $(document).ready(function() { $("#album-view").removeClass("photo-view-container"); $("#subalbums").show(); $("#photo-view").hide(); + $("#video")[0].pause() } setTimeout(scrollToThumb, 1); } @@ -165,25 +166,43 @@ $(document).ready(function() { image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", ""); } function showPhoto() { - var width, height, photoSrc, previousPhoto, nextPhoto, nextLink, text; - width = currentPhoto.size[0]; - height = currentPhoto.size[1]; - if (width > height) { - height = height / width * maxSize; - width = maxSize; - } else { - width = width / height * maxSize; - height = maxSize; + var width, height, photoSrc, videoSrc, previousPhoto, nextPhoto, nextLink, text; + + if (currentPhoto.mediaType == "video") { + width = currentPhoto.size[0]; + height = currentPhoto.size[1]; + videoSrc = photoFloat.videoPath(currentAlbum, currentPhoto); + $("#video") + .attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1]) + .attr("src", videoSrc) + .attr("alt", currentPhoto.name); + $("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2); + $("#photo-box").hide(); + $("#video-box").show(); + } + else { + width = currentPhoto.size[0]; + height = currentPhoto.size[1]; + if (width > height) { + height = height / width * maxSize; + width = maxSize; + } else { + width = width / height * maxSize; + height = maxSize; + } + $(window).unbind("resize", scaleImage); + photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false); + $("#photo") + .attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1]) + .attr("src", photoSrc) + .attr("alt", currentPhoto.name) + .attr("title", currentPhoto.date) + .load(scaleImage); + $("head").append(""); + $("#video")[0].pause() + $("#video-box").hide(); + $("#photo-box").show(); } - $(window).unbind("resize", scaleImage); - photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false); - $("#photo") - .attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1]) - .attr("src", photoSrc) - .attr("alt", currentPhoto.name) - .attr("title", currentPhoto.date) - .load(scaleImage); - $("head").append(""); previousPhoto = currentAlbum.photos[ (currentPhotoIndex - 1 < 0) ? (currentAlbum.photos.length - 1) : (currentPhotoIndex - 1) From aa55758aab02830be38104e9cba2f769baae1aa0 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 21 Dec 2013 15:01:08 -0500 Subject: [PATCH 02/19] Initialize bugs-everywhere and add a few bugs --- .../179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/body | 1 + .../values | 29 +++++++++++ .../values | 50 +++++++++++++++++++ .../values | 50 +++++++++++++++++++ .../affa4e4f-9e7c-404b-bed8-c904cb3a50f1/body | 1 + .../values | 29 +++++++++++ .../values | 50 +++++++++++++++++++ .../values | 50 +++++++++++++++++++ .../settings | 1 + .be/version | 1 + 10 files changed, 262 insertions(+) create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/body create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/body create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values create mode 100644 .be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/settings create mode 100644 .be/version diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/body b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/body new file mode 100644 index 0000000..21ee7b2 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/body @@ -0,0 +1 @@ +We should support Libav for transcoding, but these two bugs are blockers : https://bugzilla.libav.org/show_bug.cgi?id=595 and https://bugzilla.libav.org/show_bug.cgi?id=597 diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/values new file mode 100644 index 0000000..a230b7f --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/comments/179f90f8-b2f8-46a8-b6b9-81fa7b4816f2/values @@ -0,0 +1,29 @@ +{ + + + + + + + "Author": "Jerome Charaoui ", + + + + + + + "Content-type": "text/plain", + + + + + + + "Date": "Sat, 21 Dec 2013 19:56:28 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/values new file mode 100644 index 0000000..4b1ce90 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/31edc55d-c53d-4357-9993-5d2a7c58ef86/values @@ -0,0 +1,50 @@ +{ + + + + + + + "creator": "Jerome Charaoui ", + + + + + + + "reporter": "Jerome Charaoui ", + + + + + + + "severity": "minor", + + + + + + + "status": "open", + + + + + + + "summary": "Libav support", + + + + + + + "time": "Sat, 21 Dec 2013 19:55:23 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values new file mode 100644 index 0000000..74e6871 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values @@ -0,0 +1,50 @@ +{ + + + + + + + "creator": "Jerome Charaoui ", + + + + + + + "reporter": "Jerome Charaoui ", + + + + + + + "severity": "minor", + + + + + + + "status": "open", + + + + + + + "summary": "Video gets cropped when viewport is smaller than video", + + + + + + + "time": "Sat, 21 Dec 2013 19:42:03 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/body b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/body new file mode 100644 index 0000000..44c1090 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/body @@ -0,0 +1 @@ +According to Android developpers, creation_time should only be UTC, not local time. Should we therefore ignore it and use mtime (current situation) or convert it to local time? See https://code.google.com/p/android/issues/detail?id=60225#c6 diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/values new file mode 100644 index 0000000..d60c348 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/comments/affa4e4f-9e7c-404b-bed8-c904cb3a50f1/values @@ -0,0 +1,29 @@ +{ + + + + + + + "Author": "Jerome Charaoui ", + + + + + + + "Content-type": "text/plain", + + + + + + + "Date": "Sat, 21 Dec 2013 19:53:38 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/values new file mode 100644 index 0000000..2246955 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/c36bfb5a-3b70-4d53-aee9-587fc0e3f461/values @@ -0,0 +1,50 @@ +{ + + + + + + + "creator": "Jerome Charaoui ", + + + + + + + "reporter": "Jerome Charaoui ", + + + + + + + "severity": "minor", + + + + + + + "status": "open", + + + + + + + "summary": "Use or ignore creation_time in video metadata?", + + + + + + + "time": "Sat, 21 Dec 2013 19:51:48 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values new file mode 100644 index 0000000..6d8a23e --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values @@ -0,0 +1,50 @@ +{ + + + + + + + "creator": "Jerome Charaoui ", + + + + + + + "reporter": "Jerome Charaoui ", + + + + + + + "severity": "minor", + + + + + + + "status": "open", + + + + + + + "summary": "Add a icon overlay on video thumnails", + + + + + + + "time": "Sat, 21 Dec 2013 19:42:39 +0000" + + + + + + +} diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/settings b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/settings new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/settings @@ -0,0 +1 @@ +{} diff --git a/.be/version b/.be/version new file mode 100644 index 0000000..38d39ae --- /dev/null +++ b/.be/version @@ -0,0 +1 @@ +Bugs Everywhere Directory v1.5 From 0443b99492b0d52bc38635a9522de3947b41d6df Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 21 Dec 2013 20:46:56 -0500 Subject: [PATCH 03/19] If thumbing or transcoding fails, invalidate entry. --- scanner/PhotoAlbum.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index 368b1d5..d89733c 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -242,6 +242,7 @@ class Photo(object): except KeyboardInterrupt: raise except: + self.is_valid = False return info = json.loads(p) for s in info["streams"]: @@ -279,6 +280,7 @@ class Photo(object): raise except: message("corrupt image", os.path.basename(original_path)) + self.is_valid = False return if square: if image.size[0] > image.size[1]: @@ -302,6 +304,7 @@ class Photo(object): except: message("save failure", os.path.basename(thumb_path)) os.unlink(thumb_path) + self.is_valid = False def _photo_thumbnails(self, image, thumb_path, original_path): mirror = image @@ -339,6 +342,7 @@ class Photo(object): except: message("couldn't extract video frame", os.path.basename(original_path)) os.unlink(tfn) + self.is_valid = False return try: image = Image.open(tfn) @@ -347,6 +351,7 @@ class Photo(object): except: message("couldn't open video thumbnail", tfn) os.unlink(tfn) + self.is_valid = False return mirror = image if "rotate" in self._attributes: @@ -392,6 +397,7 @@ class Photo(object): os.unlink(transcode_path) except: pass + self.is_valid = False return self._video_metadata(transcode_path, False) From 1409c13e3060c87dcde031e8ca5d41f43daf1c31 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 21 Dec 2013 23:48:10 -0500 Subject: [PATCH 04/19] Overlay a small icon on video thumbnails --- .../e5f78ecf-9f31-4904-b596-a2b6916eb0de/values | 2 +- web/img/video-icon.png | Bin 0 -> 1158 bytes web/js/011-display.js | 5 ++++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 web/img/video-icon.png diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values index 6d8a23e..a324dda 100644 --- a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/e5f78ecf-9f31-4904-b596-a2b6916eb0de/values @@ -26,7 +26,7 @@ - "status": "open", + "status": "fixed", diff --git a/web/img/video-icon.png b/web/img/video-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..48fc7858c00213b2cae6b46b863c50b0436dbab5 GIT binary patch literal 1158 zcmeAS@N?(olHy`uVBq!ia0vp^(?FPm4M^HB7CvHNVDa^IaSW-r_4f8@Zxwf$10Ul< z?Tv0em~^sP^|6!Ej+{dc9ZeIGXDFz!pOk+fzueo(f@ci;z1PmKTzk zIpuNDVXZ}8zjNN5T@cy5;aENAm7o8A@(Qkex_+YYbm=fHC3B^sw|{b;D7zk#`mbsr zFp+)oMReHu1V85zbHsa=<4gQ?z3mlUTth_9N(7s!@*^Wp_^u@wV-IAXkujc*?afym3w=8 zpZ|1owU}$5g}M21tGVa61%IwC*>Xbe^yR;yTXyXD5xDv0pFMHw?caUgz5ea|9>Yaj z>%v{+x;k>rX7`(!nc2;rHLL1I-uC_XZr%E2$batH`*h7O1{)4Y1amh%IBTaEy7&09 zOsUMZ_ao!t{-va*KJEVb^QZs%b?f4Q4)WdSzB}#Mr|Qq^KJC5Y5gxf_@7$V6DxFbl zuU-E7_3Qd&%a_|koKOM4dy%NlL4$tfOvvcp>zs1WhSKiCpUSIL)$w`;(xBtev2<@!?Hg|(f*QqX# zO+W>w4<0qc_3nWti9HvOw(YCAwm0I{mTNbG!LVMbNKYw!`SRuZ;o;%^Prlu` zx>I`kJd^$dIwvSK848~f3K^fW7GGzLdkQI#r`G2&!(5e$-dNF>Lbx+emC#? z(T5Kc!(H@TmrOq%BDeBSwRnrFPW>URM_TVPI-Y)GD%szC;b`6N9h(=LE39~Qj{S1} zwIt0i37_M*jy@@zl0UaF|J&xJ8C@Nx93|B?%-+vqOJl3CpZxH9^3?aIi_*0cKfimw zCRB7r;h|N#p4)2w?OPe~i%m{+)A3K~`=8o*JhTf5{A%EORYFQM@uy_?&yzCW4Gq4B zv`*aJU(egywe-UM)QufyPu=A{waq`lC@bVlMBTZV=D5{;TC3w2fq9)S;KA;Ch8O#{ UoR&H7eH~<>r>mdKI;Vst0J)M9=Kufz literal 0 HcmV?d00001 diff --git a/web/js/011-display.js b/web/js/011-display.js index 007eb32..7f5db63 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -97,7 +97,10 @@ $(document).ready(function() { photos = []; for (i = 0; i < currentAlbum.photos.length; ++i) { link = $(""); - image = $("\"""); + image = $("\"""); + if (currentAlbum.photos[i].mediaType == "video") + image.css("background-image", "url(" + image.attr("src") + ")").attr("src", "img/video-icon.png"); + else image.get(0).photo = currentAlbum.photos[i]; link.append(image); photos.push(link); From 315b03f7374e54d6cc448642ae7f73eb43b0da7a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 02:28:34 -0500 Subject: [PATCH 05/19] Add automatic scaling for video --- web/js/011-display.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/web/js/011-display.js b/web/js/011-display.js index 7f5db63..09831ed 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -97,7 +97,7 @@ $(document).ready(function() { photos = []; for (i = 0; i < currentAlbum.photos.length; ++i) { link = $(""); - image = $("\"""); + image = $("\"""); if (currentAlbum.photos[i].mediaType == "video") image.css("background-image", "url(" + image.attr("src") + ")").attr("src", "img/video-icon.png"); else @@ -168,20 +168,36 @@ $(document).ready(function() { else if (image.css("height") !== "100%") image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", ""); } + function scaleVideo() { + var video, container; + video = $("#video"); + if (video.get(0) === this) + $(window).bind("resize", scaleVideo); + container = $("#photo-view"); + if (video.attr("width") > container.width() && container.height() * video.attr("ratio") > container.width()) + video.css("width", container.width()).css("height", container.width() / video.attr("ratio")).parent().css("height", container.width() / video.attr("ratio")).css("margin-top", - container.width() / video.attr("ratio") / 2).css("top", "50%"); + else if (video.attr("height") > container.height() && container.height() * video.attr("ratio") < container.width()) + video.css("height", container.height()).css("width", container.height() * video.attr("ratio")).parent().css("height", "100%").css("margin-top", "0").css("top", "0"); + else + video.css("height", "").css("width", "").parent().css("height", video.attr("height")).css("margin-top", - video.attr("height") / 2).css("top", "50%"); + } function showPhoto() { var width, height, photoSrc, videoSrc, previousPhoto, nextPhoto, nextLink, text; if (currentPhoto.mediaType == "video") { width = currentPhoto.size[0]; height = currentPhoto.size[1]; + $(window).unbind("resize", scaleVideo); + $(window).unbind("resize", scaleImage); videoSrc = photoFloat.videoPath(currentAlbum, currentPhoto); - $("#video") + $("#video") .attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1]) .attr("src", videoSrc) - .attr("alt", currentPhoto.name); - $("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2); - $("#photo-box").hide(); - $("#video-box").show(); + .attr("alt", currentPhoto.name) + .on('loadstart', scaleVideo); + $("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2); + $("#photo-box").hide(); + $("#video-box").show(); } else { width = currentPhoto.size[0]; @@ -193,6 +209,7 @@ $(document).ready(function() { width = width / height * maxSize; height = maxSize; } + $(window).unbind("resize", scaleVideo); $(window).unbind("resize", scaleImage); photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false); $("#photo") From 10a31bbd1ed3879b8024cef49449b49a5856563b Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 03:01:50 -0500 Subject: [PATCH 06/19] Fix thumb scrolling on videos --- web/js/011-display.js | 1 - 1 file changed, 1 deletion(-) diff --git a/web/js/011-display.js b/web/js/011-display.js index 09831ed..d452237 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -100,7 +100,6 @@ $(document).ready(function() { image = $("\"""); if (currentAlbum.photos[i].mediaType == "video") image.css("background-image", "url(" + image.attr("src") + ")").attr("src", "img/video-icon.png"); - else image.get(0).photo = currentAlbum.photos[i]; link.append(image); photos.push(link); From 993b799f6288c9e48344bb1e780b199f469edd96 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 03:04:30 -0500 Subject: [PATCH 07/19] Implement tag --- web/js/011-display.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/js/011-display.js b/web/js/011-display.js index d452237..a985ebf 100644 --- a/web/js/011-display.js +++ b/web/js/011-display.js @@ -194,6 +194,7 @@ $(document).ready(function() { .attr("src", videoSrc) .attr("alt", currentPhoto.name) .on('loadstart', scaleVideo); + $("head").append(""); $("#video-box-inner").css('height', height + 'px').css('margin-top', - height / 2); $("#photo-box").hide(); $("#video-box").show(); @@ -305,6 +306,7 @@ $(document).ready(function() { $(window).hashchange(function() { $("#loading").show(); $("link[rel=image_src]").remove(); + $("link[rel=video_src]").remove(); if (location.search.indexOf("?_escaped_fragment_=") === 0) { location.hash = location.search.substring(20); location.search = ""; From 50a2284d50680d5d4edf26fa91034524fd7854a6 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 03:07:21 -0500 Subject: [PATCH 08/19] Close bug ea1/9da (cropped video) --- .../bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values index 74e6871..27b1ed4 100644 --- a/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values +++ b/.be/ea1b0351-d083-41d9-b39b-55ff97bf0b25/bugs/9dacbb0a-bb8d-4fd8-8095-9571e8f7f48b/values @@ -26,7 +26,7 @@ - "status": "open", + "status": "fixed", From 0d35832b21dac5d98deacfeeaea8ec7a22d1cdda Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 20:33:43 -0500 Subject: [PATCH 09/19] Handle video metadata correctly --- scanner/PhotoAlbum.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index d89733c..972db9b 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -136,7 +136,6 @@ class Photo(object): self._photo_metadata(image) self._photo_thumbnails(image, thumb_path, path) elif self._attributes["mediaType"] == "video": - self._video_metadata(path) self._video_thumbnails(thumb_path, path) self._video_transcode(thumb_path, path) else: @@ -247,18 +246,15 @@ class Photo(object): info = json.loads(p) for s in info["streams"]: if 'codec_type' in s and s['codec_type'] == 'video': - if original: - self._attributes["mediaType"] = "video" - self._attributes["originalSize"] = (int(s["width"]), int(s["height"])) + self._attributes["mediaType"] = "video" + self._attributes["size"] = (int(s["width"]), int(s["height"])) + if s["duration"]: self._attributes["duration"] = s["duration"] - if "tags" in s: - # creation_time only in UTC! - # https://code.google.com/p/android/issues/detail?id=60225#c6 - #self._attributes["dateTime"] = s["tags"]["creation_time"] - if "rotate" in s["tags"]: - self._attributes["rotate"] = s["tags"]["rotate"] - else: - self._attributes["size"] = (int(s["width"]), int(s["height"])) + if "tags" in s and "rotate" in s["tags"]: + self._attributes["rotate"] = s["tags"]["rotate"] + if original: + self._attributes["originalSize"] = (int(s["width"]), int(s["height"])) + break def _thumbnail(self, image, thumb_path, original_path, size, square=False): thumb_path = os.path.join(thumb_path, image_cache(self._path, size, square)) From 2df2730cd32626da5c27903a5f384c4c5e1eb009 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 21:09:05 -0500 Subject: [PATCH 10/19] Read metadata from previously transcoded video (must account for rotation and/or downscaling) --- scanner/PhotoAlbum.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index 972db9b..d82d025 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -369,6 +369,7 @@ class Photo(object): info_string = "%s -> webm" % (os.path.basename(original_path)) message("transcoding", info_string) if os.path.exists(transcode_path) and file_mtime(transcode_path) >= self._attributes["dateTimeFile"]: + self._video_metadata(transcode_path, False) return if "originalSize" in self._attributes and self._attributes["originalSize"][1] > 720: filters.append("scale=trunc(oh*a/2)*2:min(720\,iw)") From 1bb130d37b8ea2acf4b131611295d91b59291923 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sun, 22 Dec 2013 21:40:48 -0500 Subject: [PATCH 11/19] Fix testing for duration in video metadata --- scanner/PhotoAlbum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index d82d025..373d866 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -248,7 +248,7 @@ class Photo(object): if 'codec_type' in s and s['codec_type'] == 'video': self._attributes["mediaType"] = "video" self._attributes["size"] = (int(s["width"]), int(s["height"])) - if s["duration"]: + if "duration" in s: self._attributes["duration"] = s["duration"] if "tags" in s and "rotate" in s["tags"]: self._attributes["rotate"] = s["tags"]["rotate"] From 80060b37c13395859da4c4dfdaec8e8028749fce Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Mon, 27 Jan 2014 23:02:10 -0500 Subject: [PATCH 12/19] Create