Streaming bookmarks made easy in Linux

I enjoy listening to audio streams. I can enjoy stations from cities where I once lived, from places I've visited, or just exotic locales I'll likely never visit. I could never come up with a good way to manage my streaming bookmarks. Perl came to the rescue. Using a single Perl script I store my favorite stations and can generate two tools.

The first tool creates Linux (Cinnamon) menu shortcuts for my stations. It also creates a file I can use with my simple URL shortener.

Check out my Perl script below.

#!/usr/bin/env perl

# This Perl script take a list of streaming URLS and does two things with it.
#   1. Creates Linux menu items for each station.
#   2. Creates a file that can be used with an Apache URL shortener.
# This is intended to be used with Linux. I suppose it could be modified to work with Windows and/or macOS.
# It assumes ~/.local/share/applications/streaming exists. nvlc must me installed. You can use a different
# player, be sure to modify the script to reflect this.
# To use add your favorite stations to the bottom of the script, run, and if nothing happens that's probably
# good news, it worked. Using Cinnamon (possibly other desktops) press the super key and then enter a station
# you want to play and you should hear something.

sub linuxMenu() {
    $desktopPath = $_[0];
    $desktopName = $_[1];
    $desktopUrl = $_[2];
    $desktopIcon = ($_[3] eq "") ? "streaming.png" : $_[3];

    unlink "${desktopPath}/*.desktop";

    open (MENU, ">", ${filename});
    print MENU "[Desktop Entry]\n";
    print MENU "Type=Application\n";
    print MENU "Name=${desktopName}\n";
    print MENU "Comment=${desktopName} streaming\n";
    print MENU "Exec=nvlc \"${desktopUrl}\"\n";
    print MENU "Terminal=true\n";
    print MENU "Icon=/home/jcm/.local/share/icons/${desktopIcon}\n";
    close (MENU);

# This feeds my Apache URL shortener.

sub apacheAliases() {
    $apacheFile = $_[0];
    $apacheNickname = $_[1];
    $apacheUrl = $_[2];

    open (APACHE, ">>", "${apacheFile}");
    if ($apacheNickname ne "") {
        print APACHE "s/${apacheNickname} ${apacheUrl}\n";
    close (APACHE);

foreach (sort(<DATA>)) {
    next if (/^#/);
    ($category,$name,$url,$tags,$favicon,$nickname) = split /~/;


1970s~Magic 70s Florida~
1980s~Austin 80s~
1980s~WRBQ (Q105)~
BBC~BBC World Service~
Classic Rock~94.3 FM WIBG~
Classic Rock~96 Rock~
Classic Rock~B97~
Classic Rock~Classic Rock Florida HD~
Classic Rock~New Hampshire's 95.7~
Public Radio~KAMU Radio FM 90.9~
Public Radio~KUT 90.5 FM~
Public Radio~WFIT~
Public Radio~WNYC~
Public Radio~WREK 91.1 Atlanta GA~
Public Radio~KBRW~