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 : jayrambhia777@gmail.com | |
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 : jayrambhia777@gmail.com | |
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() | |
I need to do it automatic at machine boot.
I have added another script to the gist. You can export your smart playlist or any other playlist, and change the "playlist_name" with the respective playlist!
And to run this script at every time you log in, add the following command in your .profile (It will probably be in the home directory).
$ python playBanshee1.py &
& is very necessary.
And now commands would be
--play
--pause
etc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I couldn't find out where the smart playlist is stored.
You can play other playlists if you have the path.
And yeah, if you want to play smart playlist then you can select it from GUI. And fullscreen command works.