librespot: fix default.py, move fifo to /var/run/librespot

This commit is contained in:
awiouy 2017-12-06 22:41:08 +01:00
parent fb3975758f
commit d019b64b78
4 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,7 @@
108
- Correct bug which prevented disabling the service from Kodi
- Place named pipe in /var/run/librespot
107 107
- Update to ddfc28f - Update to ddfc28f

View File

@ -19,7 +19,7 @@
PKG_NAME="librespot" PKG_NAME="librespot"
PKG_VERSION="ddfc28f" PKG_VERSION="ddfc28f"
PKG_REV="107" PKG_REV="108"
PKG_ARCH="any" PKG_ARCH="any"
PKG_LICENSE="MIT" PKG_LICENSE="MIT"
PKG_SITE="https://github.com/plietar/$PKG_NAME/" PKG_SITE="https://github.com/plietar/$PKG_NAME/"

View File

@ -119,6 +119,6 @@ if [ -z "$(pactl list short modules | grep source=$LS_SINK.monitor)" ]; then
destination_ip=127.0.0.1 port="$LS_PORT" source_ip=127.0.0.1 > /dev/null destination_ip=127.0.0.1 port="$LS_PORT" source_ip=127.0.0.1 > /dev/null
fi fi
export LS_FIFO="$ADDON_DIR/rc" export LS_FIFO="/var/run/librespot"
eval $LIBRESPOT eval $LIBRESPOT

View File

@ -25,6 +25,7 @@ import xbmc
import xbmcaddon import xbmcaddon
import xbmcgui import xbmcgui
PORT = '6666' PORT = '6666'
SINK = 'librespot_sink' SINK = 'librespot_sink'
@ -38,7 +39,7 @@ def systemctl(command):
class Controller(threading.Thread): class Controller(threading.Thread):
FIFO = os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'rc') FIFO = '/var/run/librespot'
def __init__(self, player): def __init__(self, player):
super(Controller, self).__init__() super(Controller, self).__init__()
@ -65,13 +66,15 @@ class Controller(threading.Thread):
self.player.play() self.player.play()
elif command[0] == 'stop': elif command[0] == 'stop':
self.player.stop() self.player.stop()
def stop(self):
try: try:
os.unlink(self.FIFO) os.unlink(self.FIFO)
except OSError: except OSError:
pass pass
def stop(self):
with open(self.FIFO, 'w') as fifo:
fifo.close()
class Player(xbmc.Player): class Player(xbmc.Player):
@ -79,7 +82,6 @@ class Player(xbmc.Player):
def __init__(self): def __init__(self):
super(Player, self).__init__(self) super(Player, self).__init__(self)
self.window = xbmcgui.Window(12006)
if self.isPlaying(): if self.isPlaying():
self.onPlayBackStarted() self.onPlayBackStarted()
@ -104,7 +106,7 @@ class Player(xbmc.Player):
listitem.setArt({'thumb': xbmcaddon.Addon().getAddonInfo('icon')}) listitem.setArt({'thumb': xbmcaddon.Addon().getAddonInfo('icon')})
super(Player, self).play(self.ITEM, listitem) super(Player, self).play(self.ITEM, listitem)
del listitem del listitem
self.window.show() xbmcgui.Window(12006).show()
def stop(self): def stop(self):
suspendSink('1') suspendSink('1')
@ -130,3 +132,4 @@ if __name__ == '__main__':
controller.start() controller.start()
Monitor(player).waitForAbort() Monitor(player).waitForAbort()
controller.stop() controller.stop()
controller.join()