def main(): "Entry point for the CLI DBus interface." args = docopt(__doc__, version="0.2") util.init_logger(args["--log"], args["-v"], args["--quiet"]) dbus = DBusClient() if args["toggle"]: dbus.playpause() elif args["next"]: dbus.next() elif args["prev"]: dbus.prev() elif args["play"]: dbus.play() elif args["pause"]: dbus.pause() elif args["stop"]: dbus.stop() if args["openuri"]: dbus.open_uri(args["<uri>"]) elif args["seek"]: dbus.seek(args["<secs>"]) elif args["setpos"]: dbus.set_pos(args["<pos>"]) if args["title"]: print(dbus.get_song_title()) elif args["artist"]: print(dbus.get_song_artist()) elif args["status"]: print(dbus.get_song_status()) elif args["all"]: dbus.print_info() elif args["get"]: length = dbus.get_song_length() m, s = divmod(length, 60) if args["length"]: print("{}m{}s ({})".format(m, s, length)) else: rating = dbus.get_property("Metadata")["xesam:autoRating"] artist = dbus.get_song_artist() title = dbus.get_song_title() album = dbus.get_song_album() state = dbus.get_song_status() print("{} - {} ({}), {}m{}s, {} ({})".format(artist, title, album, m, s, rating, state))
def main(): """Entry point for the CLI DBus interface.""" args = docopt(__doc__, version="0.3") util.init_logger(args["--log"], args["-v"], args["--quiet"]) dbus = DBusClient() if args["toggle"]: dbus.playpause() elif args["next"]: dbus.next() elif args["prev"]: dbus.prev() elif args["play"]: dbus.play() elif args["pause"]: dbus.pause() elif args["stop"]: dbus.stop() if args["openuri"]: dbus.open_uri(args["<uri>"]) elif args["seek"]: dbus.seek(args["<secs>"]) elif args["setpos"]: dbus.set_pos(args["<pos>"]) if args["title"]: print(dbus.get_song_title()) elif args["artist"]: print(dbus.get_song_artist()) elif args["status"]: print(dbus.get_song_status()) elif args["all"]: dbus.print_info() elif args["get"]: length = dbus.get_song_length() m, s = divmod(length, 60) if args["length"]: print("{}m{}s ({})".format(m, s, length)) else: rating = dbus.get_property("Metadata")["xesam:autoRating"] artist = dbus.get_song_artist() title = dbus.get_song_title() album = dbus.get_song_album() state = dbus.get_song_status() print("{} - {} ({}), {}m{}s, {} ({})".format( artist, title, album, m, s, rating, state))