Jump to content

Recommended Posts

Guest debster
Posted

Hello everyone!

 

I am trying to do a jukebox thing using debian as my server with an index.php, .mp3 file and a .py file to run things without 3rd party packages as much as possible.

 

What I got working is using html5 to capture a stream from the pi and that works. Now I am having super difficulties

getting a button click on a php page to trigger a mp3 file to play off the pi directly which is connected to some speakers, sort of a jukebox effect.

 

I have a php page that loads ok.

Trouble is I am trying to execute a .py file to play a song, which if you run it from the terminal evoking the script

it then cranks out the song

.py

#!/user/bin/env python --> wonder if this right/

import pygame

 

pygame.mixer.init()

pygame.mixer.music.load(�my.mp3�)

pygame.mixer.music.play()

while pygame.mixer.music.get_busy()==True:

continue

 

my php file that I run has an exec method that works if you just execute a test or something basic, but

doesn't execute song with command in my index.php file

 

if(isset($_POST[..])

{

exec('sudo python /var/www/do.py')

}

I have tried adding in all access to sudoers in /etc... file, did sudo chown -R on the var/www/index.php file, (btw yes my.mp3 is in same folder).

Also tried checking if cgi works, adding directives to apache2.conf, put couldn't get the cgi working when testing with basic .py, .cgi page. Looks like the cgi-bin folder was added to var/www path as that was the code I put into the conf file, but still that doesn't do anything for me.

 

Any suggestions would be extremely appreciated.

 

Thanks much!

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...