From 378a467f65a682f9ec2fe1d31181c4665afaa4e4 Mon Sep 17 00:00:00 2001 From: nxshock Date: Sun, 9 Apr 2023 19:54:01 +0500 Subject: [PATCH 1/2] Fix ffmpeg cmd line --- preview.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/preview.go b/preview.go index 63548e0..5a5df6b 100644 --- a/preview.go +++ b/preview.go @@ -60,11 +60,11 @@ func (pc *PreviewCache) Add(filePath string) ([]byte, error) { "-f", "avif", tempFileName) } else { - cmd = exec.Command("ffmpeg.exe", + cmd = exec.Command("ffmpeg", "-i", filepath.FromSlash(filePath), "-vf", "scale=240:240:force_original_aspect_ratio=increase,crop=240:240:exact=1", "-frames:v", "1", - "-crf", "40", + "-crf", strconv.FormatUint(config.Crf, 10), "-f", "avif", tempFileName) } From 41d00de7b785e7a251fea3d03e4345352b9320e0 Mon Sep 17 00:00:00 2001 From: nxshock Date: Sun, 9 Apr 2023 21:48:40 +0500 Subject: [PATCH 2/2] Fix links to files and preview images --- handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers.go b/handlers.go index 4e08d9d..9d111ad 100644 --- a/handlers.go +++ b/handlers.go @@ -15,7 +15,7 @@ func getResponse(path string) ([]Item, error) { } for i := range fileNames { - fileNames[i] = strings.TrimPrefix(filepath.ToSlash(fileNames[i]), filepath.ToSlash(config.WorkingDirectory)) + fileNames[i] = strings.TrimPrefix(filepath.ToSlash(fileNames[i]), filepath.ToSlash(config.WorkingDirectory))[1:] // TODO: check is first slash properly removed } items := make([]Item, 0)