From e652d724008c3272bcdad93d47b57e29832a5445 Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Fri, 16 Oct 2020 18:51:50 +0200 Subject: [PATCH] Liquidsoap interface for fallbacks. #43 --- modules/core/liquidsoap/playerclient.py | 39 ++++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/modules/core/liquidsoap/playerclient.py b/modules/core/liquidsoap/playerclient.py index 35d54cf1..e2f5325b 100644 --- a/modules/core/liquidsoap/playerclient.py +++ b/modules/core/liquidsoap/playerclient.py @@ -116,10 +116,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient): # - # Playlist + # Queues # - def playlist_push(self, channel, uri): + def queue_push(self, channel, uri): """ Pushes the passed file URI to the `equeue` playlist channel. @@ -131,7 +131,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient): return self.message - def playlist_seek(self, channel, duration): + def queue_seek(self, channel, duration): """ Forward the playing `equeue` track/playlist of the given channel. @@ -146,7 +146,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient): return self.message - def playlist_clear(self, channel): + def queue_clear(self, channel): """ Clears all `equeue` playlist entries of the given channel. @@ -157,19 +157,36 @@ class LiquidSoapPlayerClient(LiquidSoapClient): Returns: Liquidsoap server response """ - if channel == Channel.FILESYSTEM_A.value: - self.command(channel, 'clear') - elif channel == Channel.FILESYSTEM_B.value: - self.command(channel, 'clear') + self.command(channel, 'clear') + return self.message + + + # + # Playlist + # + + def playlist_uri_set(self, channel, uri): + """ + Sets the URI of a playlist source. + + Args: + channel (String): Liquidsoap Source ID + uri (String): URI to the playlist file + + Returns: + Liquidsoap server response + """ + if channel == Channel.SCHEDULED_FALLBACK.value: + self.command(channel, 'uri', uri) else: return "Invalid filesystem channel '%s'" % channel return self.message - def playlist_uri(self, channel, uri): + def playlist_uri_clear(self, channel): """ - Sets the URI of a playlist source. + Clears the URI of a playlist source. Args: channel (String): Liquidsoap Source ID @@ -179,7 +196,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient): Liquidsoap server response """ if channel == Channel.SCHEDULED_FALLBACK.value: - self.command(channel, 'uri', uri) + self.command(channel, 'clear') else: return "Invalid filesystem channel '%s'" % channel -- GitLab