Pirate radio - where are the scripts installed to?

So I’ve got my pirate radio working as a web radio and also as an airplay device. I can start and stop each service etc. I’d like to configure it so that I hold down the power button to switch between these two modes. I’ve found the projects on github and I think I understand the scripts but I can’t figure where they get installed onto the system. I’d be grateful if someone could tell me where to look! I want to edit phatbeatd! Thanks!

The vlc-radio project folder consists of phatbeatd and vlcd which both contain folders that are relative to root (/) on your Pi. So stuff in phat-beat/projects/vlc-radio/vlcd/etc/ is installed into /etc

You may possibly be able to just run the services alongside each other and audio played by each source would be mixed by Pulse Audio.

Alternatively to stop vlc you can sudo systemctl stop vlcd but this will break the socket connection between phatbeatd and vlcd so you’d have to tweak that and make it able to recover when vlc comes back up.

Unfortunately no mixing happens, I found quite a tidy solution…

I edited phatbeatd such that the on/off button toggles which service is running but when held down does it’s original power function.

Thanks!

   @phatbeat.on(phatbeat.BTN_ONOFF)
   def perform_toggle_vlc(pin):
       if vlc.connect():
           log(vlc.communicate("pause"))
           os.system("sudo service vlcd stop")
           SPEED = 50
           BRIGHTNESS = 64
           SPREAD = 20
          for x in range(phatbeat.CHANNEL_PIXELS):
               h = (time.time() * SPEED + (x * SPREAD)) % 360 / 360.0
              r, g, b = [int(c*BRIGHTNESS) for c in colorsys.hsv_to_rgb(h, 1.0, 1.0)]
               phatbeat.set_pixel(x, r, g, b, channel=0)
               phatbeat.set_pixel(x, r, g, b, channel=1)
               phatbeat.show()
               time.sleep(0.1)
           phatbeat.clear()
           phatbeat.show()
       else: 
           phatbeat.set_all(128,0,0,0.1)
           phatbeat.show()
           time.sleep(0.5)
           phatbeat.clear()
           phatbeat.show()
           os.system("sudo service vlcd start")

   @phatbeat.hold(phatbeat.BTN_ONOFF)
   def perform_shutdown(pin):
1 Like