pystardust / ytfzf

A posix script to find and watch youtube videos from the terminal. (Without API)
GNU General Public License v3.0
3.78k stars 343 forks source link

[BUG]: Search doesn't work with fzf, always prints "unknown option: {}"" #574

Closed justbispo closed 2 years ago

justbispo commented 2 years ago

Describe the bug

Since a few weeks ago, a bug happens when I try to search from the terminal. Every time I search any term, it always prints unknown option: {}". This happens with both the ytfzf and ytfzf-git packages from the AUR. But using the dmenu option (ytfzf -D) works fine.

To Reproduce

$ ytfzf
> test
Scraping YouTube (with https://invidious.weblibre.org) (test, pg: 1)
unknown option: {}"

$ ytfzf -t test
Scraping YouTube (with https://invidious.weblibre.org) (test, pg: 1)
unknown option: {}"

Expected behavior

Open fzf to allow me to pick a video.

Screenshots

test

Information

Additional context

Steps I've tried:

Euro20179 commented 2 years ago

What's your fzf version?

justbispo commented 2 years ago

It's 0.33.0 (e03ac31). By the way, I can start fzf with no issues, so I excluded fzf as the issue here.

Euro20179 commented 2 years ago

fzf is the only thing that Ive found that gives that error message, it happens when running: fzf {}

Anyway your fzf version is the same as mine.

What do you have in your config (i know you tested without it, but just in case)?

justbispo commented 2 years ago

Here's the content on the config file:

is_detach=1
ytdl_pref="bestvideo[height<=?1080]+bestaudio/best"
async_thumbnails=1
show_thumbnails=1
thumbnail_quality=maxres
thumbnail_viewer=swayimg
multi_search=1
search_region=PT
Euro20179 commented 2 years ago

Your config seems fine, I'm fairly certain the problem is with this section of the code in interface_thumbnails, but it looks perfectly fine.

jq -r '.[]|[.title,"'"$gap_space"'|"+.channel,"|"+.duration,"|"+.views,"|"+.date,"|"+.url]|join("\t")' < "$video_json_file" |
sort_video_data_fn |
SHELL="$(command -v sh)" fzf -m \
--preview "__is_fzf_preview=1 fzf_preview_side='$fzf_preview_side' scrape='$scrape' thumb_dir='$thumb_dir' YTFZF_PID='$YTFZF_PID' UEBERZUG_FIFO='$UEBERZUG_FIFO' $0 -U preview_img '$thumbnail_viewer' {} '$video_json_file'" \
--preview-window "$fzf_preview_side:50%:wrap" --layout=reverse --expect="$shortcut_binds" | set_keypress |
trim_url > "$selected_id_file"

Could you post the output of sh -x ytfzf -t search (warning that it will contain your username on your computer so if you want you can run sh -x ytfzf 2>&1 | sed "s_$HOME_~_g" instead. this will replace all instances of /home/<user> with ~)

justbispo commented 2 years ago

Here's the output of that command: https://hastebin.com/raw/xovoxusire

Euro20179 commented 2 years ago

The problem is that your exporting FZF_DEFAULT_OPTS=--no-height --layout=reverse --info=inline --preview=\"pistol {}\" --preview-window=right:50%:wrap --bind \"shift-up:preview-page-up,shift-down:preview-page-down\" somewhere, so if you put FZF_DEFAULT_OPTS='' in your config file it should work.

justbispo commented 2 years ago

Ahhh right, the problem seems to be the --preview option. Since I need those options in FZF_DEFAULT_OPTS for other stuff and it doesn't seem to change much the output of ytfzf, I'll set the var YTFZF_CHECK_VARS_EXISTS=0. Thank you for your help.