2025-02-13

Will I ever blog on a regular basis?

Well, I see that there is a gap of two years since my last blog post. Not a record, but a serious lapse nonetheless.

I'm retired from active coding now, and there have been rumblings in my subconscious telling me I should be writing. At least, it gives me an answer to the "So, what have you been doing" queries from friends and relations.

Let's see how it goes.

2023-01-09

How to ask VLC what's currently playing

(Target audience: command-line fans on something Unixy, who have or will be able to find bash, vlc, curl and xmllint.)

My preferred method of music consumption is a collection-wide shuffle. My local media drive has, well, let's see...

  dad@arlo:/media/dad/brick/media/music$ find . -name "*.mp3" | wc -l
  65458

over 65 thousand tracks. (I've been collecting for a long time, all my vinyl is digitized, yada yada yada.) I have a script that creates a playlist of random selections from the collection, and then I open that playlist in VLC.

Quite often, an underappreciated track catches my ear, and I would like to add it to a favorites playlist. So I would flip over to the VLC window, right-click my way into the current selection's Information window, follow that with a mouse-select of the URI of the currently-playing mp3 and a paste into vim, where the favorites playlist is open.

This is why I hate GUIs.

Now, seriously, how un-Unix is that? What I need is a command-line utility that will just give me the currently-playing file, so that I can just append-pipe the filename into the favorites playlist.

So, how can I ask VLC to give me that?

Turns out, it's not too bad. VLC can be started with multiple live interfaces, one of which is HTTP. This gives us a web-based interface that can be opened in a browser, but more importantly for the task at hand, it gives us a REST API into the running VLC. And that REST API will give us an XML document describing the current playlist, including which track is currently playing.

One weird bit to note - the HTTP interface won't work unless you set a password to access it. Okay, that's not so weird, except that you don't (you cannot) set a user name, so the user name is (must be) the empty string.

The good news is that cURL handles empty-string user names just fine, by passing just a colon and password to the -u argument. Like so:


  # /bin/bash
  # get current playing by file name

  curl -u :myterriblepassword http://127.0.0.1:8080/requests/playlist.xml 2>/dev/null \
  | xmllint --xpath 'string(//leaf[@current="current"]/@uri)' - \
  >>favorites.m3u

That's it. Feel free to improve on this in the comments.

2022-12-04

Testing 28, 29, 30

I think I've found the issue. If you're seeing this on fosstodon.org, yay! @davew@mastodon.social #feedToMasto

Testing 25, 26, 27

Typo in my config.json. @davew@mastodon.social #feedToMasto

Testing 22, 23, 24

I've switched to my other mastodon instance. Let's see. @davew@mastodon.social #feedToMasto

Testing 19, 20, 21

Dave has made a change, we're at 0.4.4. @davew@mastodon.social #feedToMasto

2022-12-03

Testing 16, 17, 18

Again. @davew@mastodon.social #feedToMasto

Testing 13, 14, 15

Somewhere, we're not getting JSON. @davew@mastodon.social @feedToMasto

Testing 10, 11, 12

Once more @davew@mastodon.social #feedToMasto

Testing 7, 8, 9

More testing of #feedToMasto @davew@mastodon.social added redirect following, so we try again.

2022-12-02

Testin 4, 5, 6

This may get repetitive.

Testing 1, 2, 3

This post is starting in bjimba.blogspot.com, which is currently being watched by DaveW's feedToMasto. @davew@mastodon.social #feedToMasto Let's see where it ends up.

2022-11-30

Photo o' the day, pt 4

Hacklebarney park road, Chester NJ

2022-11-17

Photo o' the day, episode 3

Still using Google as photo transport. Why not?

Debugging blogger

Something wrong here. I recently posted a couple of photos, and they don't show up in my feed readers. This post is purely to see if my feed readers are getting *any* updates.

2022-11-15

Photography blogging

Once my workday ends, and the MacBook relinquishes control of the starboard monitor, the ambient Chromecast slide show takes over and begins pulling from my ever-expanding online photo cache, of my own creation. A dedicated camera. A Nikon. Occasionally, one catches my eye as I hack away on the Ubuntu box on the port monitor, and I toss it into the "to be published" folder.

I should start publishing them.

Hey, this is my blog, isn't it?

2022-11-04

Hey! This blog has RSS!

Elon Musk has started an interesting chain reaction.

The Flight from Twittr (ah, remember those days, when the missing vowel was endearing) has led directly to the "alternatives-to" sections of websites filling to the brims with recommended replacements.

Early betting gives the Mastodon collective a decided edge, as it gives us a moment to step back and reconsider what a social network should be, could be, will be.

I just posted to Facebook and tweeted my Tweet with my latest nom-de-cyberverse: @jimrussell@mastodon.online

Mastodon reminds me of ILink, which was a collective of BBS's sending each other QWK packets. No one BBS owned the whole lot, but everybody had the whole lot.

Let's do this with Mastodon. This could work.

2022-04-19

First post of the Twenties

Every couple of years, I remember that I have this blog. Usually, it's when I'm working on my frivolous websites and I notice the link to here. This inspires me to add a post lamenting the fact that I never blog.

2017-09-13

Coming back to an abandoned blog

I really should be using this site. But for years, I haven't. More immediate methods of communication have take precedence. Facebook, mostly. But that's not a good fit for sharing things like a good Python hack. So I'm going to make an attempt to rouse this blog from its slumber. We'll see how that goes.