2023-12-26 14:48:33 +03:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M:peek()
|
2024-08-18 18:30:32 +03:00
|
|
|
local start, url = os.clock(), ya.file_cache(self)
|
2024-01-15 13:30:50 +03:00
|
|
|
if not url or not fs.cha(url) then
|
2024-01-11 20:35:57 +03:00
|
|
|
url = self.file.url
|
|
|
|
end
|
|
|
|
|
2024-08-18 18:30:32 +03:00
|
|
|
ya.sleep(math.max(0, PREVIEW.image_delay / 1000 + start - os.clock()))
|
2024-01-11 20:35:57 +03:00
|
|
|
ya.image_show(url, self.area)
|
2023-12-26 14:48:33 +03:00
|
|
|
ya.preview_widgets(self, {})
|
|
|
|
end
|
|
|
|
|
|
|
|
function M:seek() end
|
|
|
|
|
|
|
|
function M:preload()
|
2024-01-11 20:35:57 +03:00
|
|
|
local cache = ya.file_cache(self)
|
2024-01-15 13:30:50 +03:00
|
|
|
if not cache or fs.cha(cache) then
|
2023-12-26 14:48:33 +03:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
return ya.image_precache(self.file.url, cache) and 1 or 2
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|