Skip to content

Commit

Permalink
Merge pull request #12 from Nautilus-Cyberneering/issue-9-remove-tif-…
Browse files Browse the repository at this point in the history
…files

Remove base images after processing
  • Loading branch information
yeraydavidrodriguez authored Nov 10, 2021
2 parents 895693e + 7373f62 commit 8ac61d4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/import-base-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ jobs:
images_path: public/images
format: jpg

- name: Remove unneeded base images
run: ./scripts/sync-base-images.sh remove_base

- name: Show added or modified Base Images
run: |
git status
Expand Down
Binary file removed public/images/000001-42.600.2.tif
Binary file not shown.
Binary file removed public/images/000002-42.600.2.tif
Binary file not shown.
Binary file removed public/images/000003-42.600.2.tif
Binary file not shown.
32 changes: 23 additions & 9 deletions scripts/sync-base-images.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
#!/bin/bash

# Find and copy Base images from data folder to public folder
# Find and copy Base images from data folder to public folder.
# If a parameter is passed, it will execute only the specified step. Else, all of them
# will be executed sequentially.

# TODO: use a domain app to extract the list of Base images. Remove magic numbers.

# Show current Base images
echo "Current Base images in website ..."
find ./public/images -type f \( -iname \*42*.tif -o -iname \*42*.tiff \)
if [[ ($1 == "") || ($1 == "show_website")]]
then
echo "Current Base images in website ..."
find ./public/images -type f \( -iname \*42*.tif -o -iname \*42*.tiff \)
fi

# Find Base images
echo "Find Base images in library ..."
find ./library/data -type f \( -iname \*42*.tif -o -iname \*42*.tiff \)
if [[ ($1 == "") || ($1 == "show_library")]]
then
echo "Find Base images in library ..."
find ./library/data -type f \( -iname \*42*.tif -o -iname \*42*.tiff \)
fi

# Remove all Base images from public folder
echo "Removing Base images from public folder ..."
find ./public/images -type f \( -iname \*42*.tif -o -iname \*42*.tiff \) -exec rm -f {} \;
if [[ ($1 == "") || ($1 == "remove_base")]]
then
echo "Removing Base images from public folder ..."
find ./public/images -type f \( -iname \*42*.tif -o -iname \*42*.tiff \) -exec rm -f {} \;
fi

# Copy all Base images from library to public folder
echo "Copying Base images to public folder ..."
find ./library/data -type f \( -iname \*42*.tif -o -iname \*42*.tiff \) -exec cp -fv {} ./public/images \;
if [[ ($1 == "") || ($1 == "copy")]]
then
echo "Copying Base images to public folder ..."
find ./library/data -type f \( -iname \*42*.tif -o -iname \*42*.tiff \) -exec cp -fv {} ./public/images \;
fi

0 comments on commit 8ac61d4

Please sign in to comment.