| 185 | fp.close() |
| 186 | |
| 187 | def exifInfo(self, fileName): |
| 188 | os.chdir(self.dirName) |
| 189 | if not(self.exifFlag): |
| 190 | return "" |
| 191 | import exif |
| 192 | file = open(fileName,"rb") |
| 193 | data = exif.process_file(file) |
| 194 | if not data: |
| 195 | return "No EXIF Information available." |
| 196 | x = data.keys() |
| 197 | x.sort() |
| 198 | count = 0 |
| 199 | vals = [0,4,9,11,12,15,17,18,22,25,38,39,41,43,45] |
| 200 | """ |
| 201 | 0 - ApertureValue |
| 202 | 4 - DateTimeDigitized |
| 203 | 9 - ExposureBiasValue |
| 204 | 11 - ExposureProgram |
| 205 | 12 - ExposureTime |
| 206 | 15 - Flash |
| 207 | 17 - FocalLength |
| 208 | 18 - ISOSpeedRatings |
| 209 | 22 - MeteringMode |
| 210 | 25 - ShutterSpeedValue |
| 211 | 38 - Image Make |
| 212 | 39 - Image Model |
| 213 | 41 - Image ResolutionUnit |
| 214 | 43 - Image XResolution |
| 215 | 45 - Image YResolution |
| 216 | """ |
| 217 | retVal = [] |
| 218 | for i in x: |
| 219 | if count in vals: |
| 220 | #print 'error', i, '"', data[i], '"' |
| 221 | retVal.append(data[i]) |
| 222 | count = count + 1 |
| 223 | retValStr = [] |
| 224 | for i in retVal: |
| 225 | retValStr.append(i.__str__()) |
| 226 | date = retValStr[1] |
| 227 | date = date.split(" ") |
| 228 | time = date[1] |
| 229 | date = date[0] |
| 230 | year = date.split(":")[0] |
| 231 | month = int(date.split(":")[1]) |
| 232 | day = date.split(":")[2] |
| 233 | hr = int(time.split(":")[0]) |
| 234 | min = time.split(":")[1] |
| 235 | am_pm = "AM" |
| 236 | if hr >= 12: |
| 237 | am_pm = "PM" |
| 238 | if hr > 12: |
| 239 | hr = hr - 12 |
| 240 | hr = str(hr) |
| 241 | monthArr = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] |
| 242 | date = monthArr[month - 1] + " " + day + ", " + year |
| 243 | time = hr + ":" + min + " " + am_pm |
| 244 | out = """<table align="center" cellpadding="8" cellspacing="0" border="1" style="border: 1; text-align: center; margin-top: 20px;"> |