Created
January 2, 2012 03:30
-
-
Save RoguePixel/1549180 to your computer and use it in GitHub Desktop.
Python scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python/ | |
##ControlBanshee.py: | |
##python hack script to control playback of the banshee media player | |
## | |
import os | |
#from subprocess import call | |
menu="\ncommands: \n \ | |
1: play/pause\n \ | |
2: next\n \ | |
3: previous\n \ | |
4: pause\n \ | |
5: stop\n \ | |
q: exit \ | |
" | |
print menu | |
def bansheecom(val): | |
if val==("1"): | |
return "banshee --toggle-playing" | |
elif val==("2"): | |
return "banshee --next" | |
elif val==("3"): | |
return "banshee --previous" | |
elif val==("4"): | |
return "banshee --pause" | |
elif val==("5"): | |
return "banshee --stop" | |
elif int(val)>=6: | |
return "no command available" | |
else: | |
return "banshee --show" | |
while True: | |
arg=raw_input("\nCommand:\n") | |
#print menu | |
if len(arg)!=0: | |
if int(arg)<=5: | |
print menu,"\n\n",bansheecom(arg) | |
os.system(bansheecom(arg)) | |
#call(bansheecom(arg)) | |
else: | |
print menu,"\n\nno command available!\n" | |
#print "you typed", arg | |
#print(len(arg)) | |
else: | |
print "\nno input, exiting...\n" | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment