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 345 forks source link

Issue: Archlinux/AUR selecting a video outputs mpw help prompt #41

Closed Mithrandir2k18 closed 3 years ago

Mithrandir2k18 commented 3 years ago

I just installed ytfzf from the AUR via yay -s ytfzf.

First attempt to run it got me an error message that fzf is missing. So I installed the optional fzf and ueberzug, since thumbnails seem nice to have.

Downloading thumbnails and selecting a video via the fuzzy search and arrow keys works great, but as I hit enter I get this:

$ ytfzf -t rickroll
Downloading Thumbnails............................
mpv 0.33.0-dirty Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
FFmpeg library versions:
   libavutil       56.51.100
   libavcodec      58.91.100
   libavformat     58.45.100
   libswscale      5.7.100
   libavfilter     7.85.100
   libswresample   3.7.100
FFmpeg version: n4.3.1

Usage:   mpv [options] [url|path/]filename

Basic options:
 --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
 --no-audio        do not play sound
 --no-video        do not play video
 --fs              fullscreen playback
 --sub-file=<file> specify subtitle file to use
 --playlist=<file> specify playlist file

 --list-options    list all mpv options
 --h=<string>      print options which contain the given string in their name

I am on arch and using ytfzf from bash in xfce4-terminal emulator.

$ uname -a
Linux archws 5.11.1-arch1-1 #1 SMP PREEMPT Tue, 23 Feb 2021 14:05:30 +0000 x86_64 GNU/Linux
anoosa1 commented 3 years ago

im having the same problem any soloutions?

se7en-x230 commented 3 years ago

System: Host: pureArch Kernel: 5.11.1-zen1-1-zen x86_64 bits: 64 Desktop: dwm 6.2 Distro: Arch Linux : mpv Version : 1:0.33.0-4

same problem

Euro20179 commented 3 years ago

I'm looking at this blindly because i can't install mpv 0.33 or arch easily but try changing this line player="mpv" to player="mpv --ytdl " This could be completely useless information though.

se7en-x230 commented 3 years ago

nope... what infos would you need to find out what the problem is?

Euro20179 commented 3 years ago

nope... what infos would you need to find out what the problem is?

Quite honestly I think there is enough info I just don't know enough about this script, mpv, and arch to solve it.

se7en-x230 commented 3 years ago

Build Date : Thu 14 Jan 2021 02:05:09 PM +07 so it has not been updated lately. Most likely something to do with the last ytfzf update

Euro20179 commented 3 years ago

I'm not quite sure what you're referring to with the build date. If you're talking about this script, try downloading it from here and running it, if you're talking about mpv then i don't know.

se7en-x230 commented 3 years ago

Update date of the mpv package on arch. So as it used to work before with this version and mpv settings it is more likely something that changed in the code of the ytfzf script.

Euro20179 commented 3 years ago

I have a hunch that the scraping could have gone wrong and it's giving a blank list of urls for the urls variable so when it's used in mpv there is no input for mpv so try using this version

https://github.com/pystardust/ytfzf/tree/ca3d619167e66dac3ca01ccad62859297994212b

se7en-x230 commented 3 years ago

Yes the older version works fine

Euro20179 commented 3 years ago

ok so i managed to get a version of the bug myself and this probably will not solve the problem you have but when i put in a url as the query it had the same output, so I think i'm right about mpv receiving no input but we're getting it for 2 different reasons I fixed my issue by changing url="$1" on line 332 to urls="$1"

marcovirtual commented 3 years ago

I also installed ytfzf through the AUR and can confirm that no video plays, probably because the script is not scraping the video URL correctly.

For example, when I try to use the ytfzf -L flag (for printing the selected URL only), no output is given. Unfortunately, I'm not well versed on bash to find out what the error is by myself.

Euro20179 commented 3 years ago

probably because the script is not scraping the video URL correctly.

It's possible that changing url="$1" on line 332 to urls="$1" could fix this because url is an unused variable and when looking for a url it uses the urls variable. But I think it should only check for this if a url is given in the query so i don't know. I think that this could be worth trying but I'm looking at this blindly so yeah.

se7en-x230 commented 3 years ago

selected-21-02-27-11_40-21

Nope same

marcovirtual commented 3 years ago

It's possible that changing url="$1" on line 332 to urls="$1" could fix this because url is an unused variable

Thanks for the feedback @Euro20179 . I tried your code, but the problem persists. Still no URL is given by ytfzf. :-(

Euro20179 commented 3 years ago

ok, I don't know enough about this script or bash (mainly sed i think) to know how to fix the problem but i'm pretty sure it was caused when they commited the feature to have multi-select.

se7en-x230 commented 3 years ago

its on line 331 not 332 in my version ... Not sure if that was a typo or if that is important.

Euro20179 commented 3 years ago

its on line 331 not 332 in my version ... Not sure if that was a typo or if that is important.

on mine it's 332 but it's probably unimportant.

marcovirtual commented 3 years ago

so try using this version

https://github.com/pystardust/ytfzf/tree/ca3d619167e66dac3ca01ccad62859297994212b

Yes the older version works fine

I have also tried the older version, but it does not work for me.

se7en-x230 commented 3 years ago

so try using this version https://github.com/pystardust/ytfzf/tree/ca3d619167e66dac3ca01ccad62859297994212b

Yes the older version works fine

I have also tried the older version, but it does not work for me.

i source the script under a different name source oldytfzf -st and that works fine for me

pystardust commented 3 years ago

@se7en-x230 I have just patched the error, can you tell me if it works for you. Sorry for the inconvenience

se7en-x230 commented 3 years ago

ERROR[#03]: Couldn't play the video/audio using the current player. Try updating youtube-dl /usr/bin/o: line 279: errinfo: command not found

se7en-x230 commented 3 years ago

selected-21-02-27-12_42-30

pystardust commented 3 years ago

Its working on artix linux. I just installed an arch vm, and I get this issue. I will look into it. Thanks

pystardust commented 3 years ago

I figured out the issue, Can you guys confirm what is your /bin/sh?

ls -l /bin/sh

It must be bash instead of dash. The error comes in the echo "\n" part. I will replace it with printf

se7en-x230 commented 3 years ago

lrwxrwxrwx 4 root 21 Dec 2020  /bin/sh -> bash

pystardust commented 3 years ago

Thanks @se7en-x230, I will fix it.

echo "\n"

is different in bash from other shells like zsh or dash

pystardust commented 3 years ago

I will make sure to test it on bash from now on. Thanks @se7en-x230 I have fixed it and tested it with bash. Let me know if problem persists.

pystardust commented 3 years ago

@Mithrandir2k18 Please update ytfzf from the AUR. I have fixed the issue

se7en-x230 commented 3 years ago

Thanks for the fast fix. Works perfectly

westofer commented 3 years ago

regrading it not working from AUR due to missing fzf,

fzf is listed as an optional dependency, program can work fine if the user chooses to use dmenu/rofi instead of fzf. enforcing fzf as required isn't a good solution

An array of packages that are not needed for the software to function, but provide additional features. This may imply that not all executables provided by a package will function without the respective optdepends

source

Arch currently uses optional dependencies even when it means that executables provided by the package aren't going to work with the minimal set of dependencies. The packages could be split up more to avoid this without pulling in more stuff, but it's not what packagers usually choose to it. It's a design choice left up to the packager, not a bug.

mailing list, Daniel Micay

Same concept is applied to zathura, it doesn't work without one of its optional deps

Mithrandir2k18 commented 3 years ago

@pystardust wow that was fast :) Can confirm, works like a charm after clean-build with yay -S ytfzf!