woefe / ytcc

Command line tool to keep track of your favorite playlists on YouTube and many other places.
GNU General Public License v3.0
178 stars 20 forks source link

Thumbnails #96

Closed frediz closed 2 years ago

frediz commented 2 years ago

Hi dear awesome ytcc author, I like ytcc for what it is, that is browsing the YT channels I follow in a distraction free environment like CLI. At the same time, I like seeing the thumbnail of the videos, which also provide informations on the videos. Modern terminals provide the possibility to display pictures in them, such as kitty which I use. I use and love your fzf wrapper to ytcc and it came to my mind the idea to display the video thumbnails next to the description. I could do this by modifying the --preview command in ytccf.sh, putting the url of the channel in the displayed table, and getting the thumbnail url by running youtube-dl --list-thumbnails on the channel URL, which works but looks like a hack and is slow. Then that thumbnail url is given to the utility displaying it in the terminal (in my case kitty icat)

Questions:

  1. Is that a feature you would be seeing in ytcc ?
  2. If so, I guess, the best way to do it, would be to store the thumbnail url at videos update time to give to the display utility, avoiding successive http fetching as I currently do (saving one actually). Not sure channel updates would get slower, if youtube API allows to fetch several details at once.
  3. Storing locally the thumbnails would be faster at video list browsing time but I feel that it would overload ytcc because of image storing/cache/even more code/whatever.

Thanks for reading F.

woefe commented 2 years ago

Love the idea! It is possible to get the thumbnail URL without sacrificing performance. The thumbnails URLs were already fetched in youtube_dl, but not saved in ytcc's database. I have added support for the thumbnail_url in ytcc and changed the ytccf.sh script to display thumbnails with ueberzug. The thumbnails are fetched with each fzf preview, which is kind of slow. I'll see what I can do to add a simple thumbnail cache. The changes are on the thumbnails branch.

frediz commented 2 years ago

Awesome work woefe! Faaast coding. Just tested your thumbnails and it works like a charm. Super fast. One thing is that ueberzug displays the image at the window level, meaning that with my embedded tabs in kitty terminal, image remains on all the tabs I can switch to. Maybe that's the same issue with [u]rxvt's tabs. Anyway I sent you a pull request (#98 ) in your thumbnails branch for this and to adapt to kitty as well, with its own command. And also for those who can't or don't want the thumbnails, I added a switch. The design should make other implementations possible and I hope it's readable.

Thanks! F.