Thank you for your donation!


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


need scriptable access
#1
Hi - please don't yell if I am posting a query that has been answered before. I have searched the forum but was not able to spot this.

I am designing a simple rpi radio system on top of moode. I will use web access to maintain it but I want an ultra simplified mechanical control and display setup on the box, just three controls:  hardware: power toggle switch to Rpi, Rotary Encoder 1 and Rotary Encoder 2.  small hdmi screen (waveshare).  iqaudio dac pro.  

I plan to control the hdmi panel by just displaying a simple php website full screen on it. The display will only have the name of the station, a few nearby stations in the list of all favorite stations, the image thumbnail representing the station (typically a square image), and the volume level.    The web page is reloaded whenever events happen on the REs.

Rotary Encoder 1:  volume up/down and the pushbutton controls mute.  
Rotary Encoder 2: station selector (rotate left or right to select previous or next station in favorites list; cyclic, like a drum-type dial), the button returns control to the station selector in case moode is e.g. playing something else like airplay or a file.

I have a script to read the changes in REs.  I was able to call the shell script vol.sh to change the volume from within my script, so RE1 is working.

The station selector should choose from among the Moode favorites list of radio stations.

I need the following four things to complete my project:

1. A way to determine the sequential list of all favorite radio stations.  I am sure this is in a database somewhere but I am not well versed in sqlite commands and operation and I don't know how to access the info.
2. Determine the index in that list of the current playing station. 
3. For the current selected station, obtain the url of the station, the short name of the station (e.g. BBC3, KQED, FIP, Radio Paradise Mellow),  the file name (unix path) of the thumbnail (cover art) for the station
4. Switch playback to a specified entry in the list of favorite radio stations, e.g. the 5th station in the favorites list

I am not able to achieve this using mpc calls as far as I can tell.

To achieve these things, I can use python or php or shell scripts, whatever suits.

Thank you for any assistance!
Reply
#2
Try turning on the Metadata file in System Config and then parsing it to get what's currently playing.
Playlists including the favorites playlist are located in /var/lib/mpd/playlists/
The Setup guide contains info on how to update volume and send commands via http or ssh.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(09-13-2022, 12:53 AM)Tim Curtis Wrote: Try turning on the Metadata file in System Config and then parsing it to get what's currently playing.
Playlists including the favorites playlist are located in /var/lib/mpd/playlists/
The Setup guide contains info on how to update volume and send commands via http or ssh.



Thanks for quick response (and for all your hard work on this amazing system).

I can see how to do almost everything.  I was surprised that if I start a stream with mpc clear; mpc add <url>; mpc play, then the cover art automatically appears.

Still having some difficulty identifying how the station cover art is linked to the playlists, or how to access favorites,  but I might be able to work around this by manually deleting all stations that I don't want.  i guess there is no way to grab a bunch of stations and bin them (like in a finder setup)?  Or if I wanted to do from the command line, could I delete all stations of a particular family using wildcards? rm *flux*?
Reply
#4
@beanlime

“Grab a bunch of stations and bin them”? That’s called creating a playlist. “rm *flux*”? That’s called using a meat cleaver to perform brain surgery.

Sorry to be flippant but the playlist is the thing. Create a new one with the stations you want. Then your custom controller just has to load it in the MPD queue and select a particular station entry.

Regards,
Kent
Reply
#5
(09-13-2022, 11:45 AM)TheOldPresbyope Wrote: @beanlime

“Grab a bunch of stations and bin them”? That’s called creating a playlist. “rm *flux*”? That’s called using a meat cleaver to perform brain surgery.

Sorry to be flippant but the playlist is the thing. Create a new one with the stations you want. Then your custom controller just has to load it in the MPD queue and select a particular station entry.

Regards,
Kent

OK, fair enough, I was being crass.  I'll work on this now with the new info...
Reply


Forum Jump: