2
# XMMS2 - X Music Multiplexer System
3
# Copyright (C) 2003-2006 XMMS2 Team
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU Lesser General Public
7
# License as published by the Free Software Foundation; either
8
# version 2.1 of the License, or (at your option) any later version.
10
# This library is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# Lesser General Public License for more details.
15
# This file is a part of the XMMS2 client tutorial #2
16
# Here we will learn to retrieve results from a command
23
The first part of this program is
24
commented in tut1.py See that one for
28
xmms = xmmsclient.XMMS("tutorial2")
30
xmms.connect(os.getenv("XMMS_PATH"))
31
except IOError, detail:
32
print "Connection failed:", detail
36
Now we send a command that will return
37
a result. Let's find out which entry
40
Note that this program has be run while
41
xmms2 is playing something, otherwise
42
XMMS.playback_current_id will return 0.
44
result = xmms.playback_current_id()
47
We are still doing sync operations, wait for the
53
Also this time we need to check for errors.
54
Errors can occur on all commands, but not signals
55
and broadcasts. We will talk about these later.
58
print "playback current id returns error, %s" % result.get_error()
61
Let's retrieve the value from the XMMSResult object.
62
You don't have to know what type of value is returned
63
in response to which command - simply call
66
In this case XMMS.playback_current_id will return a UINT
71
print "Currently playing id is %d" % id