Thank you for your donation!


Python Code with Moode
#1
I am curious where I can find some sample python code to display the current song playing and if anything else can be done with the python code....such as skip forward, skip backwards, etc.

Thanks,
Gary
Reply
#2
(04-10-2018, 10:42 PM)Big G Wrote: I am curious where I can find some sample python code to display the current song playing and if anything else can be done with the python code....such as skip forward, skip backwards, etc.

Thanks,
Gary

Not sure what exactly you mean but there are plenty of displays which used scripts 
https://github.com/dhrone/Raspdac-Display
Reply
#3
(04-10-2018, 11:16 PM)rikardo1979 Wrote:
(04-10-2018, 10:42 PM)Big G Wrote: I am curious where I can find some sample python code to display the current song playing and if anything else can be done with the python code....such as skip forward, skip backwards, etc.

Thanks,
Gary

Not sure what exactly you mean but there are plenty of displays which used scripts 
https://github.com/dhrone/Raspdac-Display
Sorry for the delayed response....I have been away for a week.  Thanks for the link. I will take a look at that. Is it possible through Python to control playback, such as skip to next song, previous song, play, pause, etc, or does the python script you mentioned only display the song information?

Thanks again,
Gary
Reply
#4
Here's a simple example of how you can use a button connected on GPIO(4) to pause/play a song.  I use this as part of the script that drives a 128x128 OLED display.

Code:
import subprocess
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def mpdToggle():
   status = subprocess.check_output(['mpc', 'toggle'])

def main():

   while True:
       input_state = GPIO.input(4)
       if input_state == False:
           mpdToggle()
       time.sleep(pauseTime)
Reply
#5
(04-16-2018, 03:32 PM)Sharkus Wrote: Here's a simple example of how you can use a button connected on GPIO(4) to pause/play a song.  I use this as part of the script that drives a 128x128 OLED display.

Code:
import subprocess
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def mpdToggle():
   status = subprocess.check_output(['mpc', 'toggle'])

def main():

   while True:
       input_state = GPIO.input(4)
       if input_state == False:
           mpdToggle()
       time.sleep(pauseTime)
Thanks Sharkus,
Great! That looks like that will get me started in the right direction.

Thanks again,
Gary
Reply


Forum Jump: