Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A python script to play banshee media player(can use only terminal commands).
'''
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()
'''
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()
@perat

This comment has been minimized.

Copy link

@perat perat commented Feb 7, 2012

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

@jayrambhia

This comment has been minimized.

Copy link
Owner Author

@jayrambhia jayrambhia commented Feb 9, 2012

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

This comment has been minimized.

Copy link

@perat perat commented Feb 10, 2012

I need to do it automatic at machine boot.

@jayrambhia

This comment has been minimized.

Copy link
Owner Author

@jayrambhia jayrambhia commented Feb 10, 2012

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

This comment has been minimized.

Copy link
Owner Author

@jayrambhia jayrambhia commented Feb 10, 2012

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