Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak logic for TIFF dir #255

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions create_derivatives/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def get_tiff_file_paths(self, bag_path):
tiff_files (list of pathlib.Paths): absolute filepaths for TIFF files.
"""
service_dir = Path(bag_path, "data", "service")
master_dir = Path(bag_path, "data", "master")
for tiff_dir in service_dir, master_dir:
master_edited_dir = Path(bag_path, "data", "master_edited")
for tiff_dir in service_dir, master_edited_dir:
if tiff_dir.is_dir() and any(tiff_dir.iterdir()):
tiff_files_dir = tiff_dir
break
Expand Down
4 changes: 2 additions & 2 deletions create_derivatives/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ def test_tiff_file_paths(self):
for fixture_path, expected_service, expected_master in [
("unpacked_bag_with_tiff", False, False),
("unpacked_bag_with_tiff_empty_service", False, False),
("unpacked_bag_with_tiff_master", False, True),
("unpacked_bag_with_tiff_master_edited", False, True),
("unpacked_bag_with_tiff_service", True, False)]:
set_up_bag(settings.TMP_DIR, fixture_path, self.bag_id)
bag = Bag.objects.last()
tiffs = JP2Maker().get_tiff_file_paths(bag.bag_path)
for path in tiffs:
self.assertTrue("data" in str(path))
self.assertEqual("service" in str(path), expected_service)
self.assertEqual("master" in str(path), expected_master)
self.assertEqual("master_edited" in str(path), expected_master)
shutil.rmtree(bag.bag_path)

def tearDown(self):
Expand Down
Loading