trizen / pipe-viewer

A lightweight YouTube client for Linux, without requiring an API key.
Artistic License 2.0
399 stars 19 forks source link

[BUG] Pressing `s` gives `Error writing screenshot` if long filename. #146

Open zenny opened 1 year ago

zenny commented 1 year ago

Hi,

Context:

  1. mpv has been assigned as a backend to pipe-viewer in `~/.config/pipe-viewer/pipe-viewer.conf

    video_player_selected         => "mpv",
    video_players                 => {
                                     mpv => {
                                              arg => "--really-quiet --force-media-title=*TITLE* --no-ytdl --vo=gpu --hwdec=cuda",
                                              audio => "--audio-file=*AUDIO*",
                                              cmd => "/usr/bin/mpv",
                                              fs => "--fullscreen",
                                              novideo => "--no-video",
                                              srt => "--sub-file=*SUB*",
                                            },
  2. When mpv is configured to grasp screenshot to the $PWD plays well with pipe-viewer

  3. When mpv is asked to save the screenshot to a specific location in ~/.config/mpv/mpv.conf

screenshot-template="~/Pictures/screenshots/mpv/%F/%p__%tm-%tY"

local utils = require("mp.utils")
local basedir = mp.get_property("options/screenshot-directory")
mp.register_event("file-loaded", function()
    local filedir = mp.get_property("filename/no-ext")
    local dir = utils.join_path(basedir, filedir)
    mp.set_property("options/screenshot-directory", dir)
end)

mpv standalone (outside `pipe-viewer) captures the screenshot as desired in the relevant folder specified above.**

But pipe-viewer fails to screenshot with Error writing screenshot! when pressed s!

Any idea? Thanks!

zenny commented 1 year ago

The pipe-viewer version is latest from master.

$ ./pipe-viewer --version
CLI Pipe Viewer 0.4.7

This issue appears to be with pipe-viewer unable to pipe the long filenames, but NOT with the mpv (unlike https://github.com/smplayer-dev/smplayer/discussions/569#discussioncomment-3994085).

The reason is:

screenshot-template="%F - [%P]v%#01n"

reports Error writing screenshot! with pipe-viewer, but goes well with mpv standalone whereas

screenshot-template="screenshot_%n_%p_%02n"

produces the screenshot without any error when pressed s in pipe viewer.

Any clue appreciated! Thanks.

zenny commented 1 year ago

Hi @trizen

Taking screenshot with long filenames in pipe-viewer have become a hurdle despite the fact that it goes well with standalone mpv. Wish someone look into this outstanding bug that remained unsolved for a long time.

Thanks again, and Cheers