Skip to content

Commit

Permalink
fill out some ignored API funcs
Browse files Browse the repository at this point in the history
useful if using Tyler outside of Makie
  • Loading branch information
asinghvi17 committed Nov 27, 2024
1 parent e67cf5b commit f6720a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/downloader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function unique_filename(url)
return string(hash(url))
end

file_ending(provider::TileProviders.Provider) = ".some_unknown_image_format"

function download_tile_data(dl::PathDownloader, provider::AbstractProvider, url)
unique_name = unique_filename(url)
path = joinpath(dl.cache_dir, unique_name * file_ending(provider))
Expand Down
6 changes: 6 additions & 0 deletions src/tiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ function load_tile_data(::AbstractProvider, downloaded::AbstractVector{UInt8})
return FileIO.load(format) # this works because we have ImageIO loaded
end

function load_tile_data(::AbstractProvider, downloaded::String)
io = IOBuffer(read(downloaded))
format = FileIO.query(io) # this interrogates the magic bits to see what file format it is (JPEG, PNG, etc)
return FileIO.load(format) # this works because we have ImageIO loaded
end

function Base.wait(tiles::TileCache; timeout=50)
# wait for all tiles to get downloaded
items = lock(tiles.tile_queue) do
Expand Down

0 comments on commit f6720a3

Please sign in to comment.