aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/xmms2_controls/next
blob: 9a4c3fc60518522b7b152a3e91cda98bade22eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python

import xmmsclient
class Xmms2():
    def __init__(self):
        self._xmms = xmmsclient.XMMS()
        self._xmms.connect()

    def next(self):
        result = self._xmms.playlist_current_pos()
        result.wait()
        pos = result.value()['position']
        result = self._xmms.playlist_list_entries()
        result.wait()
        length = len(result.value())
        if pos == (length - 1):
            self._xmms.playback_stop().wait()
            self._xmms.playlist_set_next(0).wait()
        else:
            self._xmms.playlist_set_next_rel(1)
            self._xmms.playback_tickle().wait()

xmms2 = Xmms2()
xmms2.next()


# OLD:
##!/bin/bash
#exec nyxmms2 next