Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efb980d

Browse files
authored
Merge pull request mxrch#89 from hmikihth/master
Some bugfix
2 parents c812934 + d237c4c commit efb980d

4 files changed

Lines changed: 28 additions & 11 deletions

File tree

check_and_gen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
import json
24
from os.path import isfile
35
from pathlib import Path

hunt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
import json
24
import sys
35
import os

lib/metadata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ def get_GPS(self, img):
5858
return ""
5959

6060
def feed(self, img):
61-
if img.getexif():
61+
try:
62+
img._getexif()
63+
except:
64+
try:
65+
img._getexif = img.getexif
66+
except:
67+
img._getexif = lambda d={}:d
68+
if img._getexif():
6269
location = self.get_GPS(img)
6370
exif = {ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS}
6471
interesting_fields = ["Make", "Model", "DateTime", "Software"]

lib/photos.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,25 @@ def gpics(gaiaID, client, cookies, headers, regex_albums, regex_photos, headless
124124
album_length = int(album[2])
125125

126126
if album_length >= 1:
127-
req = client.get(album_link)
128-
source = req.text.replace('\n', '')
129-
results_pics = re.compile(regex_photos).findall(source)
130-
for pic in results_pics:
131-
pic_name = pic[1]
132-
pic_link = pic[0]
133-
pics.append(pic_link)
127+
try:
128+
req = client.get(album_link)
129+
source = req.text.replace('\n', '')
130+
results_pics = re.compile(regex_photos).findall(source)
131+
for pic in results_pics:
132+
pic_name = pic[1]
133+
pic_link = pic[0]
134+
pics.append(pic_link)
135+
except:
136+
pass
134137

135138
print(f"=> {list_albums_length} albums{', ' + str(len(pics)) + ' photos' if list_albums_length else ''}")
136139
for pic in pics:
137-
req = client.get(pic)
138-
img = Image.open(BytesIO(req.content))
139-
exifeater.feed(img)
140+
try:
141+
req = client.get(pic)
142+
img = Image.open(BytesIO(req.content))
143+
exifeater.feed(img)
144+
except:
145+
pass
140146

141147
print("\nSearching metadata...")
142148
exifeater.output()

0 commit comments

Comments
 (0)