diff --git a/.github/workflows/create_db_derivatives.yaml b/.github/workflows/create_db_derivatives.yaml index 040c1f32..67d5a41e 100644 --- a/.github/workflows/create_db_derivatives.yaml +++ b/.github/workflows/create_db_derivatives.yaml @@ -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: diff --git a/scripts/update_image_links.py b/scripts/update_image_links.py new file mode 100644 index 00000000..52d5d8af --- /dev/null +++ b/scripts/update_image_links.py @@ -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.")