Page 15 of 15

Re: LCD display and buttons in Python (tutorial and code)

PostPosted: 25 Jun 2019, 16:21
by pixel
Hi. How to make the radio play immediately after powering on? Simulate pressing a play button?

Re: LCD display and buttons in Python (tutorial and code)

PostPosted: 30 Jun 2019, 12:49
by lakeuk
pixel wrote:Hi. How to make the radio play immediately after powering on? Simulate pressing a play button?


Setup a playlist with your radio station, probably worth including additional station for the odd occasions when the stream isn't available as runeaudio will automatically move to the next.

Have python script that will launch your chosen playlist, following example of the python code

Code: Select all
import os
    print "Station Preset 1 Pressed"
    os.system("mpc clear") 
    os.system("mpc load 'Radio Preset'")
    os.system("mpc play 1")


Create a service that will call and run your python script

I have examples for something similar for running my gpio button scripts, though I don't launch a station at switch on:-
https://github.com/lakeuk/Runeaudio-extensions

Alternatively you could used the alarm add-on turn switch on the radio at set time, this is what I do, theirs a post for the add-on on this forum somewhere.

Re: LCD display and buttons in Python (tutorial and code)

PostPosted: 04 Jul 2019, 14:28
by janui
Hi lakeuk & pixel,
lakeuk wrote:Have python script that will launch your chosen playlist, following example of the python code
You could do this without a python script. After creating the playlist, open the 'Queue' tab in the main player UI then click on 'Manage playlists' (below left). If you now click on 'Actions' (the stripy icon on the right) you can choose 'Randomly add songs to the queue' for your chosen playlist.
Whenever the queue is empty, your chosen radio station(s) will automatically start to play.
You could also set the 'Autoplay' switch in the MPD UI, this will automatically start the same song (or radio station) which was playing when you shut down the player.
janui