pystardust / ytfzf

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

[BUG]: Thumbnails not downloading #505

Closed klundry closed 2 years ago

klundry commented 2 years ago

Relevant system info: PostmarketOS (Alpine) Edge on a Pinephone ytfzf version 2.2 terminal: sakura, foot

When I launch a search it will show "Fetching thumbnails" but I don't see any download output like I do on my laptop where the thumbnails are working. I have curl so I'm not sure why it's not downloading them.

Euro20179 commented 2 years ago

What is the output of ls -l $(which sh), i'm assuming nothing is happening because it thinks that it's already downloaded the thumbnails, which should only happen if something weirdd happens in get_missing_thumbnails. But idk, it could also be because of some oddity in one of the busybox utils, assuming your distro uses busybox

klundry commented 2 years ago

/bin/busybox

I have my user's shell set to bash but I guess ytfzf is not using that?

klundry commented 2 years ago

I've changed my default shell to bash. I'm running ytfzf in a bash shell and I still get no thumbnails. Is there anything else I can try? I've also tried running "bash ytfzf" and still no thumbnails either.

Euro20179 commented 2 years ago

As most scripts do, ytfzf uses /bin/sh (or wherever your sh file is) not the user shell. Running bash ytfzf should make ytfzf use bash, changing the user shell does nothing. However at least now I know its not a problem with the shell as using bash didnt work. You could try deleting everything in ~/.cache/ytfzf. This will remove your search and watch history, unless you avoid deleting the hist files. As mentioned before it could have smth to do with busybox utils, but i need to do some testing, and reading of documentation. Do you have a config file, if so whats in it?

klundry commented 2 years ago

Deleted everything in .cache/ytfzf/ and no change.

I have a conf.sh in .config/ytfzf/ with the following contents.

show_thumbnails=1
thumbnail_viewer=chafa
video_pref="[height<=720]
klundry commented 2 years ago

When I dig into the cache folders the thumbnail folders are empty so it's definitely just that they aren't getting downloaded.

Euro20179 commented 2 years ago

Found the bug, it does have to do with busybox utils, busybox's diff outputs something slightly different by default than gnu's diff, I'll need to find a better way to get the data i need. I'll update you when this is fixed.

Euro20179 commented 2 years ago

Fixed (https://github.com/pystardust/ytfzf/commit/ad7b5a67c481a25f8a370038c6a6cdf1fab2405c)

You can run

git clone -b development https://github.com/pystardust/ytfzf
cd ytfzf
sudo make install doc

to get the latest commit.

klundry commented 2 years ago

Awesome, thanks for the quick fix!

klundry commented 2 years ago

One more question. I'm not sure why the thumbnails are so small and not using all the space they have available. Is there a way to turn off the info that displays above the thumbnail?

![Uploading 20220309_13h38m14s_grim.png…]()

Euro20179 commented 2 years ago

That image didn't load, so i'm not entirely sure about the small thumbnails.

As for disabling the info you can add

thumbnail_video_info () {
}

to your config.

Since the original problem is solved I'll be closing this, but you can continue to talk here, or make a new issue about the small thumbnails, I'll see it either way.

klundry commented 2 years ago

20220309_13h38m14s_grim

Trying this image upload again.

When I put that in my conf.sh and then run ytfzf I get a syntax error: unexpected "}"

Euro20179 commented 2 years ago

When I put that in my conf.sh and then run ytfzf I get a syntax error: unexpected "}"

Good to know busybox sh doesn't like empty {}, try using:

thumbnail_video_info () {
    :
}

I think the thumbnail is small because the height of your screen is small, but i doubt it.

get_ueberzug_positioning_left (){
    width=$(($1+16))
    height=$(($2-0))
    x=2
    y=10
}

You can add this this to your config and fiddle with how much is being added or subtracted.

klundry commented 2 years ago

Ok, thanks. No error now but the video info is still there.

With that second snippet I'm adjust the numbers but nothing is changing.

klundry commented 2 years ago

My screen is small but the chafa preview is only like half the size of the available space it has.

Euro20179 commented 2 years ago

The function should be called thumbnail_video_info_text not thumbnail_video_info oops.

The get_ueberzug_positioning_left thing isn't working because apparently I didn't let it work with chafa. I will fix this later cause i'm lazy rn.

Edit: if it's not fixed within 48 hours, feel free to ping me lol

klundry commented 2 years ago

Haha, ok thank you.

Euro20179 commented 2 years ago

Fixed (ee077a5d2550a812c8f6a25c8bc2b331fb47187c) Or at least get_ueberzug_positioning has an effect on chafa now, your small thumbnail problem will probably still persist.

klundry commented 2 years ago

That's definitely better! Even with the video info text enabled again the thumbnails are bigger.

20220309_18h52m58s_grim

Euro20179 commented 2 years ago

nice!