Question: Can you provide an example that would take the code below and conform to the instructions, please? I can process a file just fine, but

Can you provide an example that would take the code below and conform to the instructions, please? I can process a file just fine, but my issue is finding a way to process zip folders.

EXIF Data Acquistion Example

''' ''' Using this script provide as a baseline.

Expand the script as follows:

1) Allow the user to enter a path to a directory containing jpeg files.

2) Using that path, process all the .jpg files contained in that folder (use the testimages.zip set of images)

3) Extract the GPS Coordinates for each jpg (if they exist) and then report the results in a prettytable like this

''' PROCESS EACH JPEG FILE SECTION '''

latLonList = [] targetFile = input("Please provide image or folder to Process: ") # file must be located in the same folder if os.path.isfile(targetFile): gpsDictionary, exifList = ExtractGPSDictionary(targetFile) if exifList: TS = exifList[0] MAKE = exifList[1] MODEL = exifList[2] else: TS = 'NA' MAKE = 'NA' MODEL = 'NA'

print("Photo Details") print("-------------") print("TimeStamp: ", TS) print("Camera Make: ", MAKE) print("Camera Model: ", MODEL)

if (gpsDictionary != None):

# Obtain the Lat Lon values from the gpsDictionary # Converted to degrees # The return value is a dictionary key value pairs

dCoor = ExtractLatLon(gpsDictionary)

print(" Geo-Location Data") print("-----------------")

if dCoor: lat = dCoor.get("Lat") latRef = dCoor.get("LatRef") lon = dCoor.get("Lon") lonRef = dCoor.get("LonRef") if ( lat and lon and latRef and lonRef): print("Lattitude: ", '{:4.4f}'.format(lat)) print("Longitude: ", '{:4.4f}'.format(lon)) else: print("WARNING No GPS EXIF Data") else: print("WARNING No GPS EXIF Data") else: print("WARNING", " not a valid file", targetFile)

# Create Result Table Display using PrettyTable ''' GENERATE RESULTS TABLE SECTION''' ''' Result Table Heading''' try: resultTable = PrettyTable(['File-Name', 'Lat','Lon', 'TimeStamp', 'Make', 'Model']) ''' Your work starts here ''' resultTable.add_row([os.path.abspath(targetFile), lat, lon, TS, MAKE, MODEL]) except Exception as error: print(error)

print(resultTable)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!