LCD display and buttons in Python (tutorial and code)

Raspberry Pi related support

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

Postby pixel » 25 Jun 2019, 16:21

Hi. How to make the radio play immediately after powering on? Simulate pressing a play button?
pixel
 
Posts: 1
Joined: 25 Jun 2019, 16:14

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

Postby lakeuk » 30 Jun 2019, 12:49

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.
lakeuk
 
Posts: 5
Joined: 20 Jun 2017, 16:54

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

Postby janui » 04 Jul 2019, 14:28

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
User avatar
janui
 
Posts: 624
Joined: 20 Dec 2014, 12:55
Location: Ollanda

support RuneAudio Donate with PayPal

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 5 guests