Terminal Treasures. Episode 2. + How to install WSL2

in Project HOPE4 years ago

image.png

Today in Terminal Treasures we'll explore an app that complements spotify-tui which I have presented in the last episode. If you remember, the terminal app which brought Spotify to our terminals had no support for podcasts, that's why in today's episode I bring you castero, the app that brings podcasts to your terminal.

As you know I've been working on a Windows machine for the past couple of weeks and, while not necessarily the only thing I'm looking for, Windows compatibility is always a plus. Unfortunately, castero is not compatible with Windows since it uses the curses python library. There are ways that you can substitute that, but I wouldn't consider that compatibility, it's more patchwork than an actual solution.

WSL to the rescue

WSL(Windows Subsystem for Linux) which is actually a Linux subsystem for Windows, is Microsoft's solution at bridging the two worlds. In its newest implementation which is WSL2, Microsoft uses an actual Linux kernel without relying on virtualizing the system calls. That's cool and all, but here comes the catch. WSL is available on Windows 10 Pro only. While I have a Pro license because I am PRO, I realize that most PCs out there come preinstalled with the Home version, or even worse... the locked down N versions. 😖

For those of you that are lucky enough to have a Windows 10 Pro or a Linux system let's go ahead and explore what castero has to offer.

Install WSL2 for Windows folks

For those of us stuck with Windows, let's see how we can enable the WSL and upgrade it to the newest version. Sure, we can go in the GUI and check some boxes while trying to figure out if we got all the right components installed, or we can follow the official tutorial posted by Microsoft here: https://docs.microsoft.com/en-us/windows/wsl/install-win10 and drop to the terminal to do all this work in a couple of commands.

1. Installing the WSL

sudo dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

image.png

Wait a minute bruh! Those 'sudo' Linux shenanigans ain't working on Windows!

Yeah well, I and my buddy Scoop here beg to differ, homie. You see? sudo is just one scoop install sudo away for those of you that followed my post where I talked about Scoop. If you didn't see the post, don't worry, here it is https://hive.blog/hive-175254/@alexbalan/linux-grandmaster-switches-to-windows still fresh and all.

I guess you can always do a 'Right Click' followed by 'Open as Administrator', but are you lame? Of course not, you're reading me, you can't be lame.

We'll also want to quickly enable another feature, Virtual Machine Platform:

sudo dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

image.png

2. Upgrade to WSL2

Why should you upgrade?
.
.
.
Because 2 is better than 1.

image.png

To do that, we must first download and install the Linux kernel update from here: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

Don't worry, this is definitely_not_virus.exe 👌

After you installed the kernel update, you can go ahead and set wsl2 as your preferred version:

sudo wsl --set-default-version 2

3. Install a Linux distro from the Microsoft Store.

Install a what from where?

Yeah, that's no typo. Open the shopping bag icon with the Microsoft logo on it that nobody uses and search for Ubuntu for example:

image.png

After that installs, open the Ubuntu app either from the start menu and set a new username and password for your Linux system.

Finally Castero

Phew, this article turned into a How to install WSL2, but it's not my fault Windows is incompatible with cool terminal programs. Before getting into the dirty stuff you might want to update your system first, that's for both Linux and WSL users:

sudo apt update && sudo apt upgrade

Castero is a python application so even tough the python3 package comes preinstalled on the latest Ubuntu LTS (20.04) flavors, the pip package does not so we'll grab it quickly with: sudo apt install python3-pip.

Installing Castero becomes a breeze right now (well for Linux users it was always a breeze) and in just one command we can pull all the libraries and Castero itself: sudo pip3 install castero.

Typing castero will start the program:

image.png

Not very impressing by default huh? Let's see what this little beast is capable of, shall we? Pressing h will reveal a menu full of shortcuts that you can use to navigate Castero.

image.png

And how do I listen to podcasts?

Ah yes, Timmy, great question!

To listen to a podcast you must have to add its RSS feed first.

RSS feeds? Brrrr Brrrrr. It's the 90s they want their tech back!

Yeah, well laugh all you want but as I see it you have 3 options.

  1. You use iTunes if you're on Windows, but I wouldn't count on Apple to be free of censorship forever. Plus this is not a solution for the Linux users.
  2. You can use Spotify and the likes but your podcasts get censored (see Joe Rogan's podcast).
  3. You can use Castero and keep a file with RSS Feeds like a swole dodge.

image.png

To add a new feed to your Castero you have to go to the site of the podcast that you want to listen to and look for the RSS feed button. For example, we'll look at The NoSleep Podcast, one of my favorite podcasts:

image.png

Sorry for the scare 😅.

Anyway, you can just save the link from the RSS feed and then back in Castero, press a to add a new podcast feed.

image.png

You can move between columns with the arrow keys and you can select an episode to play using the Enter key.

But this doesn't work on my Windows machine 😞!

And here we are at the end of the episode and this program does not work on Windows because WSL can't play audio to your speakers. I've testes the program in a VM and Linux users have nothing to fear, castero is not the culprit. The point of this episode was to show you why this series won't probably be compatible with Windows anytime soon and why I'll run everything in a VM from now on.

I've tried, but Windows just isn't fit for the terminal world!

Ending thoughts:

Castero is a simple but powerful program that you can use to manage your podcast feeds more minimally. There isn't much to it and I feel that's its greatest asset actually.

I hope you enjoyed today's terminal treasure and futile attempt at running it on Windows. Even if you're a Windows user, I think there's still something to learn from this article if you look at it with the right mindset... and tilt your head a little... and maybe close your eyes and imagine it was about something else 😂. See you next time, from my Linux VM.

P.S. I started doing video content over on lbry/odysee. The quality is pretty bad, and I'm not talking about the mic, but maybe one day I'll learn to talk properly: https://odysee.com/@pr0gramfailur3:5.