Skip to content

Commit

Permalink
Add '/400/' to '/full/' replacement for plane_images.csv (#376)
Browse files Browse the repository at this point in the history
* Add 400 to full replacement for plane_images.csv

* black format
  • Loading branch information
Phaeton authored Oct 31, 2023
1 parent ee5c009 commit ee17c7c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/create_db_derivatives.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Update README.md to include changes
run: python ./scripts/update_readme.py

- name: Update '/400/' paths to '/full/'
run: python ./scripts/update_image_links.py

- name: Commit derivative CSV files
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
19 changes: 19 additions & 0 deletions scripts/update_image_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import logging

logging.basicConfig(
format="%(asctime)s %(levelname)-8s [%(name)s] %(message)s", level=logging.INFO
)

search_text = "https://cdn.jetphotos.com/400/"
replace_text = "https://cdn.jetphotos.com/full/"

logging.info("Reading 'plane_images.csv'.")
with open(r"plane_images.csv", "r") as images:
data = images.read()
data = data.replace(search_text, replace_text)

logging.info("Replace '/400/' paths with '/full/'.")
with open(r"plane_images.csv", "w") as images:
images.write(data)

logging.info("Update image links complete.")

0 comments on commit ee17c7c

Please sign in to comment.