Moode Forum
Python Code with Moode - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Python Code with Moode (/showthread.php?tid=43)



Python Code with Moode - Big G - 04-10-2018

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


RE: Python Code with Moode - rikardo1979 - 04-10-2018

(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


RE: Python Code with Moode - Big G - 04-16-2018

(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


RE: Python Code with Moode - Sharkus - 04-16-2018

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)



RE: Python Code with Moode - Big G - 04-16-2018

(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