From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 5/5] Remove test-media-player
Date: Tue, 4 Oct 2011 01:01:18 +0300 [thread overview]
Message-ID: <1317679278-19471-5-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1317679278-19471-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/test-media-player | 108 ------------------------------------------------
1 files changed, 0 insertions(+), 108 deletions(-)
delete mode 100755 test/test-media-player
diff --git a/test/test-media-player b/test/test-media-player
deleted file mode 100755
index 712cf31..0000000
--- a/test/test-media-player
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import dbus
-from optparse import OptionParser, make_option
-
-USAGE = "Usage: %prog [options] <command> [args]"
-COMMANDS = """
-Commands:
- changetrack <bdaddr> <key> <value> [<key> <value> ...]
-
- changeplayback <bdaddr> status elapsed-time
- status: one of playing, stopped, paused, forward-seek, reverse-seek
- or error.
- elapsed-time: in milliseconds
-
- setproperty <bdaddr> property value
- setting: one of Equalizer, Repeat, Shuffle or Scan
- value: value correspondent to the setting specified
-"""
-
-class MyParser(OptionParser):
- def format_epilog(self, formatter):
- return self.epilog
-
-bus = dbus.SystemBus()
-
-manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.bluez.Manager")
-
-option_list = [
- make_option("-i", "--device", action="store",
- type="string", dest="dev_id"),
- ]
-parser = MyParser(option_list=option_list, usage=USAGE, epilog=COMMANDS)
-
-(options, args) = parser.parse_args()
-
-if len(args) < 2:
- parser.print_help()
- sys.exit(1)
-
-if options.dev_id:
- adapter_path = manager.FindAdapter(options.dev_id)
-else:
- adapter_path = manager.DefaultAdapter()
-
-adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
- "org.bluez.Adapter")
-
-device = adapter.FindDevice(args[1])
-control = dbus.Interface(bus.get_object("org.bluez", device),
- "org.bluez.Control")
-mp = dbus.Interface(bus.get_object("org.bluez", device),
- "org.bluez.MediaPlayer")
-
-def handle_change_track(mp, args):
- if len(args) % 2 != 0:
- print("Don't know how to handle odd number of parameters")
- print(USAGE)
- sys.exit(1)
-
- d = dict()
- for i in range(2, len(args), 2):
- key = args[i]
- if key == "Title" or key == "Artist" or key == "Album" \
- or key == "Genre":
- d[key] = dbus.String(args[i + 1].decode(sys.stdin.encoding))
- elif key == "NumberOfTracks" or key == "TrackNumber" \
- or key == "TrackDuration":
- d[key] = dbus.UInt32(int(args[i + 1]))
- else:
- print("Unknown metadata: %s" % key)
- sys.exit(1)
-
- d = dbus.Dictionary(d, signature='sv')
- mp.ChangeTrack(d)
-
-def handle_change_playback(mp, args):
- if len(args) != 4:
- print(USAGE)
- sys.exit(1)
-
- status = dbus.String(args[2])
- elapsed = dbus.UInt32(long(args[3]))
-
- mp.ChangePlayback(status, elapsed)
-
-def handle_set_property(mp, args):
- if len(args) != 4:
- print(USAGE)
- sys.exit(1)
-
- prop = dbus.String(args[2])
- value = dbus.String(args[3])
-
- mp.SetProperty(prop, value)
-
-
-handlers = { 'changetrack': handle_change_track,
- 'changeplayback': handle_change_playback,
- 'setproperty': handle_set_property }
-
-if not args[0] in handlers:
- print("Unknown command -- %s" % argv[1])
- print(USAGE)
- sys.exit(1)
-
-handlers[args[0]](mp, args)
--
1.7.6.4
prev parent reply other threads:[~2011-10-03 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 22:01 [PATCH BlueZ 1/5] Fix not being able to register pdu handlers Luiz Augusto von Dentz
2011-10-03 22:01 ` [PATCH BlueZ 2/5] AVRCP: move MediaPlayer to adapter object Luiz Augusto von Dentz
2011-10-04 0:32 ` Lucas De Marchi
2011-10-03 22:01 ` [PATCH BlueZ 3/5] Add simple-player test script Luiz Augusto von Dentz
2011-10-03 22:01 ` [PATCH BlueZ 4/5] Remove MediaPlayer interface from control-api.txt Luiz Augusto von Dentz
2011-10-03 22:01 ` Luiz Augusto von Dentz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317679278-19471-5-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).