Commit 161d57fe authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

add hls_thumbnail_url to resource serializer

parent 39489b18
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -589,6 +589,15 @@ class File(Resource):
        else:
            raise NotHLS("Resource is not served via HLS")

    def hls_thumbnail_url(self) -> str:
        if self.should_have_hls:
            return "{}{}/thumbnail.jpg".format(
                settings.JAMA_HLS_ENDPOINT,
                hash_to_hls_path(self.hash),
            )
        else:
            raise NotHLS("Resource is not served via HLS")

    def local_path(self):
        return hash_to_local_path(self.hash)

+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ def file(
        tags.append(tag(tag_instance, cache=cache))
    if file_instance.should_have_hls:
        urls["hls"] = file_instance.hls_url()
        urls["hls_thumbnail"] = file_instance.hls_thumbnail_url()
    if (
        file_instance.should_have_iiif
    ):  # and iiif_file_exists(file_instance.hash): # FS is slow