diff options
26 files changed, 99 insertions, 0 deletions
diff --git a/scripts/xmms2_controls/ffwd b/scripts/xmms2_controls/ffwd new file mode 100755 index 0000000..02062ad --- /dev/null +++ b/scripts/xmms2_controls/ffwd @@ -0,0 +1,2 @@ +#!/bin/bash +exec nyxmms2 seek +15 diff --git a/scripts/xmms2_controls/frwd b/scripts/xmms2_controls/frwd new file mode 100755 index 0000000..56318a6 --- /dev/null +++ b/scripts/xmms2_controls/frwd @@ -0,0 +1,2 @@ +#!/bin/bash +exec nyxmms2 seek -15 diff --git a/scripts/xmms2_controls/lib/__init__.py b/scripts/xmms2_controls/lib/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scripts/xmms2_controls/lib/__init__.py diff --git a/scripts/xmms2_controls/lib/xmms2_current_file.py b/scripts/xmms2_controls/lib/xmms2_current_file.py new file mode 100755 index 0000000..c1742ab --- /dev/null +++ b/scripts/xmms2_controls/lib/xmms2_current_file.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import xmmsclient +import urllib + +def waitval(result): + result.wait() + return result.value() + +def currentfile(): + client = xmmsclient.XMMS() + client.connect() + dic = waitval(client.medialib_get_info( + waitval(client.playback_current_id()))) + url = '' + if 'url' in dic: + url = urllib.unquote_plus(str(dic['url'])).decode('utf8') + if url.startswith('file://'): + url = url[7:] + return url + +if __name__ == '__main__': + print(currentfile().encode('utf-8')) diff --git a/scripts/xmms2_controls/mff b/scripts/xmms2_controls/mff new file mode 120000 index 0000000..e66c8e0 --- /dev/null +++ b/scripts/xmms2_controls/mff @@ -0,0 +1 @@ +ffwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/mffwd b/scripts/xmms2_controls/mffwd new file mode 120000 index 0000000..e66c8e0 --- /dev/null +++ b/scripts/xmms2_controls/mffwd @@ -0,0 +1 @@ +ffwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/mfr b/scripts/xmms2_controls/mfr new file mode 120000 index 0000000..813e5d1 --- /dev/null +++ b/scripts/xmms2_controls/mfr @@ -0,0 +1 @@ +frwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/mfrwd b/scripts/xmms2_controls/mfrwd new file mode 120000 index 0000000..813e5d1 --- /dev/null +++ b/scripts/xmms2_controls/mfrwd @@ -0,0 +1 @@ +frwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/mn b/scripts/xmms2_controls/mn new file mode 120000 index 0000000..ab4cc30 --- /dev/null +++ b/scripts/xmms2_controls/mn @@ -0,0 +1 @@ +next
\ No newline at end of file diff --git a/scripts/xmms2_controls/mnext b/scripts/xmms2_controls/mnext new file mode 120000 index 0000000..ab4cc30 --- /dev/null +++ b/scripts/xmms2_controls/mnext @@ -0,0 +1 @@ +next
\ No newline at end of file diff --git a/scripts/xmms2_controls/mpause b/scripts/xmms2_controls/mpause new file mode 120000 index 0000000..29ba073 --- /dev/null +++ b/scripts/xmms2_controls/mpause @@ -0,0 +1 @@ +pause
\ No newline at end of file diff --git a/scripts/xmms2_controls/mprev b/scripts/xmms2_controls/mprev new file mode 120000 index 0000000..e0f3505 --- /dev/null +++ b/scripts/xmms2_controls/mprev @@ -0,0 +1 @@ +prev
\ No newline at end of file diff --git a/scripts/xmms2_controls/mtoggle b/scripts/xmms2_controls/mtoggle new file mode 120000 index 0000000..4ade542 --- /dev/null +++ b/scripts/xmms2_controls/mtoggle @@ -0,0 +1 @@ +play
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-alienize b/scripts/xmms2_controls/music-alienize new file mode 100755 index 0000000..61841f3 --- /dev/null +++ b/scripts/xmms2_controls/music-alienize @@ -0,0 +1,13 @@ +#!/usr/bin/python + +import os.path +#import sys +#sys.path.append(os.path.join(os.path.expanduser('~'),'bin', 'lib')) +from lib import xmms2_current_file + +if __name__ == '__main__': + f = xmms2_current_file.currentfile() + path = os.path.join(os.path.expanduser('~'), 'music/alienize') + with open(path, 'ab') as fo: + fo.write(f) + fo.write('\n') diff --git a/scripts/xmms2_controls/music-ffwd b/scripts/xmms2_controls/music-ffwd new file mode 120000 index 0000000..e66c8e0 --- /dev/null +++ b/scripts/xmms2_controls/music-ffwd @@ -0,0 +1 @@ +ffwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-frwd b/scripts/xmms2_controls/music-frwd new file mode 120000 index 0000000..813e5d1 --- /dev/null +++ b/scripts/xmms2_controls/music-frwd @@ -0,0 +1 @@ +frwd
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-next b/scripts/xmms2_controls/music-next new file mode 120000 index 0000000..ab4cc30 --- /dev/null +++ b/scripts/xmms2_controls/music-next @@ -0,0 +1 @@ +next
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-pause b/scripts/xmms2_controls/music-pause new file mode 120000 index 0000000..29ba073 --- /dev/null +++ b/scripts/xmms2_controls/music-pause @@ -0,0 +1 @@ +pause
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-play b/scripts/xmms2_controls/music-play new file mode 120000 index 0000000..4ade542 --- /dev/null +++ b/scripts/xmms2_controls/music-play @@ -0,0 +1 @@ +play
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-prev b/scripts/xmms2_controls/music-prev new file mode 120000 index 0000000..e0f3505 --- /dev/null +++ b/scripts/xmms2_controls/music-prev @@ -0,0 +1 @@ +prev
\ No newline at end of file diff --git a/scripts/xmms2_controls/music-status b/scripts/xmms2_controls/music-status new file mode 120000 index 0000000..c174243 --- /dev/null +++ b/scripts/xmms2_controls/music-status @@ -0,0 +1 @@ +playing-status
\ No newline at end of file diff --git a/scripts/xmms2_controls/next b/scripts/xmms2_controls/next new file mode 100755 index 0000000..9a4c3fc --- /dev/null +++ b/scripts/xmms2_controls/next @@ -0,0 +1,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 + diff --git a/scripts/xmms2_controls/pause b/scripts/xmms2_controls/pause new file mode 100755 index 0000000..d04c3a0 --- /dev/null +++ b/scripts/xmms2_controls/pause @@ -0,0 +1,2 @@ +#!/bin/bash +exec nyxmms2 pause diff --git a/scripts/xmms2_controls/play b/scripts/xmms2_controls/play new file mode 100755 index 0000000..ae6b557 --- /dev/null +++ b/scripts/xmms2_controls/play @@ -0,0 +1,2 @@ +#!/bin/bash +exec nyxmms2 toggle diff --git a/scripts/xmms2_controls/playing-status b/scripts/xmms2_controls/playing-status new file mode 100755 index 0000000..456d4cc --- /dev/null +++ b/scripts/xmms2_controls/playing-status @@ -0,0 +1,7 @@ +#!/bin/bash + +# this wrapper is needed, since inside awesome environment, python does not +# know how to encode output (sys.stdout.encoding is None and defaults to +# ascii). +PYTHONIOENCODING=utf-8 python ~/bin/xmms2-status + diff --git a/scripts/xmms2_controls/prev b/scripts/xmms2_controls/prev new file mode 100755 index 0000000..b8a966b --- /dev/null +++ b/scripts/xmms2_controls/prev @@ -0,0 +1,2 @@ +#!/bin/bash +exec nyxmms2 prev |