Skip to content

Commit

Permalink
imgur works + create image errors txt
Browse files Browse the repository at this point in the history
  • Loading branch information
00magikarp committed Jul 24, 2024
1 parent 5813db7 commit 5908ee0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
18 changes: 12 additions & 6 deletions scoutingapp/src/getImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def main(teams: tuple[int] = ()) -> None:
failed_teams = {}
for team in teams:
print(f'{team}: Starting...')
time.sleep(1)
time.sleep(0.5)

try:
url = scrape_robot_image(team)
Expand All @@ -119,8 +119,8 @@ def main(teams: tuple[int] = ()) -> None:
failed_teams[team] = "Failed to retrieve image link."
continue
if "imgur" not in url:
print(f"{team}: Image not found.")
failed_teams[team] = "Image not found."
print(f"{team}: Image is not imgur.")
failed_teams[team] = "Image is not imgur."
continue

download_image(team, url)
Expand All @@ -132,9 +132,15 @@ def main(teams: tuple[int] = ()) -> None:
print(f"{team}: {e}")
failed_teams[team] = e

if failed_teams:
print("NOTE: Some teams did not run properly.")
print(*failed_teams.items(), sep="\n")
if not failed_teams:
return

print("NOTE: Some teams did not run properly.")
print(*failed_teams.items(), sep="\n")

with open("image_errors.txt", 'w') as err_file:
for fail in failed_teams.items():
err_file.write(str(fail) + "\n")


if __name__ == '__main__':
Expand Down
18 changes: 18 additions & 0 deletions scoutingapp/src/image_errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(365, 'Image is not imgur.')
(1014, 'Image not found.')
(1279, 'Image is not imgur.')
(1622, 'Image not found.')
(2472, 'Image is not imgur.')
(2485, 'Image not found.')
(3654, 'Image is not imgur.')
(4159, 'Image not found.')
(5002, 'Image is not imgur.')
(5987, 'Image is not imgur.')
(6988, 'Image not found.')
(7848, 'Image not found.')
(8513, 'Image not found.')
(8727, 'Image is not imgur.')
(9008, 'Image not found.')
(9416, 'Image not found.')
(9564, 'Image is not imgur.')
(9787, 'Image not found.')

0 comments on commit 5908ee0

Please sign in to comment.