Spaces:
Sleeping
Sleeping
Commit
·
f0c65a3
1
Parent(s):
f789516
feat: ignore already existing park
Browse files- src/fetch_places.py +4 -0
src/fetch_places.py
CHANGED
|
@@ -136,6 +136,10 @@ def fetch_place_photos(place_id: str, place_name: str, photos: dict) -> int:
|
|
| 136 |
folder_path = f"images/{place_name}"
|
| 137 |
os.makedirs(folder_path, exist_ok=True)
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
park_id = park_manager.add_park(place_name)
|
| 140 |
for photo in photos:
|
| 141 |
photo_id = photo["name"].replace(f"places/{place_id}/photos/", "")
|
|
|
|
| 136 |
folder_path = f"images/{place_name}"
|
| 137 |
os.makedirs(folder_path, exist_ok=True)
|
| 138 |
|
| 139 |
+
if park_manager.get_park_id(place_name):
|
| 140 |
+
print(f"Place: {place_name} already exists")
|
| 141 |
+
return 0
|
| 142 |
+
|
| 143 |
park_id = park_manager.add_park(place_name)
|
| 144 |
for photo in photos:
|
| 145 |
photo_id = photo["name"].replace(f"places/{place_id}/photos/", "")
|