Skip to content

Instantly share code, notes, and snippets.

@tomhiggins
Created July 20, 2017 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhiggins/b43535daf5976c3de6123754df07a86b to your computer and use it in GitHub Desktop.
Save tomhiggins/b43535daf5976c3de6123754df07a86b to your computer and use it in GitHub Desktop.
Streaming Audio Station Fast and Easy
find /directory/where/your/music/is/ -name "*mp3">playlist.m3u | ip="$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')" | cvlc --no-auto-preparse -I http --http-password CHANGEME --http-host $ip --http-port 8088 --sout-keep --sout='#duplicate{dst=gather:std{access=http,mux=mpeg1,dst=:8085},dst=display,select="novideo"}' -LZ --no-auto-preparse --album-art=0 -q playlist.m3u
@tomhiggins
Copy link
Author

Do you have a ton of directories of music/spokenword/podcasts/noise that you want to stream out to your local network?

Requires

  • Bash
  • VLC/CVLC

How To Use

You should run this in a directory where you have rights to read and write files

  • Change /directory/where/your/music/is/ to the directory path where the music/apokenword/podcasts/etc stash you want to stream is kept.
  • This code will go into the directories under the main directory as well.
  • The code grabs all the names of the mp3 files and writes that into a file named playlist.m3u
  • The songs are Randomized and when they are all played Looped to do it all over again until you stop it, the machine powers off, or to the heat death of the universe...which ever comes first.

NB For those with large collections of music the playlists may take a moment or three to load on the Control web page. Give it time, it is working hard for your pleasure.

How can I control what is being played?

  • From any web browser on the same network you are running this on goto http://servingmachinesip:8088
  • Leave the first input section , the one for User Name, blank
  • The default password is CHANGEME , and yes you should really change that to something less deafultish.

You should now see a web page with controls that will allows you to pick what you want to be streamed and in which order. You can also use an app on your phone/device such as RemoteForVLC (https://f-droid.org/packages/org.peterbaldwin.client.android.vlcremote/)

How do I change the deafult password
Before you hit enter and run the code

  • Use the arrow keys so that your cursor is at the word CHANGEME
  • Change it to something not so much of a default nature.
  • Use the arrow keys to you get to the end of the line
  • Hit enter
    This will now be the password you will use to log into the controls for the Audio Stream.
    NB If you want to run this so that anyone can control the Audio Stream, give out the password to anyone and everyone
    you want to be able to control it. Sometimes Temporary Autonomous Zones (TAZ) are just what the doctor ordered. It is up to you.

How do I use an APP to listen to the stream?
My goto app is VLC (PlayStore or Fdroid). Your mileage will vary. So long as the app has the option to stream audio you are good to go. Point your app to http://servingmachineip:8085

How do I find out the IP of the machine I am running the AudioServer on?
There are many ways to find this out depending on the type of machine you are using to run this.
On Linux, go to the machine that is running the audio server and cut and paste this into a Terminal/Command Line...
echo "$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')"
The result will be a number like 192.168.1.23 This is the IP number of that machine. So in this example to listen to the stream from anywhere on that network just point your Audio app to http://192.168.1.23:8085

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment