Skip to content

Commit

Permalink
Merge pull request #51 from bioimage-io/abs_covers
Browse files Browse the repository at this point in the history
resolve thumbnail sources
  • Loading branch information
FynnBe authored Apr 23, 2024
2 parents 172e12a + 0dcbe5b commit 1a751dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bioimageio_collection_backoffice/generate_collection_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def maybe_swap_with_thumbnail(

if isinstance(src, str):
clean_name = Path(src).name # remove any leading './'
return thumbnails.get(clean_name, src)
if clean_name in thumbnails:
return p.get_file_url(thumbnails[clean_name])
else:
return src

return src

Expand Down
3 changes: 3 additions & 0 deletions bioimageio_collection_backoffice/remote_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ def get_uploader(self):

return Uploader(email=email, name=name)

def get_file_url(self, path: str):
return self.client.get_file_url(f"{self.folder}files/{path}")

def get_file_urls(self):
return self.client.get_file_urls(f"{self.folder}files/")

Expand Down

0 comments on commit 1a751dc

Please sign in to comment.