DEV Community

Cover image for Tech Meets Tunes: Creating a Seamless Alfred Workflow for EDM Aficionados
MoniqueLive
MoniqueLive

Posted on

Tech Meets Tunes: Creating a Seamless Alfred Workflow for EDM Aficionados

The Problem

If you're a EDM fan like me you probably know the super traditional website Digitally Imported.

I'm a long time supporter (and I recommend you consider supporting it - streaming bills ain't cheap ya know). But one thing bugged me for a long time: it has no native player like Spotify and Apple Music. And I like changing stations all day long. And I don't like keeping a browser tab exclusively for this.

Since I'm a heavy Alfred user I looked for a workflow but had no luck. So I made one.

The Solution

The workflow editor is pretty neat. You drop boxes and link them in order to make one box's output become the other's input:

My Alfred's Workflow panel
My Alfred's Workflow panel

And that's it. Just two boxes linked in order to play some electronic music ❤️

But wait, there's more!

It would be a very boring article if it ended here, right? 😊
First of all, the list of radio stations is huge! (99):

double clicking on List Filter
double clicking on List Filter

I would never type 99 times each station information... No... I asked our friendly overlord GPT-4 for some help.

Chat GPT to the rescue

All I had was the 99 url slugs for each radio station. When you open a playlist (.pls file) you'll get all the streaming url's in the form:

http://prem1.di.fm/${query}?XXXXXX

Where ${query} is the station name and XXXX is your 'Listen key' that can be grabbed on the Settings page.

But in order to fill the workflow's List Filter I needed a .csv file with 3 columns:

  1. First some words, separated by space, which are searched after you type your workflow's keyword
  2. A plain text english description that will be shown as a subtitle
  3. The value that will be passed as the input for the next node on the graph

So the prompt I wrote was basically:

Given the following slugs:

- 00sclubhits
- ambient
- atmosphericbreaks
... (until 99)

Create a three column CSV formatted list of:

- the slug broken in words
- a plain english description of the slug
- the slug unchanged

For example:

- 00sclubhits

in CSV:

00s club hits, 2000's Club Hits, 00sclubhits
Enter fullscreen mode Exit fullscreen mode

And it very kindly generated this csv file. ❤️ (full disclosure: I removed the header line and removed extra spaces between columns that confused Alfred)

Then I dragged the generated .csv file into the left column of the List Filter and that was it for this node.

The second node is super simple. It's a Run Script node with the following:

Open Apple Music with the following url
Open Apple Music with the following url

You can use your preferred player here. I tested with VLC and Apple Music.

And that's it!

Now you have a personalized station picker:

All the vocal stations
All the vocal stations

I hope you enjoyed reading this as much as I enjoyed putting this together.

Have a good one!

Top comments (0)