14
14
void Py_DECREF(object)
16
16
cdef extern from "string.h":
17
int strcmp(signed char *s1, signed char *s2)
17
int strcmp(char *s1, char *s2)
18
18
char *strdup(char *str)
20
20
cdef extern from "xmmsc/xmmsc_idnumbers.h":
68
68
XMMS_PLAYLIST_CHANGED_REMOVE,
69
69
XMMS_PLAYLIST_CHANGED_CLEAR,
70
70
XMMS_PLAYLIST_CHANGED_MOVE,
71
XMMS_PLAYLIST_CHANGED_SORT
71
XMMS_PLAYLIST_CHANGED_SORT,
72
XMMS_PLAYLIST_CHANGED_UPDATE
73
74
ctypedef enum xmms_plugin_type_t:
74
75
XMMS_PLUGIN_TYPE_ALL,
94
95
PLAYLIST_CHANGED_CLEAR = XMMS_PLAYLIST_CHANGED_CLEAR
95
96
PLAYLIST_CHANGED_MOVE = XMMS_PLAYLIST_CHANGED_MOVE
96
97
PLAYLIST_CHANGED_SORT = XMMS_PLAYLIST_CHANGED_SORT
98
PLAYLIST_CHANGED_UPDATE = XMMS_PLAYLIST_CHANGED_UPDATE
98
100
PLUGIN_TYPE_ALL = XMMS_PLUGIN_TYPE_ALL
99
101
PLUGIN_TYPE_XFORM = XMMS_PLUGIN_TYPE_XFORM
129
131
void xmmsc_result_unref(xmmsc_result_t *res)
130
132
void xmmsc_result_notifier_set_full(xmmsc_result_t *res, xmmsc_result_notifier_t func, void *user_data, xmmsc_user_data_free_func_t free_func)
131
133
void xmmsc_result_wait(xmmsc_result_t *res)
132
signed int xmmsc_result_iserror(xmmsc_result_t *res)
133
signed char *xmmsc_result_get_error(xmmsc_result_t *res)
134
int xmmsc_result_iserror(xmmsc_result_t *res)
135
char *xmmsc_result_get_error(xmmsc_result_t *res)
134
136
xmmsc_result_value_type_t xmmsc_result_get_type(xmmsc_result_t *res)
135
137
xmmsc_result_type_t xmmsc_result_get_class(xmmsc_result_t *res)
137
signed int xmmsc_result_get_int(xmmsc_result_t *res, int *r)
138
signed int xmmsc_result_get_uint(xmmsc_result_t *res, unsigned int *r)
139
signed int xmmsc_result_get_string(xmmsc_result_t *res, signed char **r)
140
signed int xmmsc_result_get_bin(xmmsc_result_t *res, unsigned char **r, unsigned int *rlen)
141
signed int xmmsc_result_get_playlist_change(xmmsc_result_t *res, unsigned int *change, unsigned int *id, unsigned int *argument)
142
signed int xmmsc_result_get_collection (xmmsc_result_t *conn, xmmsc_coll_t **coll)
139
int xmmsc_result_get_int(xmmsc_result_t *res, int *r)
140
int xmmsc_result_get_uint(xmmsc_result_t *res, unsigned int *r)
141
int xmmsc_result_get_string(xmmsc_result_t *res, char **r)
142
int xmmsc_result_get_bin(xmmsc_result_t *res, unsigned char **r, unsigned int *rlen)
143
int xmmsc_result_get_playlist_change(xmmsc_result_t *res, unsigned int *change, unsigned int *id, unsigned int *argument)
144
int xmmsc_result_get_collection (xmmsc_result_t *conn, xmmsc_coll_t **coll)
144
146
ctypedef void(*xmmsc_dict_foreach_func)(void *key, xmmsc_result_value_type_t type, void *value, void *user_data)
145
147
ctypedef void(*xmmsc_propdict_foreach_func)(void *key, xmmsc_result_value_type_t type, void *value, char *source, void *user_data)
156
158
xmmsc_connection_t *xmmsc_init(char *clientname)
157
159
void xmmsc_disconnect_callback_set(xmmsc_connection_t *c, object(*callback)(object), object userdata)
158
signed int xmmsc_connect(xmmsc_connection_t *c, signed char *p)
160
int xmmsc_connect(xmmsc_connection_t *c, char *p)
159
161
void xmmsc_unref(xmmsc_connection_t *c)
160
162
xmmsc_result_t *xmmsc_quit(xmmsc_connection_t *conn)
161
163
xmmsc_result_t *xmmsc_plugin_list (xmmsc_connection_t *c, unsigned int type)
163
165
void xmmsc_result_disconnect(xmmsc_result_t *res)
167
int xmmsc_coll_parse (char *pattern, xmmsc_coll_t **coll)
165
169
xmmsc_result_t *xmmsc_playlist_list(xmmsc_connection_t *)
166
170
xmmsc_result_t *xmmsc_playlist_shuffle(xmmsc_connection_t *, char *playlist)
167
171
xmmsc_result_t *xmmsc_playlist_add_args(xmmsc_connection_t *, char *playlist, char *, int, char **)
175
179
xmmsc_result_t *xmmsc_playlist_list_entries(xmmsc_connection_t *, char *playlist)
176
180
xmmsc_result_t *xmmsc_playlist_sort(xmmsc_connection_t *, char *playlist, char **properties)
177
181
xmmsc_result_t *xmmsc_playlist_set_next(xmmsc_connection_t *, int pos)
178
xmmsc_result_t *xmmsc_playlist_set_next_rel(xmmsc_connection_t *, signed int)
179
xmmsc_result_t *xmmsc_playlist_move_entry(xmmsc_connection_t *, char *playlist, unsigned int id, signed int movement)
182
xmmsc_result_t *xmmsc_playlist_set_next_rel(xmmsc_connection_t *, int)
183
xmmsc_result_t *xmmsc_playlist_move_entry(xmmsc_connection_t *, char *playlist, unsigned int id, int movement)
180
184
xmmsc_result_t *xmmsc_playlist_current_pos(xmmsc_connection_t *, char *playlist)
181
185
xmmsc_result_t *xmmsc_playlist_current_active(xmmsc_connection_t *)
182
186
xmmsc_result_t *xmmsc_playlist_insert_args(xmmsc_connection_t *, char *playlist, int pos, char *url, int numargs, char **args)
188
192
xmmsc_result_t *xmmsc_playlist_radd_encoded(xmmsc_connection_t *c, char *, char *path)
190
194
xmmsc_result_t *xmmsc_playlist_load(xmmsc_connection_t *, char *playlist)
191
xmmsc_result_t *xmmsc_playlist_move(xmmsc_connection_t *c, unsigned int id, signed int movement)
195
xmmsc_result_t *xmmsc_playlist_move(xmmsc_connection_t *c, unsigned int id, int movement)
192
196
xmmsc_result_t *xmmsc_playlist_create(xmmsc_connection_t *c, char *playlist)
194
198
xmmsc_result_t *xmmsc_broadcast_playlist_changed(xmmsc_connection_t *c)
226
230
xmmsc_result_t *xmmsc_medialib_playlist_load(xmmsc_connection_t *conn, char *name)
227
231
xmmsc_result_t *xmmsc_medialib_add_entry(xmmsc_connection_t *conn, char *url)
232
xmmsc_result_t *xmmsc_medialib_remove_entry(xmmsc_connection_t *conn, unsigned int id)
228
233
xmmsc_result_t *xmmsc_medialib_add_entry_encoded(xmmsc_connection_t *conn, char *url)
229
234
xmmsc_result_t *xmmsc_medialib_get_info(xmmsc_connection_t *, unsigned int id)
230
235
xmmsc_result_t *xmmsc_medialib_path_import (xmmsc_connection_t *c, char *path)
360
cdef foreach_source_hash(signed char *key, xmmsc_result_value_type_t typ, void *value, char *source, udata):
365
cdef foreach_source_hash(char *key, xmmsc_result_value_type_t typ, void *value, char *source, udata):
361
366
if typ == XMMSC_RESULT_VALUE_TYPE_STRING:
362
367
v = to_unicode(<char *>value)
363
368
elif typ == XMMSC_RESULT_VALUE_TYPE_UINT32:
368
373
udata[(source,key)]=v
370
cdef foreach_hash(signed char *key, xmmsc_result_value_type_t typ, void *value, udata):
375
cdef foreach_hash(char *key, xmmsc_result_value_type_t typ, void *value, udata):
371
376
if typ == XMMSC_RESULT_VALUE_TYPE_STRING:
372
377
v = to_unicode(<char *>value)
373
378
elif typ == XMMSC_RESULT_VALUE_TYPE_UINT32:
429
434
def __repr__(self):
431
for k,v in self.attributes:
436
for k,v in self.attributes.iteritems():
432
437
atr.append("%s=%s" % (k, repr(v)))
433
438
return "%s(%s)" % (self.__class__.__name__,",".join(atr))
539
548
cdef class CollectionAttributes:
540
549
cdef xmmsc_coll_t *coll
542
552
def __new__(self):
544
555
def __dealloc__(self):
545
556
if self.coll != NULL:
546
557
xmmsc_coll_unref(self.coll)
564
xmmsc_coll_attribute_list_first(self.coll)
565
while xmmsc_coll_attribute_list_valid(self.coll):
566
xmmsc_coll_attribute_list_entry(self.coll, &x, &y)
568
xmmsc_coll_attribute_list_next(self.coll)
572
return repr(self._py_dict())
575
return str(self._py_dict())
549
577
def __getitem__(self, name):
551
if not xmmsc_coll_attribute_get(self.coll, name, &val):
552
raise KeyError("No such attribute")
578
ret = self._py_dict()[name]
556
581
def get(self, name, default=None):
563
588
xmmsc_coll_attribute_set(self.coll, name, val)
569
xmmsc_coll_attribute_list_first(self.coll)
570
while xmmsc_coll_attribute_list_valid(self.coll):
571
xmmsc_coll_attribute_list_entry(self.coll, &x, &y)
573
xmmsc_coll_attribute_list_next(self.coll)
591
return self._py_dict().items()
594
return self._py_dict().iteritems()
597
return self._py_dict().keys()
600
return self._py_dict().iterkeys()
603
return self._py_dict().values()
605
def itervalues(self):
606
return self._py_dict().itervalues()
576
608
def __iter__(self):
577
return iter(self.items())
579
return repr(self.items())
609
return iter(self._py_dict())
582
612
# Create a dummy object that can't be accessed
761
791
xmmsc_coll_operand_list_first(coll)
762
792
while xmmsc_coll_operand_list_valid(coll):
763
793
xmmsc_coll_operand_list_entry(coll, &ocoll)
794
xmmsc_coll_ref(ocoll)
764
795
opr.pylist.append(create_coll(ocoll))
765
796
xmmsc_coll_operand_list_next(coll)
766
797
xmmsc_coll_ref(coll)
802
def coll_parse(pattern):
803
cdef xmmsc_coll_t *coll
805
ptrn = from_unicode(pattern)
806
if not xmmsc_coll_parse(ptrn, &coll):
807
raise ValueError('unable to parse pattern')
808
return create_coll(coll)
771
810
cdef class XMMSResult:
773
812
Class containing the results of some operation
787
826
def more_init(self, broadcast = 0):
788
827
self.broadcast = broadcast
790
xmmsc_result_notifier_set_full(self.res, ResultNotifier, <void *>self, ResultFreeer)
830
xmmsc_result_notifier_set_full(self.res, ResultNotifier, <void *>self, ResultFreeer)
831
xmmsc_result_unref(self.res)
793
834
cdef xmmsc_result_t *r
1060
1101
self.disconnect_fun(self)
1062
1103
def exit_loop(self):
1063
""" Exits from the L{loop} call """
1107
Exits from the L{loop} call
1064
1109
self.do_loop = False
1065
1110
write(self.wakeup, "42")
1067
1112
def loop(self):
1069
1116
Main client loop for most python clients. Call this to run the
1070
1117
client once everything has been set up. This function blocks
1071
1118
until L{exit_loop} is called.
1110
1161
return xmmsc_io_out_handle(self.conn)
1112
1163
def want_ioout(self):
1165
want_ioout() -> bool
1113
1167
return xmmsc_io_want_out(self.conn)
1115
1169
def set_need_out_fun(self, fun):
1171
set_need_out_fun(fun)
1116
1173
xmmsc_io_need_out_callback_set(self.conn, python_need_out_fun, self)
1117
1174
self.needout_fun = fun
1119
1176
def get_fd(self):
1121
1180
Get the underlying file descriptor used for communication with
1122
1181
the XMMS2 daemon. You can use this in a client to ensure that
1123
1182
the IPC link is still active and safe to use.(e.g by calling
1130
1189
def connect(self, path = None, disconnect_func = None):
1191
connect([path], [disconnect_func])
1132
1193
Connect to the appropriate IPC path, for communication with the
1133
1194
XMMS2 daemon. This path defaults to /tmp/xmms-ipc-<username> if
1134
1195
not specified. Call this once you have instantiated the object:
1178
1241
def plugin_list(self, typ, cb = None):
1243
plugin_list(typ, [cb]) -> XMMSResult
1180
1245
Get a list of loaded plugins from the server
1181
1246
@rtype: L{XMMSResult}
1182
1247
@return: The result of the operation.
1193
1258
def playback_start(self, cb = None):
1260
playback_start([cb]) -> XMMSResult
1195
1262
Instruct the XMMS2 daemon to start playing the currently
1196
1263
selected file from the playlist.
1197
1264
@rtype: L{XMMSResult}
1225
1294
def playback_tickle(self, cb = None):
1296
playback_tickle([cb]) -> XMMSResult
1227
1298
Instruct the XMMS2 daemon to move on to the next playlist item.
1228
1299
@rtype: L{XMMSResult}
1229
1300
@return: The result of the operation.
1240
1311
def playback_pause(self, cb = None):
1313
playback_pause([cb]) -> XMMSResult
1242
1315
Instruct the XMMS2 daemon to pause playback.
1243
1316
@rtype: L{XMMSResult}
1244
1317
@return: The result of the operation.
1256
1329
def playback_current_id(self, cb = None):
1331
playback_current_id([cb]) -> XMMSResult
1258
1333
@rtype: L{XMMSResult}(UInt)
1259
1334
@return: The medialib id of the item currently selected.
1271
1346
def playback_seek_ms(self, ms, cb = None):
1348
playback_seek_ms(ms, [cb]) -> XMMSResult
1273
1350
Seek to an absolute time position in the current file or
1274
1351
stream in playback.
1275
1352
@rtype: L{XMMSResult}
1288
1365
def playback_seek_ms_rel(self, ms, cb = None):
1367
playback_seek_ms_rel(ms, [cb]) -> XMMSResult
1290
1369
Seek to a time position by the given offset in the current file or
1291
1370
stream in playback.
1292
1371
@rtype: L{XMMSResult}
1305
1384
def playback_seek_samples(self, samples, cb = None):
1386
playback_seek_samples(samples, [cb]) -> XMMSResult
1307
1388
Seek to an absolute number of samples in the current file or
1308
1389
stream in playback.
1309
1390
@rtype: L{XMMSResult}
1322
1403
def playback_seek_samples_rel(self, samples, cb = None):
1405
playback_seek_samples_rel(samples, [cb]) -> XMMSResult
1324
1407
Seek to a number of samples by the given offset in the
1325
1408
current file or stream in playback.
1326
1409
@rtype: L{XMMSResult}
1339
1422
def playback_status(self, cb = None):
1340
"""Get current playback status from XMMS2 daemon. This is
1424
playback_status([cb]) -> XMMSResult
1426
Get current playback status from XMMS2 daemon. This is
1341
1427
essentially the more direct version of
1342
1428
L{broadcast_playback_status}. Possible return values are:
1343
1429
L{PLAYBACK_STATUS_STOP}, L{PLAYBACK_STATUS_PLAY},
1355
1441
def broadcast_playback_status(self, cb = None):
1443
broadcast_playback_status([cb]) -> XMMSResult
1357
1445
Set a method to handle the playback status broadcast from the
1359
1447
@rtype: L{XMMSResult}(UInt)
1371
1459
def broadcast_playback_current_id(self, cb = None):
1461
broadcast_playback_current_id([cb]) -> XMMSResult
1373
1463
Set a method to handle the playback id broadcast from the
1375
1465
@rtype: L{XMMSResult}(UInt)
1387
1477
def playback_playtime(self, cb = None):
1479
playback_playtime([cb]) -> XMMSResult
1389
1481
Return playtime on current file/stream. This is essentially a
1390
1482
more direct version of L{signal_playback_playtime}
1391
1483
@rtype: L{XMMSResult}(UInt)
1404
1496
def signal_playback_playtime(self, cb = None):
1498
signal_playback_playtime([cb]) -> XMMSResult
1406
1500
Set a method to handle the playback playtime signal from the
1408
1502
@rtype: L{XMMSResult}(UInt)
1420
1514
def playback_volume_set(self, channel, volume, cb = None):
1516
playback_volume_set(channel, volume, [cb]) -> XMMSResult
1422
1518
Set the playback volume for specified channel
1423
1519
@rtype: L{XMMSResult}(UInt)
1435
1531
def playback_volume_get(self, cb = None):
1533
playback_volume_get([cb]) -> XMMSResult
1437
1535
Get the playback for all channels
1438
1536
@rtype: L{XMMSResult}(UInt)
1450
1548
def broadcast_playback_volume_changed(self, cb = None):
1550
broadcast_playback_volume_changed([cb]) -> XMMSResult
1452
1552
Set a broadcast callback for volume updates
1453
1553
@rtype: L{XMMSResult}(UInt)
1465
1565
def broadcast_playlist_loaded(self, cb = None):
1567
broadcast_playlist_loaded([cb]) -> XMMSResult
1467
1569
Set a broadcast callback for loaded playlist event
1468
1570
@rtype: L{XMMSResult}(UInt)
1480
1582
def playlist_load(self, playlist = None, cb = None):
1584
playlist_load([playlist], [cb]) -> XMMSResult
1482
1586
Load the playlist as current playlist
1483
1587
@rtype: L{XMMSResult}
1484
1588
@return: The result of the operation.
1519
1625
def playlist_remove(self, playlist = None, cb = None):
1627
playlist_remove([playlist], [cb]) -> XMMSResult
1521
1629
Remove the playlist from the server
1522
1630
@rtype: L{XMMSResult}
1523
1631
@return: The result of the operation.
1540
1648
def playlist_shuffle(self, playlist = None, cb = None):
1650
playlist_shuffle([playlist], [cb]) -> XMMSResult
1542
1652
Instruct the XMMS2 daemon to shuffle the playlist.
1543
1653
@rtype: L{XMMSResult}
1544
1654
@return: The result of the operation.
1561
1671
def playlist_insert_url(self, pos, url, playlist = None, cb = None):
1673
playlist_insert_url(pos, url, [playlist], [cb]) -> XMMSResult
1563
1675
Insert a path or URL to a playable media item to the playlist.
1564
1676
Playable media items may be files or streams.
1565
1677
Requires an int 'pos' and a string 'url' as argument.
1586
1698
def playlist_insert_encoded(self, pos, url, playlist = None, cb = None):
1700
playlist_insert_encoded(pos, url, [playlist], [cb]) -> XMMSResult
1588
1702
Insert a path or URL to a playable media item to the playlist.
1589
1703
Playable media items may be files or streams.
1590
1704
Requires an int 'pos' and a string 'url' as argument.
1614
1728
def playlist_insert_id(self, pos, id, playlist = None, cb = None):
1730
playlist_insert_id(pos, id, [playlist], [cb]) -> XMMSResult
1616
1732
Insert a medialib to the playlist.
1617
1733
Requires an int 'pos' and an int 'id' as argument.
1618
1734
@rtype: L{XMMSResult}
1753
def playlist_insert_collection(self, pos, coll, order = None, playlist = None, cb = None):
1755
playlist_insert_collection(pos, coll, [order], [playlist], [cb]) -> XMMSResult
1757
Insert the content of a collection to the playlist.
1758
Requires an int 'pos' and an int 'id' as argument.
1759
@rtype: L{XMMSResult}
1760
@return: The result of the operation.
1764
cdef _ListConverter orderflds
1769
orderflds = _ListConverter(order)
1771
c = <Collection> coll
1772
ret = XMMSResult(self)
1775
if playlist is not None:
1776
pl = from_unicode(playlist)
1777
ret.res = xmmsc_playlist_insert_collection(self.conn, pl, pos, c.coll, orderflds.lst)
1779
ret.res = xmmsc_playlist_insert_collection(self.conn, NULL, pos, c.coll, orderflds.lst)
1636
1785
def playlist_radd(self, url, playlist = None, cb = None):
1787
playlist_radd(url, [playlist], [cb]) -> XMMSResult
1638
1789
Add a directory to the playlist.
1639
1790
Requires a string 'url' as argument.
1640
1791
@rtype: L{XMMSResult}
1659
1810
def playlist_radd_encoded(self, url, playlist = None, cb = None):
1812
playlist_radd_encoded(url, [playlist], [cb]) -> XMMSResult
1661
1814
Add a directory to the playlist.
1662
1815
Requires a string 'url' as argument.
1663
1816
'url' argument has to be medialib encoded.
1683
1836
def playlist_add_url(self, url, playlist = None, cb = None):
1838
playlist_add_url(url, [playlist], [cb]) -> XMMSResult
1685
1840
Add a path or URL to a playable media item to the playlist.
1686
1841
Playable media items may be files or streams.
1687
1842
Requires a string 'url' as argument.
1707
1862
def playlist_add_encoded(self, url, playlist = None, cb = None):
1864
playlist_add_encoded(url, [playlist], [cb]) -> XMMSResult
1709
1866
Add a path or URL to a playable media item to the playlist.
1710
1867
Playable media items may be files or streams.
1711
1868
The 'url' has to be medialib encoded.
1733
1890
def playlist_add_id(self, id, playlist = None, cb = None):
1892
playlist_add_id(id, [playlist], [cb]) -> XMMSResult
1735
1894
Add a medialib id to the playlist.
1736
1895
@rtype: L{XMMSResult}
1737
1896
@return: The result of the operation.
1914
def playlist_add_collection(self, coll, order = None, playlist = None, cb = None):
1916
playlist_add_collection(coll, [order], [playlist], [cb]) -> XMMSResult
1918
Add the content of a collection to the playlist.
1919
@rtype: L{XMMSResult}
1920
@return: The result of the operation.
1924
cdef _ListConverter orderflds
1929
orderflds = _ListConverter(order)
1931
c = <Collection> coll
1932
ret = XMMSResult(self)
1935
if playlist is not None:
1936
pl = from_unicode(playlist)
1937
ret.res = xmmsc_playlist_add_collection(self.conn, pl, c.coll, orderflds.lst)
1939
ret.res = xmmsc_playlist_add_collection(self.conn, NULL, c.coll, orderflds.lst)
1755
1946
def playlist_remove_entry(self, id, playlist = None, cb = None):
1948
playlist_remove_entry(id, [playlist], [cb]) -> XMMSResult
1757
1950
Remove a certain media item from the playlist.
1758
1951
Requires a number 'id' as argument.
1759
1952
@rtype: L{XMMSResult}
1777
1970
def playlist_clear(self, playlist = None, cb = None):
1972
playlist_clear([playlist], [cb]) -> XMMSResult
1779
1974
Clear the playlist.
1780
1975
@rtype: L{XMMSResult}
1781
1976
@return: The result of the operation.
1797
1992
def playlist_list_entries(self, playlist = None, cb = None):
1994
playlist_list_entries([playlist], [cb]) -> XMMSResult
1799
1996
Get the current playlist. This function returns a list of IDs
1800
1997
of the files/streams currently in the playlist. Use
1801
1998
L{medialib_get_info} to retrieve more specific information.
1821
2018
def playlist_sort(self, props, playlist = None, cb = None):
2020
playlist_sort(props, [playlist], [cb]) -> XMMSResult
1823
2022
Sorts the playlist according to the properties specified.
1824
2023
@rtype: L{XMMSResult}
1825
2024
@return: The result of the operation.
1844
2043
def playlist_set_next_rel(self, position, cb = None):
2045
playlist_set_next_rel(position, [cb]) -> XMMSResult
1846
2047
Sets the position in the playlist. Same as L{playlist_set_next}
1847
2048
but sets the next position relative to the current position.
1848
2049
You can do set_next_rel(-1) to move backwards for example.
1862
2063
def playlist_set_next(self, position, cb = None):
2065
playlist_set_next(position, [cb]) -> XMMSResult
1864
2067
Sets the position to move to, next, in the playlist. Calling
1865
2068
L{playback_tickle} will perform the jump to that position.
1866
2069
@rtype: L{XMMSResult}
1878
2081
def playlist_move(self, cur_pos, new_pos, playlist = None, cb = None):
2083
playlist_move(cur_pos, new_pos, [playlist], [cb]) -> XMMSResult
1880
2085
Moves a playlist entry to a new position.
1881
2086
@rtype: L{XMMSResult}
1882
2087
@return: The result of the operation.
1917
2124
def playlist_current_pos(self, playlist = None, cb = None):
2126
playlist_current_pos([playlist], [cb]) -> XMMSResult
1919
2128
Returns the current position in the playlist. This value will
1920
2129
always be equal to, or larger than 0. The first entry in the
1953
2164
def broadcast_playlist_current_pos(self, cb = None):
2166
broadcast_playlist_current_pos([cb]) -> XMMSResult
1955
2168
Set a method to handle the playlist current position updates
1956
2169
from the XMMS2 daemon. This is triggered whenever the daemon
1957
2170
jumps from one playlist position to another. (not when moving
1971
2184
def broadcast_playlist_changed(self, cb = None):
2186
broadcast_playlist_changed([cb]) -> XMMSResult
1973
2188
Set a method to handle the playlist changed broadcast from the
1974
2189
XMMS2 daemon. Updated data is sent whenever the daemon's
1975
2190
playlist changes.
1988
2203
def broadcast_configval_changed(self, cb = None):
2205
broadcast_configval_changed([cb]) -> XMMSResult
1990
2207
Set a method to handle the config value changed broadcast
1991
2208
from the XMMS2 daemon.(i.e. some configuration value has
1992
2209
been modified) Updated data is sent whenever a config
2006
2223
def configval_set(self, key, val, cb = None):
2225
configval_set(key, val, [cb]) -> XMMSResult
2008
2227
Set a configuration value on the daemon, given a key.
2009
2228
@rtype: L{XMMSResult}
2010
2229
@return: The result of the operation.
2024
2243
def configval_get(self, key, cb = None):
2245
configval_get(key, [cb]) -> XMMSResult
2026
2247
Get the configuration value of a given key, from the daemon.
2027
2248
@rtype: L{XMMSResult}(String)
2028
2249
@return: The result of the operation.
2041
2262
def configval_list(self, cb = None):
2264
configval_list([cb]) -> XMMSResult
2043
2266
Get list of configuration keys on the daemon. Use
2044
2267
L{configval_get} to retrieve the values corresponding to the
2045
2268
configuration keys.
2058
2281
def configval_register(self, valuename, defaultvalue, cb = None):
2283
configval_register(valuename, defaultvalue, [cb]) -> XMMSResult
2060
2285
Register a new configvalue.
2061
2286
This should be called in the initcode as XMMS2 won't allow
2062
2287
set/get on values that haven't been registered.
2078
2303
def medialib_add_entry(self, file, cb = None):
2305
medialib_add_entry(file, [cb]) -> XMMSResult
2080
2307
Add an entry to the MediaLib.
2081
2308
@rtype: L{XMMSResult}
2082
2309
@return: The result of the operation.
2095
2322
def medialib_add_entry_encoded(self, file, cb = None):
2324
medialib_add_entry_encoded(file, [cb]) -> XMMSResult
2097
2326
Add an entry to the MediaLib.
2098
2327
Exactly the same as #medialib_add_entry but takes
2099
2328
a encoded url instead.
2111
2340
ret.more_init()
2343
def medialib_remove_entry(self, id, cb=None):
2345
medialib_remove_entry(id, [cb]) -> XMMSResult
2347
Remove an entry from the medialib.
2348
@rtype: L{XMMSResult}
2349
@return: The result of the operation.
2353
ret = XMMSResult(self)
2356
ret.res = xmmsc_medialib_remove_entry(self.conn, id)
2114
2360
def medialib_get_info(self, id, cb = None):
2362
medialib_get_info(id, [cb]) -> XMMSResult
2116
2364
@rtype: L{XMMSResult}(HashTable)
2117
2365
@return: Information about the medialib entry position
2130
2378
def medialib_rehash(self, id = 0, cb = None):
2380
medialib_rehash([id], [cb]) -> XMMSResult
2132
2382
Force the medialib to check that metadata stored is up to
2134
2384
@rtype: L{XMMSResult}
2147
2397
def medialib_get_id(self, url, cb = None):
2399
medialib_get_id(url, [cb]) -> XMMSResult
2149
2401
Search for an entry (URL) in the medialib and return its ID
2151
2403
@rtype: L{XMMSResult}
2164
2416
def medialib_path_import(self, path, cb = None):
2418
medialib_path_import(path, [cb]) -> XMMSResult
2166
2420
Import metadata from all files recursively from the directory
2167
2421
passed as argument.
2168
2422
@rtype: L{XMMSResult}
2183
2437
def medialib_path_import_encoded(self, path, cb = None):
2439
medialib_path_import_encoded(path, [cb]) -> XMMSResult
2185
2441
Import metadata from all files recursively from the directory
2186
2442
passed as argument. The 'path' argument has to be medialib encoded.
2187
2443
@rtype: L{XMMSResult}
2203
2459
def medialib_property_set(self, id, key, value, source=None, cb=None):
2461
medialib_property_set(id, key, value, [source], [cb]) -> XMMSResult
2205
2463
Associate a value with a medialib entry. Source is optional.
2206
2464
@rtype: L{XMMSResult}
2207
2465
@return: The result of the operation.
2232
2490
def medialib_property_remove(self, id, key, source=None, cb=None):
2492
medialib_property_remove(id, key, [source], [cb]) -> XMMSResult
2234
2494
Remove a value from a medialib entry. Source is optional.
2235
2495
@rtype: L{XMMSResult}
2236
2496
@return: The result of the operation.
2254
2514
def broadcast_medialib_entry_added(self, cb = None):
2516
broadcast_medialib_entry_added([cb]) -> XMMSResult
2256
2518
Set a method to handle the medialib entry added broadcast
2257
2519
from the XMMS2 daemon. (i.e. a new entry has been added)
2258
2520
@rtype: L{XMMSResult}
2270
2532
def broadcast_medialib_entry_changed(self, cb = None):
2534
broadcast_medialib_entry_changed([cb]) -> XMMSResult
2272
2536
Set a method to handle the medialib entry changed broadcast
2273
2537
from the XMMS2 daemon.
2274
2538
Updated data is sent when the metadata for a song is updated
2303
2569
def signal_mediainfo_reader_unindexed(self, cb = None):
2571
signal_mediainfo_reader_unindexed([cb]) -> XMMSResult
2305
2573
Tell daemon to send you the number of unindexed files in the mlib
2306
2574
@rtype: L{XMMSResult}
2307
2575
@return: The result of the operation.
2317
2585
def broadcast_mediainfo_reader_status(self, cb = None):
2587
broadcast_mediainfo_reader_status([cb]) -> XMMSResult
2319
2589
Tell daemon to send you the status of the mediainfo reader
2320
2590
@rtype: L{XMMSResult}
2321
2591
@return: The result of the operation.
2331
2601
def xform_media_browse(self, url, cb=None):
2603
xform_media_browse(url, [cb]) -> XMMSResult
2333
2605
Browse files from xform plugins.
2334
2606
@rtype: L{XMMSResult}
2335
2607
@return: The result of the operation.
2349
2621
def coll_get(self, name, ns, cb=None):
2623
coll_get(name, ns, [cb]) -> XMMSResult
2351
2625
Retrieve a Collection
2352
2626
@rtype: L{XMMSResult}
2353
2627
@return: The result of the operation.
2360
2634
n = XMMS_COLLECTION_NS_PLAYLISTS
2362
2636
raise ValueError("Bad namespace")
2638
nam = from_unicode(name)
2364
2640
ret = XMMSResult(self)
2365
2641
ret.callback = cb
2366
ret.res = xmmsc_coll_get(self.conn, name, n)
2642
ret.res = xmmsc_coll_get(self.conn, nam, n)
2368
2644
ret.more_init()
2371
2647
def coll_list(self, ns="*", cb=None):
2649
coll_list(name, [ns], [cb]) -> XMMSResult
2373
2651
List collections
2374
2652
@rtype: L{XMMSResult}
2375
2653
@return: The result of the operation.
2394
2672
def coll_save(self, Collection coll, name, ns, cb=None):
2674
coll_save(coll, name, ns, [cb]) -> XMMSResult
2396
2676
Save a collection on server.
2397
2677
@rtype: L{XMMSResult}
2398
2678
@return: The result of the operation.
2407
2687
raise ValueError("Bad namespace")
2689
nam = from_unicode(name)
2409
2691
ret = XMMSResult(self)
2410
2692
ret.callback = cb
2411
ret.res = xmmsc_coll_save(self.conn, coll.coll, name, n)
2693
ret.res = xmmsc_coll_save(self.conn, coll.coll, nam, n)
2412
2694
ret.more_init()
2415
2697
def coll_remove(self, name, ns, cb=None):
2699
coll_remove(name, ns, [cb]) -> XMMSResult
2417
2701
Remove a collection on server.
2418
2702
@rtype: L{XMMSResult}
2419
2703
@return: The result of the operation.
2428
2712
raise ValueError("Bad namespace")
2714
nam = from_unicode(name)
2430
2716
ret = XMMSResult(self)
2431
2717
ret.callback = cb
2432
ret.res = xmmsc_coll_remove(self.conn, name, n)
2718
ret.res = xmmsc_coll_remove(self.conn, nam, n)
2434
2720
ret.more_init()
2438
2724
def coll_rename(self, oldname, newname, ns, cb=None):
2726
coll_rename(oldname, newname, ns, [cb]) -> XMMSResult
2440
2728
Change the name of a Collection.
2441
2729
@rtype: L{XMMSResult}
2442
2730
@return: The result of the operation.
2451
2739
raise ValueError("Bad namespace")
2741
oldnam = from_unicode(oldname)
2742
newnam = from_unicode(newname)
2453
2744
ret = XMMSResult(self)
2454
2745
ret.callback = cb
2455
ret.res = xmmsc_coll_rename(self.conn, oldname, newname, n)
2746
ret.res = xmmsc_coll_rename(self.conn, oldnam, newnam, n)
2457
2748
ret.more_init()
2460
2751
def coll_query_ids(self, coll, start=0, leng=0, order=None, cb=None):
2753
coll_query_ids(coll, [start], [leng], [order], [cb]) -> XMMSResult
2462
2755
Retrive a list of ids of the media matching the collection
2463
2756
@rtype: L{XMMSResult}
2464
2757
@return: The result of the operation.
2484
2777
def coll_query_infos(self, coll, fields, start=0, leng=0, order=None, groupby=None, cb=None):
2779
coll_query_infos(coll, fields, [start], [leng], [order], [groupby], [cb]) -> XMMSResult
2486
2781
Retrive a list of mediainfo of the media matching the collection
2487
2782
@rtype: L{XMMSResult}
2488
2783
@return: The result of the operation.
2516
2811
def bindata_add(self, data, cb=None):
2813
bindata_add(data, [cb]) -> XMMSResult
2518
2815
Add a datafile to the server
2519
2816
@rtype: L{XMMSResult}
2520
2817
@return: The result of the operation.
2532
2829
def bindata_retrieve(self, hash, cb=None):
2831
bindata_retrieve(hash, [cb]) -> XMMSResult
2534
2833
Retrieve a datafile from the server
2535
2834
@rtype: L{XMMSResult}
2536
2835
@return: The result of the operation.
2548
2847
def bindata_remove(self, hash, cb=None):
2849
bindata_remove(hash, [cb]) -> XMMSResult
2550
2851
Remove a datafile from the server
2551
2852
@rtype: L{XMMSResult}
2552
2853
@return: The result of the operation.