From: Ken H. <ke...@ha...> - 2006-02-19 00:28:04
|
MusicBox users, I have been kicking around some ideas about the future of MusicBox. One idea is to separate the UI from the player. The current player.py and plugins does not depend on gtk or rox for anything, so this shouldn't be too hard. Today I quickly added some code to run player.py as a python SocketServer which listens on a Unix domain socket for simple string commands (e.g. 'play,some-song.mp3,audio/mpeg') and it works quite well. The UI or any front-end only has to open a socket (/tmp/musicbox) and send some strings. For example: to play a mp3 #!/usr/bin/env python from socket import * sk = socket(AF_UNIX, SOCK_DGRAM) sk.connect('/tmp/musicbox') sk.send('play,/path/to/song.mp3,audio/mpeg') sk.close() The concept is to start the player (server/daemon) on demand and keep it running, either forever, or until some time has expired with nothing to do. The UI would connect to the socket and communicate with it. If the server wasn't running the UI could offer to start one, or simply inform the user what to do. The server could be started at boot or login time. Other niceties: Multiple UIs could talk to the same server The server would keep playing even if the UI or X died or exited normally. There would be a new command to quit the server. The server would write status back on the socket so the UI could see what was happening. People could write their own UI (GUI or text) easily. Using UDP sockets instead of Unix sockets would allow remote control/monitoring. (but not streaming) Any suggestions or comments (either technical or practical) on this idea before I go too far? Thanks, Ken |