Created
February 1, 2012 20:48
-
-
Save jayrambhia/1719217 to your computer and use it in GitHub Desktop.
A python script to play banshee media player(can use only terminal commands).
This file contains 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
''' | |
Author : Jay Rambhia | |
email : [email protected] | |
twitter: @jayrambhia | |
''' | |
import os | |
import time | |
import threading | |
import sys | |
from multiprocessing import Process | |
def banshee(): | |
os.system('banshee --play') | |
return | |
class do(threading.Thread): | |
def __init__(self): | |
threading.Thread.__init__(self) | |
def run(self): | |
try: | |
command_str = str(raw_input('Command: ')) | |
if command_str == 'quit': | |
os.system('banshee --stop') | |
return | |
os.system('banshee --'+command_str) | |
print command_str | |
self.run() | |
except EOFError: | |
print 'Got keyboard interrupt' | |
print 'quitting' | |
os.system('banshee --stop') | |
return | |
def main(): | |
p = Process(target = banshee) | |
p.start() | |
command = do() | |
command.start() | |
command.join() | |
p.terminate() | |
print 'terminate' | |
if __name__ == '__main__': | |
main() | |
This file contains 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
''' | |
Author : Jay Rambhia | |
email : [email protected] | |
twitter: @jayrambhia | |
''' | |
import os | |
import time | |
import threading | |
import sys | |
from multiprocessing import Process | |
def banshee(playlist): | |
# playlist = raw_input('playlist: ') | |
os.system('banshee '+playlist+' --fullscreen') | |
return | |
class do(threading.Thread): | |
def __init__(self): | |
threading.Thread.__init__(self) | |
def run(self): | |
try: | |
command_str = str(raw_input('Command: ')) | |
if command_str == 'quit': | |
os.system('banshee --stop') | |
return | |
os.system('banshee '+command_str) | |
print command_str | |
self.run() | |
except EOFError: | |
print 'Got keyboard interrupt' | |
print 'quitting' | |
os.system('banshee --stop') | |
return | |
def main(): | |
#playlist = raw_input('playlist :') | |
playlist = 'playlist_name' | |
p = Process(target = banshee, args=(playlist,)) | |
p.start() | |
command = do() | |
command.start() | |
command.join() | |
p.terminate() | |
print 'terminate' | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And now commands would be
--play
--pause
etc