1.2.4. Guiro (Radio/Media Player)

Güiro is a component that plays local audio files. It uses a vlc running locally on AUD and does not depend on nor makes use of Hookah.

1.2.4.2. Interfaces

/home/audio/control/radio/ provides a simple API with just a play() and a stop() RPC. For play(), the string parameter denotes the file to play. Both absolute and relative paths work, with relative paths being relative to the Guiro/ directory. It is also possible to send stream URLs; all strings starting with http:// or https:// will be regarded as such.

Scope (Local Server) + Method Argument Type Return Type
/home/audio/control/radio/play() string bool
/home/audio/control/radio/stop() string (ignored) bool

1.2.4.3. Examples

Former versions of Guiro allowed simultaneous playback of multiple files. The file name doubled as a handle on the playback instance. It is therefore good practice, even though absolutely unnecessary, to use the filename for stop(), too. This way, you won’t have to change your code if the behavior should ever change again.

 import rsb, logging, time
 if __name__ == '__main__':
     logging.basicConfig()
     filename = 'cheerleader-full.ogg'
     with rsb.createRemoteServer('/home/audio/control/radio') as server:
         server.play(filename)
         time.sleep(5)
         server.stop(filename)