💾 Archived View for gemini.cyberbot.space › gemlog › 2023-03-28-podcasttui.gmi captured on 2023-06-14 at 14:06:52. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

-=-=-=-=-=-=-

Making a Simple Podcast TUI with MPV, FZF and Podget

2023-03-28

If you've read any of my glog posts about my Pinephone you may remember that I have a custom terminal interface that consists of various command line programs and scripts that do all the common things I typically do on the Pinephone. A podcast client is one thing that I hadn't totally settled on a solution for yet. I was using Castero, which is quite nice, but wanted something simpler that just downloaded all the new episodes at once.

Over the last few weeks I was mulling and searching for an easy way to make a simple terminal file select menu to launch my podcasts but I hadn't found anything that was quite what I had in mind. Then ~lettuce goes and posts a great little thing on using fzf to make simple little terminal menus and it gave me an idea. Fzf is already installed because it is a depency of ytfzf, the youtube/peertube TUI program I already use. So thanks lettuce for that inspiration.

Lettuce's fzf tui post

Bubble Gum and Shoestring TUI Podcast Client

If you don't know already I am NOT a programmer but given enough time and coffee I can eventually bash(pun intended) some tools together into something useful to me. Podget is a lightweight podcast download tool that I'm using to grab the files. Fzf is a fuzzy searching command line program that is displaying all the audio files and allowing me to search, select and open one. Mpv is doing the playback and I smooshed them all together in a basic shell script for convenience.

Podget

https://github.com/junegunn/fzf

https://mpv.io/

The Script

#!/bin/bash

read -r -p "Download new episodes? (y/N) " input
if [[ "$input" =~ ^([yY][eE][sS]|[yY])$ ]]
then
    podget && fzf --bind 'enter:execute(mpv --audio-display=no {})'

else
    fzf --bind 'enter:execute(mpv --no-video {})'
fi

The "read" line asks if I want to check the feeds for new episodes and download. The "if" line checks whether you answer yes to the question, running the podget command before the fzf command if you do and skipping to the "else" line if you don't and just executing the fzf command. The mpv command in the parentheses tells it to run in the command line only if it is an audio file. MPV has a nice cli mode that gives you some basic information about the audio file and a little ascii progress bar. Additionally, you can also enable resuming a podcast wherever you left off if you exit mpv by putting "save-position-on-quit" in your mpv.conf file. Exiting mpv will drop you back to fzf where you can choose another podcast or exit the script with ESC or Ctrl-c.

Note: I am specifying bash in my script because it doesn't work with the default busybox shell that postmarketOS/alpine uses when using /bin/sh.

The End

It's nothing special but it does what I want it to do and it's simple. I like being able to download all the new episodes at once so I can listen to them offline. Using simple tools together like this is fun and is probably much less likely to break or change in a way I don't want it to in the future. Does it have any fancy descriptions or episode notes? No, but I rarely every read those anyway and I can always go look them up on the off chance I think there's something there I want to read. But it has the key features that I want for listening to podcasts: download for offline playback, resumes where I left off, lightweight terminal interface, simplicity.

back to gemlog index