diff --git a/modules/core/channels.py b/modules/core/channels.py index b17cac781862c7efb78ad4fb4dc7e74b4fd1f45f..71b06a4ac32b979ee94cf5f3ae952f301c77b04f 100644 --- a/modules/core/channels.py +++ b/modules/core/channels.py @@ -35,6 +35,7 @@ class Channel(Enum): """ FILESYSTEM_A = "in_filesystem_0" FILESYSTEM_B = "in_filesystem_1" + SCHEDULED_FALLBACK = "playlist_fallback_scheduled" HTTP_A = "in_http_0" HTTP_B = "in_http_1" HTTPS_A = "in_https_0" @@ -56,7 +57,7 @@ class ChannelType(Enum): FILESYSTEM = { "id": "fs", "numeric": 0, - "channels": [Channel.FILESYSTEM_A, Channel.FILESYSTEM_B] + "channels": [Channel.FILESYSTEM_A, Channel.FILESYSTEM_B, Channel.SCHEDULED_FALLBACK] } HTTP = { "id": "http", diff --git a/modules/core/liquidsoap/playerclient.py b/modules/core/liquidsoap/playerclient.py index 1f9150e2bf82db1927b6734d116310a5119503bd..35d54cf1eb0d2254df4e7a4eea578ddd8c438892 100644 --- a/modules/core/liquidsoap/playerclient.py +++ b/modules/core/liquidsoap/playerclient.py @@ -121,10 +121,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient): def playlist_push(self, channel, uri): """ - Pushes the passed file URI to the playlist channel. + Pushes the passed file URI to the `equeue` playlist channel. Args: - channel (String): Liquidsoap Channel ID + channel (String): Liquidsoap Source ID uri (String): Path to the file """ self.command(channel, 'push', uri) @@ -133,10 +133,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient): def playlist_seek(self, channel, duration): """ - Forward the playing track/playlist of the given channel. + Forward the playing `equeue` track/playlist of the given channel. Args: - channel (String): Liquidsoap Channel ID + channel (String): Liquidsoap Source ID duration (Integer): Seek duration ins seconds Returns: @@ -148,19 +148,38 @@ class LiquidSoapPlayerClient(LiquidSoapClient): def playlist_clear(self, channel): """ - Clears all playlist entries of the given channel. + Clears all `equeue` playlist entries of the given channel. Args: - channel (String): Liquidsoap Channel ID + channel (String): Liquidsoap Source ID duration (Integer): Seek duration ins seconds Returns: Liquidsoap server response """ if channel == Channel.FILESYSTEM_A.value: - self.command(channel, 'clear_filesystem_0') + self.command(channel, 'clear') elif channel == Channel.FILESYSTEM_B.value: - self.command(channel, 'clear_filesystem_1') + self.command(channel, 'clear') + else: + return "Invalid filesystem channel '%s'" % channel + + return self.message + + + def playlist_uri(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