[tuxdroid-svn] r459 - in software/tux_pc_control: . branches branches/0.0.2 trunk
Status: Beta
Brought to you by:
ks156
From: boblefrag <c2m...@c2...> - 2007-06-28 23:15:41
|
Author: boblefrag Date: 2007-06-29 01:15:02 +0200 (Fri, 29 Jun 2007) New Revision: 459 Added: software/tux_pc_control/branches/ software/tux_pc_control/branches/0.0.2/ software/tux_pc_control/branches/0.0.2/README software/tux_pc_control/branches/0.0.2/config.py software/tux_pc_control/branches/0.0.2/control.py software/tux_pc_control/branches/0.0.2/tux_control.py software/tux_pc_control/tags/ software/tux_pc_control/trunk/ software/tux_pc_control/trunk/README software/tux_pc_control/trunk/config.py software/tux_pc_control/trunk/control.py software/tux_pc_control/trunk/tux_control.py Log: Added: software/tux_pc_control/branches/0.0.2/README =================================================================== --- software/tux_pc_control/branches/0.0.2/README (rev 0) +++ software/tux_pc_control/branches/0.0.2/README 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,54 @@ +...............................................README .......................................... + +PREREQUIST + +you must have XMMS instaled on your system with xmms-xmmplayer + +for being able to play audio via your tux, open xmms, rigth click, go to preferences +1) choose the oss plugins for audio-out, click on configure and select usb AUDIO and USB mixer + +2) next, select mplayer plugin, click on configure in path to mplayer type : /usr/bin/mplayer uncheck all options + IN mplayer tab, in 'Override audio output device, type oss:/dev/dsp2 (or oss:/dev/dsp1 if tux is on /dev/dsp1) + + that's all folks now you can use my script + + + CONFIGURATION FILE + +in the tux_pc_control, you will find a file named config.py edit it to fit your system configuration, add your radio etc ... + + + PLAY THE SCRIPT + +whith a terminal, go to tux_pc_control directory and type 'python tux_control.py' + + + REMOTE KEY + + + BROWSERING + + KEY OK : go to the selected directory + KEY LEFT : select previous directory + KEY RIGHT : select next directory + KEY UP : GO in th parent directory + + PLAYING MUSIC + + KEY play/pause : play all the music in the current directory/pause xmms + KEY STOP : stop the music + KEY escape : shut off xmms + KEY Previous : play the previous song + KEY Next : play the next song + + LISTENING RADIO + + KEY CHANNELPLUS : play the next radio + KEY CHANNELMINUX : play the previous radio + + NOTA: the control key for music work also for radio (play/pause, stop) + + don't hesitate to participate, modify and redistribute this script !!! + author : yohann Gabory <mrg...@ya...> + + Added: software/tux_pc_control/branches/0.0.2/config.py =================================================================== --- software/tux_pc_control/branches/0.0.2/config.py (rev 0) +++ software/tux_pc_control/branches/0.0.2/config.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,12 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- + +#modify this file to fit your configuration + +player = ['xmms'] #the player you are using. For now don't modify this because it works only whith xmms +musique = '/home/yohann/culture/musique' # where are your mp3 +format = ('mp3','ogg','wav',) # put here all the musical format you want tux be able to read + +## feel free to add all the radio's you like :)) +radio = [('france inter','http://213.205.96.91:9915/'),('france info','mms://vip9.yacast.fr/encoderfranceinfo'),('france culture','mms://viptvr.yacast.net/tvr_franceculture'),('fipe','mms://viptvr2.yacast.net/encoderfip'),] + Added: software/tux_pc_control/branches/0.0.2/control.py =================================================================== --- software/tux_pc_control/branches/0.0.2/control.py (rev 0) +++ software/tux_pc_control/branches/0.0.2/control.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# ----------------------------------------------------------------------------- +# Tux Droid - Tux_control PC +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# ----------------------------------------------------------------------------- +# $Id: $ +# ----------------------------------------------------------------------------- + +""" +CHANGES +======= +2007/06/25 - version 0.0.1: + - Initial version + - tux browse your directories. + -tux play all the music in your directories + -tux can play your radio + -you can pause/stop, skip your song +TODO LIST +======== +- make tux use mplayer instead of xmms for using it without a gui +- enable shuffle, creation of playlist, radio-recording +- get some file info whith mp3 tag +- make tux to be able to browse song, and to play recusively a directory +- documentation of the fonctions +""" + +__author__ = "Yohann Gabory <mrg...@ya...>" +__appname__ = "Tux_PC_control" +__version__ = "0.0.1" +__date__ = "2007/06/25" +__license__ = "GPL" + + + + + + +from os import * +from config import * +def recherche(bolean): + a = getcwd() + repertoires =[a] + fichiers = [] + fichiers2 =[] + repertoire = repertoires.pop() + for nom in listdir(repertoire): + chemin = path.join(repertoire,nom) + if path.isfile(chemin): + (filepath,filename) = path.split(chemin) + (shortname, extention) = path.splitext(filename) + print format + for f in format: + print f + f = '.' + f + if extention == f: + fichiers.append(chemin) + for chemin in fichiers: + d = '' + for i in chemin: + if i == ' ': + i = '\ ' + if i =="'": + i = "\\"+i + if i =='(': + i = "\(" + if i ==')': + i ='\)' + d = d + i + fichiers2.append(d) + elif path.isdir(chemin): + repertoires.append(chemin) + if bolean == 0: + return fichiers2 + if bolean == 1: + return repertoires + # C'est un répertoire + + + + + + +#end of file + Added: software/tux_pc_control/branches/0.0.2/tux_control.py =================================================================== --- software/tux_pc_control/branches/0.0.2/tux_control.py (rev 0) +++ software/tux_pc_control/branches/0.0.2/tux_control.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,297 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- + + + +# Tux Pc control +#Un programme pour contrôler son ordinateur grace au tux + + +# ----------------------------------------------------------------------------- +# Tux Droid - Tux_control PC +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# ----------------------------------------------------------------------------- +# $Id: $ +# ----------------------------------------------------------------------------- + +""" +CHANGES +======= +2007/06/29 - version 0.0.2 + -small changes + - it's no more necessary to push the 1 key to play radio + - tux.destroy() adde at the end of the script to close tux_control gracefully + - key escape replace standby to close xmms +2007/06/25 - version 0.0.1: + - Initial version + - tux browse your directories. + -tux play all the music in your directories + -tux can play your radio + -you can pause/stop, skip your song +TODO LIST +======== +- make tux use mplayer instead of xmms for using it without a gui +- enable shuffle, creation of playlist, radio-recording +- get some file info whith mp3 tag +- make tux to be able to browse song, and to play recusively a directory +- documentation of the fonctions +""" + +__author__ = "Yohann Gabory <mrg...@ya...>" +__appname__ = "Tux_PC_control" +__version__ = "0.0.1" +__date__ = "2007/06/25" +__license__ = "GPL" + + + + + + + + +import sys +sys.path.append('/opt/tuxdroid/api/python') +from tux import * + +#other +from os import * +from os import listdir +import string +import sys +from config import * +from control import * +global count, liste_radio +count = 0 +root = musique +liste_radio = 0 +chdir(root) +print root + +def Ok(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + + chdir(courant) + a = getcwd() + b= recherche(1) + c= recherche(0) + d=len(c) + + d=str(d) + if d == 0: + d = 'aucune' + if d == 1: + d = 'une' + tux_speak('il y a'+d+'chansons dans ce répertoire') + maxdir = len(b)-1 + if maxdir == -1: + tux.event.set_on_remote_bt(K_RIGHT, exeption) + tux.event.set_on_remote_bt(K_LEFT, exeption) + tux.event.set_on_remote_bt(K_OK, exeption) +def exeption(): + tux_speak('ce répertoire est vide') + haut() + tux.event.set_on_remote_bt(K_RIGHT, plus) + tux.event.set_on_remote_bt(K_LEFT, moins) + tux.event.set_on_remote_bt(K_OK, Ok) +def Pourtous(): + a = getcwd() + a = string.split(a,'/') + return a + + + +def haut(): + a=Pourtous() + del(a[-1]) + b ="" + for i in a: + b = b + i + '/' + chdir(b) + c = listdir(b) + dire = a[-1] + speech = '' + for i in dire: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def plus(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + count = count +1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def moins(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + count = count -1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def play_all(): + tux.cmd.mouth_open() + xmms = 'xmms' + ' ' + for f in format: + f = '.' + f + xmms = xmms + ' *' + f + print xmms + tux.sys.shell_free(xmms) + + + +def tux_speak(text): + tux.cmd.mouth_open() + tux.tts.select_voice(1,100) + tux.tts.speak(text) + tux.cmd.mouth_close() + +def france_inter(): + xmms_radio = 'xmms ' + radio + tux.sys.shell_free(xmms_radio) + + +def radio_web(): + global liste_radio + liste_radio = 0 + tux_speak('pour écouter la radio, utilisé les touches chaines plus et chaines moins.') + + +def next_radio(): + global liste_radio + elem = len(radio) + liste_radio = liste_radio + 1 + if liste_radio >= elem: + liste_radio = 0 + b = radio[liste_radio] + titre = b[0] + flux = b[1] + tux_speak(titre) + xmms_radio = 'xmms ' + flux + tux.sys.shell_free(xmms_radio) + +def prev_radio(): + global liste_radio + elem = len(radio) + liste_radio = liste_radio - 1 + if liste_radio < 0: + liste_radio = elem -1 + b = radio[liste_radio] + titre = b[0] + flux = b[1] + tux_speak(titre) + xmms_radio = 'xmms ' + flux + tux.sys.shell_free(xmms_radio) + +def stop(): + tux.sys.shell_free('xmms -s') + +def exit(): + tux.cmd.mouth_close() + tux.sys.shell('rm ~/.xmms/xmms.m3u') + tux.sys.shell('xmms -q') + +def next(): + tux.sys.shell_free('xmms -f') + + +def prev(): + tux.sys.shell_free('xmms -r') + +def increase_volume(): #don't work ! + tux.sys.shell("amixer set PCM 5%+") + +def decrease_volume(): #don't work ! + tux.sys.shell("amixer set PCM 5%-") + + +tux.event.set_on_remote_bt(K_1, radio_web) + +tux.event.set_on_remote_bt(K_VOLUMEPLUS, increase_volume) +tux.event.set_on_remote_bt(K_VOLUMEMINUS, decrease_volume) + +tux.event.set_on_remote_bt(K_CHANNELPLUS, next_radio) +tux.event.set_on_remote_bt(K_CHANNELMINUS, prev_radio) +tux.event.set_on_remote_bt(K_NEXT, next) +tux.event.set_on_remote_bt(K_PREVIOUS, prev) +tux.event.set_on_remote_bt(K_ESCAPE, exit) +tux.event.set_on_remote_bt(K_UP, haut) +tux.event.set_on_remote_bt(K_STOP, stop) +tux.event.set_on_remote_bt(K_OK, Ok) +tux.event.set_on_remote_bt(K_RIGHT, plus) +tux.event.set_on_remote_bt(K_LEFT, moins) +tux.event.set_on_remote_bt(K_PLAYPAUSE, play_all) + +tux.event.wait_bt_pushed(9999) +tux.destroy() Property changes on: software/tux_pc_control/branches/0.0.2/tux_control.py ___________________________________________________________________ Name: svn:executable + * Added: software/tux_pc_control/trunk/README =================================================================== --- software/tux_pc_control/trunk/README (rev 0) +++ software/tux_pc_control/trunk/README 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,54 @@ +...............................................README .......................................... + +PREREQUIST + +you must have XMMS instaled on your system with xmms-xmmplayer + +for being able to play audio via your tux, open xmms, rigth click, go to preferences +1) choose the oss plugins for audio-out, click on configure and select usb AUDIO and USB mixer + +2) next, select mplayer plugin, click on configure in path to mplayer type : /usr/bin/mplayer uncheck all options + IN mplayer tab, in 'Override audio output device, type oss:/dev/dsp2 (or oss:/dev/dsp1 if tux is on /dev/dsp1) + + that's all folks now you can use my script + + + CONFIGURATION FILE + +in the tux_pc_control, you will find a file named config.py edit it to fit your system configuration, add your radio etc ... + + + PLAY THE SCRIPT + +whith a terminal, go to tux_pc_control directory and type 'python tux_control.py' + + + REMOTE KEY + + + BROWSERING + + KEY OK : go to the selected directory + KEY LEFT : select previous directory + KEY RIGHT : select next directory + KEY UP : GO in th parent directory + + PLAYING MUSIC + + KEY play/pause : play all the music in the current directory/pause xmms + KEY STOP : stop the music + KEY escape : shut off xmms + KEY Previous : play the previous song + KEY Next : play the next song + + LISTENING RADIO + + KEY CHANNELPLUS : play the next radio + KEY CHANNELMINUX : play the previous radio + + NOTA: the control key for music work also for radio (play/pause, stop) + + don't hesitate to participate, modify and redistribute this script !!! + author : yohann Gabory <mrg...@ya...> + + Added: software/tux_pc_control/trunk/config.py =================================================================== --- software/tux_pc_control/trunk/config.py (rev 0) +++ software/tux_pc_control/trunk/config.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,12 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- + +#modify this file to fit your configuration + +player = ['xmms'] #the player you are using. For now don't modify this because it works only whith xmms +musique = '/home/yohann/culture/musique' # where are your mp3 +format = ('mp3','ogg','wav',) # put here all the musical format you want tux be able to read + +## feel free to add all the radio's you like :)) +radio = [('france inter','http://213.205.96.91:9915/'),('france info','mms://vip9.yacast.fr/encoderfranceinfo'),('france culture','mms://viptvr.yacast.net/tvr_franceculture'),('fipe','mms://viptvr2.yacast.net/encoderfip'),] + Added: software/tux_pc_control/trunk/control.py =================================================================== --- software/tux_pc_control/trunk/control.py (rev 0) +++ software/tux_pc_control/trunk/control.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# ----------------------------------------------------------------------------- +# Tux Droid - Tux_control PC +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# ----------------------------------------------------------------------------- +# $Id: $ +# ----------------------------------------------------------------------------- + +""" +CHANGES +======= +2007/06/25 - version 0.0.1: + - Initial version + - tux browse your directories. + -tux play all the music in your directories + -tux can play your radio + -you can pause/stop, skip your song +TODO LIST +======== +- make tux use mplayer instead of xmms for using it without a gui +- enable shuffle, creation of playlist, radio-recording +- get some file info whith mp3 tag +- make tux to be able to browse song, and to play recusively a directory +- documentation of the fonctions +""" + +__author__ = "Yohann Gabory <mrg...@ya...>" +__appname__ = "Tux_PC_control" +__version__ = "0.0.1" +__date__ = "2007/06/25" +__license__ = "GPL" + + + + + + +from os import * +from config import * +def recherche(bolean): + a = getcwd() + repertoires =[a] + fichiers = [] + fichiers2 =[] + repertoire = repertoires.pop() + for nom in listdir(repertoire): + chemin = path.join(repertoire,nom) + if path.isfile(chemin): + (filepath,filename) = path.split(chemin) + (shortname, extention) = path.splitext(filename) + print format + for f in format: + print f + f = '.' + f + if extention == f: + fichiers.append(chemin) + for chemin in fichiers: + d = '' + for i in chemin: + if i == ' ': + i = '\ ' + if i =="'": + i = "\\"+i + if i =='(': + i = "\(" + if i ==')': + i ='\)' + d = d + i + fichiers2.append(d) + elif path.isdir(chemin): + repertoires.append(chemin) + if bolean == 0: + return fichiers2 + if bolean == 1: + return repertoires + # C'est un répertoire + + + + + + +#end of file + Added: software/tux_pc_control/trunk/tux_control.py =================================================================== --- software/tux_pc_control/trunk/tux_control.py (rev 0) +++ software/tux_pc_control/trunk/tux_control.py 2007-06-28 23:15:02 UTC (rev 459) @@ -0,0 +1,297 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- + + + +# Tux Pc control +#Un programme pour contrôler son ordinateur grace au tux + + +# ----------------------------------------------------------------------------- +# Tux Droid - Tux_control PC +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# ----------------------------------------------------------------------------- +# $Id: $ +# ----------------------------------------------------------------------------- + +""" +CHANGES +======= +2007/06/29 - version 0.0.2 + -small changes + - it's no more necessary to push the 1 key to play radio + - tux.destroy() adde at the end of the script to close tux_control gracefully + - key escape replace standby to close xmms +2007/06/25 - version 0.0.1: + - Initial version + - tux browse your directories. + -tux play all the music in your directories + -tux can play your radio + -you can pause/stop, skip your song +TODO LIST +======== +- make tux use mplayer instead of xmms for using it without a gui +- enable shuffle, creation of playlist, radio-recording +- get some file info whith mp3 tag +- make tux to be able to browse song, and to play recusively a directory +- documentation of the fonctions +""" + +__author__ = "Yohann Gabory <mrg...@ya...>" +__appname__ = "Tux_PC_control" +__version__ = "0.0.1" +__date__ = "2007/06/25" +__license__ = "GPL" + + + + + + + + +import sys +sys.path.append('/opt/tuxdroid/api/python') +from tux import * + +#other +from os import * +from os import listdir +import string +import sys +from config import * +from control import * +global count, liste_radio +count = 0 +root = musique +liste_radio = 0 +chdir(root) +print root + +def Ok(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + + chdir(courant) + a = getcwd() + b= recherche(1) + c= recherche(0) + d=len(c) + + d=str(d) + if d == 0: + d = 'aucune' + if d == 1: + d = 'une' + tux_speak('il y a'+d+'chansons dans ce répertoire') + maxdir = len(b)-1 + if maxdir == -1: + tux.event.set_on_remote_bt(K_RIGHT, exeption) + tux.event.set_on_remote_bt(K_LEFT, exeption) + tux.event.set_on_remote_bt(K_OK, exeption) +def exeption(): + tux_speak('ce répertoire est vide') + haut() + tux.event.set_on_remote_bt(K_RIGHT, plus) + tux.event.set_on_remote_bt(K_LEFT, moins) + tux.event.set_on_remote_bt(K_OK, Ok) +def Pourtous(): + a = getcwd() + a = string.split(a,'/') + return a + + + +def haut(): + a=Pourtous() + del(a[-1]) + b ="" + for i in a: + b = b + i + '/' + chdir(b) + c = listdir(b) + dire = a[-1] + speech = '' + for i in dire: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def plus(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + count = count +1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def moins(): + a = getcwd() + b= recherche(1) + global count + maxdir = len(b)-1 + count = count -1 + if count > maxdir: + count = 0 + if count < 0 : + count = maxdir + courant = b[count] + (filepath,filename) = path.split(courant) + speech = '' + for i in filename: + if i == '-': + i = ' ' + if i == '_': + i = ' ' + if i == '=': + i = ' ' + speech = speech + i + tux_speak(speech) + +def play_all(): + tux.cmd.mouth_open() + xmms = 'xmms' + ' ' + for f in format: + f = '.' + f + xmms = xmms + ' *' + f + print xmms + tux.sys.shell_free(xmms) + + + +def tux_speak(text): + tux.cmd.mouth_open() + tux.tts.select_voice(1,100) + tux.tts.speak(text) + tux.cmd.mouth_close() + +def france_inter(): + xmms_radio = 'xmms ' + radio + tux.sys.shell_free(xmms_radio) + + +def radio_web(): + global liste_radio + liste_radio = 0 + tux_speak('pour écouter la radio, utilisé les touches chaines plus et chaines moins.') + + +def next_radio(): + global liste_radio + elem = len(radio) + liste_radio = liste_radio + 1 + if liste_radio >= elem: + liste_radio = 0 + b = radio[liste_radio] + titre = b[0] + flux = b[1] + tux_speak(titre) + xmms_radio = 'xmms ' + flux + tux.sys.shell_free(xmms_radio) + +def prev_radio(): + global liste_radio + elem = len(radio) + liste_radio = liste_radio - 1 + if liste_radio < 0: + liste_radio = elem -1 + b = radio[liste_radio] + titre = b[0] + flux = b[1] + tux_speak(titre) + xmms_radio = 'xmms ' + flux + tux.sys.shell_free(xmms_radio) + +def stop(): + tux.sys.shell_free('xmms -s') + +def exit(): + tux.cmd.mouth_close() + tux.sys.shell('rm ~/.xmms/xmms.m3u') + tux.sys.shell('xmms -q') + +def next(): + tux.sys.shell_free('xmms -f') + + +def prev(): + tux.sys.shell_free('xmms -r') + +def increase_volume(): #don't work ! + tux.sys.shell("amixer set PCM 5%+") + +def decrease_volume(): #don't work ! + tux.sys.shell("amixer set PCM 5%-") + + +tux.event.set_on_remote_bt(K_1, radio_web) + +tux.event.set_on_remote_bt(K_VOLUMEPLUS, increase_volume) +tux.event.set_on_remote_bt(K_VOLUMEMINUS, decrease_volume) + +tux.event.set_on_remote_bt(K_CHANNELPLUS, next_radio) +tux.event.set_on_remote_bt(K_CHANNELMINUS, prev_radio) +tux.event.set_on_remote_bt(K_NEXT, next) +tux.event.set_on_remote_bt(K_PREVIOUS, prev) +tux.event.set_on_remote_bt(K_ESCAPE, exit) +tux.event.set_on_remote_bt(K_UP, haut) +tux.event.set_on_remote_bt(K_STOP, stop) +tux.event.set_on_remote_bt(K_OK, Ok) +tux.event.set_on_remote_bt(K_RIGHT, plus) +tux.event.set_on_remote_bt(K_LEFT, moins) +tux.event.set_on_remote_bt(K_PLAYPAUSE, play_all) + +tux.event.wait_bt_pushed(9999) +tux.destroy() Property changes on: software/tux_pc_control/trunk/tux_control.py ___________________________________________________________________ Name: svn:executable + * |