OK
i now have
[code]
import os
import socket
import time
import pyglet
port = 8081
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print 'ip adress?'
ip = raw_input();
dir = os.getcwd()
print os.listdir(dir)
player = pyglet.media.Player()
running = 1
while (running == 1):
print "which song now? (type the file name in full don't forget
the .mp3)"
song = raw_input()
player.queue(pyglet.media.load (song))
time.sleep(1)
player.play()
print player.volume
print player.time
time.sleep(5)
print player.time
[/code]
But player.play just isn't actually doing anything, when i print the
time at both points it gives me 0.0!?!!?!
On Jul 18, 11:58 pm, musicmac <[email protected]> wrote:
> the reason i'm sending the song name to a socket is so that it can
> interact with the other machine running the client version, which will
> just play the song, so its a multi room music player, see?
>
> and i'll start reading the docu etc etc now
>
> On Jul 18, 11:28 pm, Michael Red <[email protected]> wrote:
>
>
>
>
>
>
>
> > Uh, wait. You're sending the song name to a socket, then playing the music.
> > Why send the song name?
>
> > Brutish solution is this:
>
> > def update(dt):
> > global music
> > if not music.playing:
> > pyglet.app.exit()
>
> > and before pyglet.app.run():
>
> > pyglet.clock.schedule_interval(1/60.0, update)
>
> > This should work. For reference, check the documentation on music playback
> > and event loops. API reference could also help.
>
> > On 18 July 2011 17:40, musicmac <[email protected]> wrote:
>
> > > hey guys
> > > i just started using pyglet this morning for a music project, the idea
> > > is to be able to play the same song on 2 machines much like a sonos
> > > box or something but the cheap man way. I currently have
> > > [code]
> > > import os
> > > import socket
> > > import pyglet
>
> > > port = 8081
> > > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> > > print 'ip adress?'
> > > ip = raw_input();
> > > dir = os.getcwd()
> > > print os.listdir(dir)
> > > running = 1
> > > while (running == 1):
> > > print "which song now? (type the file name in full don't forget
> > > the .mp3)"
> > > song = raw_input()
> > > s.sendto((song), (ip, port))
> > > music = pyglet.resource.media(song)
> > > music.play()
> > > pyglet.app.run()
> > > [/code]
> > > but the program just sticks at playing the song and pyglet won't
> > > close :(
> > > TLDR how can i close pyglet after a song has played?
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "pyglet-users" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/pyglet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.