| @@ 180-194 (lines=15) @@ | ||
| 177 | result.write() |
|
| 178 | ||
| 179 | ||
| 180 | def update_location(media, file_path, location_name): |
|
| 181 | """Update location exif metadata of media. |
|
| 182 | """ |
|
| 183 | location_coords = geolocation.coordinates_by_name(location_name) |
|
| 184 | ||
| 185 | if location_coords and 'latitude' in location_coords and \ |
|
| 186 | 'longitude' in location_coords: |
|
| 187 | location_status = media.set_location(location_coords[ |
|
| 188 | 'latitude'], location_coords['longitude']) |
|
| 189 | if not location_status: |
|
| 190 | log.error('Failed to update location') |
|
| 191 | log.all(('{"source":"%s",' % file_path, |
|
| 192 | '"error_msg":"Failed to update location"}')) |
|
| 193 | sys.exit(1) |
|
| 194 | return True |
|
| 195 | ||
| 196 | ||
| 197 | def update_time(media, file_path, time_string): |
|
| @@ 180-194 (lines=15) @@ | ||
| 177 | result.write() |
|
| 178 | ||
| 179 | ||
| 180 | def update_location(media, file_path, location_name): |
|
| 181 | """Update location exif metadata of media. |
|
| 182 | """ |
|
| 183 | location_coords = geolocation.coordinates_by_name(location_name) |
|
| 184 | ||
| 185 | if location_coords and 'latitude' in location_coords and \ |
|
| 186 | 'longitude' in location_coords: |
|
| 187 | location_status = media.set_location(location_coords[ |
|
| 188 | 'latitude'], location_coords['longitude']) |
|
| 189 | if not location_status: |
|
| 190 | log.error('Failed to update location') |
|
| 191 | log.all(('{"source":"%s",' % file_path, |
|
| 192 | '"error_msg":"Failed to update location"}')) |
|
| 193 | sys.exit(1) |
|
| 194 | return True |
|
| 195 | ||
| 196 | ||
| 197 | def update_time(media, file_path, time_string): |
|