Remove output for update.py
This commit is contained in:
parent
ad62b0d61d
commit
5e30f372c8
|
@ -80,7 +80,8 @@ def main(argv):
|
||||||
if(media_type.__name__ == 'Video'):
|
if(media_type.__name__ == 'Video'):
|
||||||
filesystem.set_date_from_path_video(media)
|
filesystem.set_date_from_path_video(media)
|
||||||
|
|
||||||
process_file(current_file, destination, media)
|
dest_path = filesystem.process_file(current_file, destination, media, allowDuplicate=False, move=False)
|
||||||
|
print '%s -> %s' % (current_file, dest_path)
|
||||||
# Write to the hash database every 10 iterations
|
# Write to the hash database every 10 iterations
|
||||||
write_counter += 1
|
write_counter += 1
|
||||||
if(write_counter % 10 == 0):
|
if(write_counter % 10 == 0):
|
||||||
|
@ -94,7 +95,8 @@ def main(argv):
|
||||||
if(media_type.__name__ == 'Video'):
|
if(media_type.__name__ == 'Video'):
|
||||||
filesystem.set_date_from_path_video(media)
|
filesystem.set_date_from_path_video(media)
|
||||||
|
|
||||||
process_file(config['file'], destination, media)
|
dest_path = process_file(config['file'], destination, media, allowDuplicate=False, move=False)
|
||||||
|
print '%s -> %s' % (current_file, dest_path)
|
||||||
db.update_hash_db()
|
db.update_hash_db()
|
||||||
else:
|
else:
|
||||||
help()
|
help()
|
||||||
|
|
|
@ -28,6 +28,7 @@ def parse_arguments(args):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def main(config, args):
|
def main(config, args):
|
||||||
|
location_coords = None
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if(arg[:2] == '--'):
|
if(arg[:2] == '--'):
|
||||||
continue
|
continue
|
||||||
|
@ -52,19 +53,18 @@ def main(config, args):
|
||||||
exif_metadata = pyexiv2.ImageMetadata(file_path)
|
exif_metadata = pyexiv2.ImageMetadata(file_path)
|
||||||
exif_metadata.read()
|
exif_metadata.read()
|
||||||
if(config['location'] is not None):
|
if(config['location'] is not None):
|
||||||
|
if(location_coords is None):
|
||||||
location_coords = geolocation.coordinates_by_name(config['location'])
|
location_coords = geolocation.coordinates_by_name(config['location'])
|
||||||
|
|
||||||
if(location_coords is not None and 'latitude' in location_coords and 'longitude' in location_coords):
|
if(location_coords is not None and 'latitude' in location_coords and 'longitude' in location_coords):
|
||||||
print 'Queueing location to exif ...',
|
|
||||||
exif_metadata['Exif.GPSInfo.GPSLatitude'] = geolocation.decimal_to_dms(location_coords['latitude'])
|
exif_metadata['Exif.GPSInfo.GPSLatitude'] = geolocation.decimal_to_dms(location_coords['latitude'])
|
||||||
exif_metadata['Exif.GPSInfo.GPSLatitudeRef'] = pyexiv2.ExifTag('Exif.GPSInfo.GPSLatitudeRef', 'N' if location_coords['latitude'] >= 0 else 'S')
|
exif_metadata['Exif.GPSInfo.GPSLatitudeRef'] = pyexiv2.ExifTag('Exif.GPSInfo.GPSLatitudeRef', 'N' if location_coords['latitude'] >= 0 else 'S')
|
||||||
exif_metadata['Exif.GPSInfo.GPSLongitude'] = geolocation.decimal_to_dms(location_coords['longitude'])
|
exif_metadata['Exif.GPSInfo.GPSLongitude'] = geolocation.decimal_to_dms(location_coords['longitude'])
|
||||||
exif_metadata['Exif.GPSInfo.GPSLongitudeRef'] = pyexiv2.ExifTag('Exif.GPSInfo.GPSLongitudeRef', 'E' if location_coords['longitude'] >= 0 else 'W')
|
exif_metadata['Exif.GPSInfo.GPSLongitudeRef'] = pyexiv2.ExifTag('Exif.GPSInfo.GPSLongitudeRef', 'E' if location_coords['longitude'] >= 0 else 'W')
|
||||||
write = True
|
write = True
|
||||||
print 'OK'
|
|
||||||
|
|
||||||
if(config['time'] is not None):
|
if(config['time'] is not None):
|
||||||
time_string = config['time']
|
time_string = config['time']
|
||||||
print '%r' % time_string
|
|
||||||
time_format = '%Y-%m-%d %H:%M:%S'
|
time_format = '%Y-%m-%d %H:%M:%S'
|
||||||
if(re.match('^\d{4}-\d{2}-\d{2}$', time_string)):
|
if(re.match('^\d{4}-\d{2}-\d{2}$', time_string)):
|
||||||
time_string = '%s 00:00:00' % time_string
|
time_string = '%s 00:00:00' % time_string
|
||||||
|
@ -74,12 +74,9 @@ def main(config, args):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if(time_format is not None):
|
if(time_format is not None):
|
||||||
print 'Queueing time to exif ...',
|
|
||||||
exif_metadata['Exif.Photo.DateTimeOriginal'].value = datetime.strptime(time_string, time_format)
|
exif_metadata['Exif.Photo.DateTimeOriginal'].value = datetime.strptime(time_string, time_format)
|
||||||
exif_metadata['Exif.Image.DateTime'].value = datetime.strptime(time_string, time_format)
|
exif_metadata['Exif.Image.DateTime'].value = datetime.strptime(time_string, time_format)
|
||||||
print '%r' % datetime.strptime(time_string, time_format)
|
|
||||||
write = True
|
write = True
|
||||||
print 'OK'
|
|
||||||
|
|
||||||
if(write == True):
|
if(write == True):
|
||||||
exif_metadata.write()
|
exif_metadata.write()
|
||||||
|
@ -89,8 +86,7 @@ def main(config, args):
|
||||||
|
|
||||||
media = _class(file_path)
|
media = _class(file_path)
|
||||||
dest_path = filesystem.process_file(file_path, destination, media, move=True, allowDuplicate=True)
|
dest_path = filesystem.process_file(file_path, destination, media, move=True, allowDuplicate=True)
|
||||||
print '%s ...' % dest_path,
|
print '%s -> %s' % (file_path, dest_path)
|
||||||
print 'OK'
|
|
||||||
|
|
||||||
# If the folder we moved the file out of or its parent are empty we delete it.
|
# If the folder we moved the file out of or its parent are empty we delete it.
|
||||||
filesystem.delete_directory_if_empty(os.path.dirname(file_path))
|
filesystem.delete_directory_if_empty(os.path.dirname(file_path))
|
||||||
|
@ -98,7 +94,7 @@ def main(config, args):
|
||||||
|
|
||||||
db = Db()
|
db = Db()
|
||||||
filesystem = FileSystem()
|
filesystem = FileSystem()
|
||||||
args = arguments.parse(sys.argv[1:], None, ['time=','location=','process='], './adjust.py --time=<string time> --location=<string location> --process=no file1 file2...fileN')
|
args = arguments.parse(sys.argv[1:], None, ['time=','location=','process='], './update.py --time=<string time> --location=<string location> --process=no file1 file2...fileN')
|
||||||
config = parse_arguments(args)
|
config = parse_arguments(args)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
Loading…
Reference in New Issue