2 import findrox
; findrox
.version(2, 0, 0)
6 __builtins__
._ = rox
.i18n
.translation(os
.path
.join(rox
.app_dir
, 'Messages'))
8 from optparse
import OptionParser
10 parser
= OptionParser()
11 parser
.add_option("--options",
12 action
="store_true", dest
="options", default
=False,
13 help="display options dialog without running application")
15 parser
.add_option("-l", "--load",
16 action
="store_true", dest
="load_songs", default
=False,
17 help="replace the current playlist with listed songs and start playing")
19 parser
.add_option("-e", "--enqueue",
20 action
="store_true", dest
="add_songs", default
=False,
21 help="add listed songs to the playlist, do not start playing")
23 parser
.add_option("-p", "--play",
24 action
="store_true", dest
="play", default
=False,
25 help="start playing the current song")
27 parser
.add_option("--pause",
28 action
="store_true", dest
="pause", default
=False,
31 parser
.add_option("--stop",
32 action
="store_true", dest
="stop", default
=False,
35 parser
.add_option("--next",
36 action
="store_true", dest
="next", default
=False,
37 help="skip to the next song and start playing.")
39 parser
.add_option("--prev",
40 action
="store_true", dest
="prev", default
=False,
41 help="play the previous song")
43 (options
, args
) = parser
.parse_args()
45 import gtk
, musicbox
, xsoap
51 #see if another instance is running and pass it our args
52 window
= xsoap
.get_server("_ROX_MUSICBOX")
54 cmd
= "load_songs" #default action
55 for opt
in options
.__dict
__: #probably abusing optparse here, but I can see no
56 if options
.__dict
__[opt
]: #other way to enumerate the options
58 break #we don't support more than one, so stop at the first one.
59 xsoap
.send_message(window
, cmd
, args
)
61 #if not then start a new instance
64 box
= musicbox
.MusicBox()
69 rox
.report_exception()