From b494e83efd647b035c6bee2fa09a33fa383ef4a3 Mon Sep 17 00:00:00 2001 From: Julien Valroff Date: Mon, 23 May 2011 21:05:06 +0200 Subject: Imported Upstream version 0.4.1 --- rapid/ChangeLog | 23 +++++++++++++++++++ rapid/config.py | 2 +- rapid/generatename.py | 10 +++++++- rapid/generatenameconfig.py | 10 +++++++- rapid/glade3/prefs.ui | 14 ++++++------ rapid/metadataphoto.py | 17 ++++++++++++-- rapid/rapid.py | 11 ++++----- rapid/scan.py | 56 +++++++++++++++++++++------------------------ rapid/subfolderfile.py | 18 ++++++++++++++- 9 files changed, 112 insertions(+), 49 deletions(-) (limited to 'rapid') diff --git a/rapid/ChangeLog b/rapid/ChangeLog index 8fce376..7c74bb9 100644 --- a/rapid/ChangeLog +++ b/rapid/ChangeLog @@ -1,3 +1,26 @@ +Version 0.4.1 +------------- + +2011-05-19 + +Added exif Artist and Copyright metadata options to file and subfoler name +generation. + +Fixed bug #774476: thumbnails occassionally not sorted by file modification +time. + +Fixed bug #784399: job code not prompted for after preference change. + +Fixed bug #778085: crash when trying to scan inaccessible files on mounted +camera. + +Relaxed startup test to check whether pynotify is working. On some systems, +pynotify reports it is not working even though it is. + +Added the start of an Indonesian translation. Updated Brazilian, Dutch, French, +German, Hungarian, Italian, Polish, Russian, Spanish and Ukrainian translations. + + Version 0.4.0 ------------- diff --git a/rapid/config.py b/rapid/config.py index 86a268a..ce498c0 100644 --- a/rapid/config.py +++ b/rapid/config.py @@ -15,7 +15,7 @@ ### along with this program; if not, write to the Free Software ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -version = '0.4.0' +version = '0.4.1' GCONF_KEY="/apps/rapid-photo-downloader" diff --git a/rapid/generatename.py b/rapid/generatename.py index e904a70..1c95478 100644 --- a/rapid/generatename.py +++ b/rapid/generatename.py @@ -199,10 +199,15 @@ class PhotoName: elif self.L1 == OWNER_NAME: v = self.rpd_file.metadata.owner_name() + elif self.L1 == ARTIST: + v = self.rpd_file.metadata.artist() + elif self.L1 == COPYRIGHT: + v = self.rpd_file.metadata.copyright() else: raise TypeError("Invalid metadata option specified") if self.L1 in [CAMERA_MAKE, CAMERA_MODEL, SHORT_CAMERA_MODEL, - SHORT_CAMERA_MODEL_HYPHEN, OWNER_NAME]: + SHORT_CAMERA_MODEL_HYPHEN, OWNER_NAME, ARTIST, + COPYRIGHT]: if self.L2 == UPPERCASE: v = v.upper() elif self.L2 == LOWERCASE: @@ -296,6 +301,9 @@ class PhotoName: v = self._get_component() if v: name += v + + # remove any null characters - they are bad news in filenames + name = name.replace('\x00', '') if self.rpd_file.strip_characters: for c in r'\:*?"<>|': diff --git a/rapid/generatenameconfig.py b/rapid/generatenameconfig.py index 321761e..4d1f75c 100644 --- a/rapid/generatenameconfig.py +++ b/rapid/generatenameconfig.py @@ -69,6 +69,8 @@ SHORT_CAMERA_MODEL_HYPHEN = 'Hyphenated short camera model' SERIAL_NUMBER = 'Serial number' SHUTTER_COUNT = 'Shutter count' OWNER_NAME = 'Owner name' +COPYRIGHT = 'Copyright' +ARTIST = 'Artist' # Video metadata CODEC = 'Codec' @@ -189,6 +191,8 @@ class i18TranslateMeThanks: _('Height') _('Length') _('Frames Per Second') + _('Artist') + _('Copyright') # Translators: for an explanation of what this means, see http://damonlynch.net/rapid/documentation/index.html#sequencenumbers _('Downloads today') # Translators: for an explanation of what this means, see http://damonlynch.net/rapid/documentation/index.html#sequencenumbers @@ -364,7 +368,9 @@ LIST_METADATA_L1 = [APERTURE, ISO, EXPOSURE_TIME, FOCAL_LENGTH, SHORT_CAMERA_MODEL_HYPHEN, SERIAL_NUMBER, SHUTTER_COUNT, - OWNER_NAME] + OWNER_NAME, + ARTIST, + COPYRIGHT] LIST_VIDEO_METADATA_L1 = [CODEC, WIDTH, HEIGHT, LENGTH, FPS] @@ -380,6 +386,8 @@ DICT_METADATA_L1 = { SERIAL_NUMBER: None, SHUTTER_COUNT: LIST_SHUTTER_COUNT_L2, OWNER_NAME: LIST_CASE_L2, + ARTIST: LIST_CASE_L2, + COPYRIGHT: LIST_CASE_L2, ORDER_KEY: LIST_METADATA_L1 } diff --git a/rapid/glade3/prefs.ui b/rapid/glade3/prefs.ui index 9d1eb31..8f75f62 100644 --- a/rapid/glade3/prefs.ui +++ b/rapid/glade3/prefs.ui @@ -2902,12 +2902,6 @@ You can download photos from multiple devices simultaneously, or you can specify True False 3 - - - - - - Generate thumbnails (slower) @@ -2919,6 +2913,12 @@ You can download photos from multiple devices simultaneously, or you can specify + + + + + + True @@ -2964,7 +2964,7 @@ You can download photos from multiple devices simultaneously, or you can specify True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Miscillaneous + Miscellaneous 8 diff --git a/rapid/metadataphoto.py b/rapid/metadataphoto.py index 8a760c4..0442a86 100755 --- a/rapid/metadataphoto.py +++ b/rapid/metadataphoto.py @@ -20,7 +20,6 @@ import re import datetime import sys -#~ import subprocess import config import types import time @@ -219,6 +218,20 @@ class MetaData(pyexiv2.metadata.ImageMetadata): except: return missing + def copyright(self, missing=''): + """returns copyright exif information""" + try: + return self['Exif.Image.Copyright'].value.strip() + except: + return missing + + def artist(self, missing=''): + """returns exif artis information""" + try: + return self['Exif.Image.Artist'].value.strip() + except: + return missing + def short_camera_model(self, includeCharacters = '', missing=''): """ Returns in shorterned string format the camera model used to record the image. @@ -285,7 +298,7 @@ class MetaData(pyexiv2.metadata.ImageMetadata): else: return missing - + def date_time(self, missing=''): """ Returns in python datetime format the date and time the image was diff --git a/rapid/rapid.py b/rapid/rapid.py index 17d8335..ce4fa00 100755 --- a/rapid/rapid.py +++ b/rapid/rapid.py @@ -1618,7 +1618,7 @@ class RapidApp(dbus.service.Object): """ If all the scans are complete, sets the sort order """ - if self.scan_manager.get_no_active_processes() == 0: + if self.scan_manager.no_tasks == 0: self.thumbnails.sort_by_timestamp() @@ -2071,10 +2071,8 @@ class RapidApp(dbus.service.Object): # Track which temporary directories are created when downloading files self.temp_dirs_by_scan_pid = dict() - # Track which downloads and backups are running + # Track which downloads are running self.download_active_by_scan_pid = [] - self.backups_active_by_scan_pid = [] - def start_download(self, scan_pid=None): @@ -2688,6 +2686,7 @@ class RapidApp(dbus.service.Object): self.stored_sequence_value.value = value elif key in ['image_rename', 'subfolder', 'video_rename', 'video_subfolder']: + self.need_job_code_for_naming = self.prefs.any_pref_uses_job_code() # Check if stored sequence no is being used self._check_for_sequence_value_use() @@ -2736,8 +2735,8 @@ class RapidApp(dbus.service.Object): """ if not pynotify.init("TestCaps"): - logger.critical("Problem using pynotify.") - gtk.main_quit() + logger.warning("There might be problems using pynotify.") + #~ sys.exit(1) do_not_size_icon = False self.notification_icon_size = 48 diff --git a/rapid/scan.py b/rapid/scan.py index e55f43d..5092f0a 100755 --- a/rapid/scan.py +++ b/rapid/scan.py @@ -114,40 +114,36 @@ class Scan(multiprocessing.Process): file_type = rpdfile.file_type(ext) if file_type is not None: - # count how many files of each type are included - # e.g. photo, video - self.file_type_counter.add(file_type) - self.counter += 1 - display_name = child.get_display_name() - size = child.get_size() - modification_time = child.get_modification_time() file_id = child.get_attribute_string( gio.FILE_ATTRIBUTE_ID_FILE) - scanned_file = rpdfile.get_rpdfile(ext, - name, - display_name, - path.get_path(), - size, - modification_time, - self.pid, - file_id) + if file_id is not None: + # count how many files of each type are included + # e.g. photo, video + self.file_type_counter.add(file_type) + self.counter += 1 + display_name = child.get_display_name() + size = child.get_size() + modification_time = child.get_modification_time() + + scanned_file = rpdfile.get_rpdfile(ext, + name, + display_name, + path.get_path(), + size, + modification_time, + self.pid, + file_id) - if self.generate_folder: - # this dramatically slows scanning speed, and it - # is unlikely this will be called this early in the - # workflow - scanned_file.read_metadata() + self.files.append(scanned_file) - self.files.append(scanned_file) - - if self.counter == self.batch_size: - # send batch of results - self.results_pipe.send((rpdmp.CONN_PARTIAL, - self.files)) - self.files = [] - self.counter = 0 - - file_size_sum += size + if self.counter == self.batch_size: + # send batch of results + self.results_pipe.send((rpdmp.CONN_PARTIAL, + self.files)) + self.files = [] + self.counter = 0 + + file_size_sum += size return file_size_sum diff --git a/rapid/subfolderfile.py b/rapid/subfolderfile.py index 7e4a495..35bd74f 100644 --- a/rapid/subfolderfile.py +++ b/rapid/subfolderfile.py @@ -23,7 +23,7 @@ Generates names for files and folders. Runs a daemon process. """ -import os, datetime, collections +import os, datetime, collections, fractions import gio import multiprocessing @@ -308,6 +308,22 @@ class SubfolderFile(multiprocessing.Process): else: # Generate subfolder name and new file name generation_succeeded = True + experimental = False + if experimental and rpd_file.file_type == rpdfile.FILE_TYPE_PHOTO: + if load_metadata(rpd_file): + a = rpd_file.metadata.aperture() + if a == '0.0': + fl = rpd_file.metadata["Exif.Photo.FocalLength"].value + logger.info("Samyang lens - adjusting focal length and aperture... ") + #~ try: + rpd_file.metadata["Exif.Photo.FocalLength"] = fractions.Fraction(14,1) + rpd_file.metadata["Exif.Photo.FNumber"] = fractions.Fraction(8,1) + #~ rpd_file.metadata.write(preserve_timestamps=True) + #~ logger.info("...wrote new value") + #~ except: + #~ logger.error("failed to write value!") + + rpd_file = generate_subfolder(rpd_file) if rpd_file.download_subfolder: -- cgit v1.2.3