Skip to content

Instantly share code, notes, and snippets.

@jayrambhia
Created February 1, 2012 20:48
Show Gist options
  • Save jayrambhia/1719217 to your computer and use it in GitHub Desktop.
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).
'''
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()
'''
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()
@perat
Copy link

perat commented Feb 7, 2012

I want to play smart playlist in fullscreen, it is possible?

@jayrambhia
Copy link
Author

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.

@perat
Copy link

perat commented Feb 10, 2012

I need to do it automatic at machine boot.

@jayrambhia
Copy link
Author

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.

@jayrambhia
Copy link
Author

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