mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
feat!: support passing arguments to previewer/preloader/spotter/fetcher (#1966)
This commit is contained in:
parent
37292adfde
commit
d72f90356b
55 changed files with 703 additions and 458 deletions
|
|
@ -1,20 +1,20 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek()
|
||||
local start, cache = os.clock(), ya.file_cache(self)
|
||||
if not cache or self:preload() ~= 1 then
|
||||
function M:peek(job)
|
||||
local start, cache = os.clock(), ya.file_cache(job)
|
||||
if not cache or self:preload(job) ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
ya.sleep(math.max(0, PREVIEW.image_delay / 1000 + start - os.clock()))
|
||||
ya.image_show(cache, self.area)
|
||||
ya.preview_widgets(self, {})
|
||||
ya.image_show(cache, job.area)
|
||||
ya.preview_widgets(job, {})
|
||||
end
|
||||
|
||||
function M:seek() end
|
||||
|
||||
function M:preload()
|
||||
local cache = ya.file_cache(self)
|
||||
function M:preload(job)
|
||||
local cache = ya.file_cache(job)
|
||||
if not cache or fs.cha(cache) then
|
||||
return 1
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ function M:preload()
|
|||
local status, err = Command("magick"):args({
|
||||
"-density",
|
||||
"200",
|
||||
tostring(self.file.url),
|
||||
tostring(job.file.url),
|
||||
"-flatten",
|
||||
"-resize",
|
||||
string.format("%dx%d^", PREVIEW.max_width, PREVIEW.max_height),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue