Complete beginner. How to stream URL

Hi there. I’m a complete beginner with Raspberry Pi, Linux, coding, everything beyond emailing pretty much.

I’ve been searching for the last few days but can’t figure out if what I want is possible.

I would like to play a CBC radio stream http://cbc_r1_prg.akacast.akamaistream.net/7/966/451661/v1/rc.akacast.akamaistream.net/cbc_r1_prg. using mopidy but without connecting to mopidy with a client.

I’ve successfully installed mopidy on my Raspberry Pi 3. In bash can I type something that lets mopidy connect to that URL and plays it over the 3.5 mm audio out? Is Mopidy what I should be using? I do not want to connect to mopidy using a web client or a smartphone. I tried making a text file with nano that just had the URL in there, and then I tried to scan for libraries. No success.

My end goal is to have a few buttons connected to my pi. Each button starts a different stream.

Thanks in advance,

Matt

Hey,

if you want buttons on your GPIO, you need some kind of script or program interpreting your button pushes.
In most cases of RPi and GPIO I would suggest python. You have to read a bit, but it is not that complicated.

For testing purpose I realized something like that with a 5 button mouse.
A snipped from my code:

from evdev import InputDevice
from select import select
from mpd import MPDClient
from random import randint
import csv
import os

client = MPDClient()    # create client object
client.timeout = 10     # network timeout in seconds (floats allowed), default: None
client.idletimeout = None
client.connect("localhost", 6600)

while True:
  r,w,x = select([dev], [], [])
  for event in dev.read():
    elif event.code == 276 and event.value == 1:
        #print "right button"
        state = client.status()['state'].split(":")
        if 'play' in state:
            client.stop()
            client.clear()
        elif 'stop' in state:
            client.clear()
            client.add('http://ndr-ndr2-niedersachsen.cast.addradio.de/ndr/ndr2/niedersachsen/mp3/128/stream.mp3')
            client.play()

Here you can see mopidy playing a german radio station with mp3.
I dont know your format .prg, but hopefully there is also an mp3 stream.

You see, it is not that hard to write this in python, but you have to google and read a bit :-).

have a nice one
Timo

You could have a look at the blog here - setting up and using a cheap IR control to play a selection of playlists, move forward or back and change volume.

I wrote it for Musicbox but it will work with Mopidy with some changes. (Which I haven’t got round to writing up yet, but which I can let you know if you are interested)

I found it easier than trying to connect buttons, also you don’t have to move to change channels :slight_smile: