Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Starting stopping all audio through cmd line
#1
Question 
Hi all,

I'm trying to setup a system, and I need to be able to stop audio playing in any rendering mode in order to release the ALSA output. curl http://localhost/command/?cmd=stop/play works fine for MPD, but does nothing when playing through Spotify Connect. Ideas how to achieve this?

Regards
/Robert
Reply
#2
The renderers are separate playback receivers each with their own command protocol thats typically managed by the client sending application. I don't know of any command line interfaces to the various protocols except for Bluetooth which can be controlled via /var/www/command/bt.sh

The only other mechanism that moOde provides to stop the audio from a renderer and release the ALSA output is to restart the renderer using moodeutl -R [renderer name]. This will disconnect the renderer and free up the ALSA output. IIRC exception is Squeezelite which by default hogs the output when its started so in this case it needs to be turned off. This part isn't handled by moodeutl -R.

Code:
pi@rp2:~ $ moodeutl --help
Usage: moodeutl [OPTION]
Moode utility programs

With no OPTION print the help text and exit.

-a             Print features availability
-A [add|rm N]  Update features availability
-d             Dump session file (requires sudo)
-D [var name]  Delete session variable (requires sudo)
-e [filename]  Export settings to moodecfg.ini
-i             Import moodecfg.ini
-f             Print supported audio formats
-F             Print full alsacap info
-l             Print moode log
-m             Run system monitor
-o             List audio overlays
-q             Query sql database
-r             Restart servers
-R             Restart renderer [--name]
               [bluetooth | airplay | spotify | squeezelite | roonbridge]
-s             Print system info
-t             Print last 10 lines of moode log and wait
-u             Check radio station urls for playability
-U             Check station urls, list only unplayable
--mooderel     Print moOde release
--revision     Print the hardware revision
--version      Print the program version
--help         Print this help text
pi@rp2:~ $
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Thank you Tim,

Problem with the restarting of f.i. Spotify renderer is that it disconnects the Spotify controller app and sets the renderer output volume to zero. This is a not good from a user experience viewpoint. Have to find some other means to disconnect the ALSA backend.

Regards
/Robert
Reply
#4
Ok, interesting. I used the "disconnect" button in the moode GUI, and it stops the Spotify renderer, disconnecting the client, but apparently does NOT reset the renderer as the volume when reconnecting the Spotify app is the same as before. What does the "disconnect" button do, and can I emulate that from command line?

Regards
/R
Reply
#5
It does same as moodeutl -R which is same as RESTART Spotify in Audio Config
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
But something must be different, right? Each time I do moodeutl -R --spotify and then reconnect, the volume is reset to zero, whereas it remains at max if I use the "disconnect" button.
Reply
#7
Check maybe the initial volume of Spotify in setting. Spotify will restart with whatever volume you set in settings
Reply
#8
(07-01-2021, 12:24 PM)Alaini93 Wrote: Check maybe the initial volume of Spotify in setting. Spotify will restart with whatever volume you set in settings

Thanks!
Reply


Forum Jump: