Skip to content
Snippets Groups Projects
Commit 5cf5ea8b authored by David Trattnig's avatar David Trattnig
Browse files

Ability to control scheduled fallbacks. #43

parent 5b2cf274
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ class Channel(Enum): ...@@ -35,6 +35,7 @@ class Channel(Enum):
""" """
FILESYSTEM_A = "in_filesystem_0" FILESYSTEM_A = "in_filesystem_0"
FILESYSTEM_B = "in_filesystem_1" FILESYSTEM_B = "in_filesystem_1"
SCHEDULED_FALLBACK = "playlist_fallback_scheduled"
HTTP_A = "in_http_0" HTTP_A = "in_http_0"
HTTP_B = "in_http_1" HTTP_B = "in_http_1"
HTTPS_A = "in_https_0" HTTPS_A = "in_https_0"
...@@ -56,7 +57,7 @@ class ChannelType(Enum): ...@@ -56,7 +57,7 @@ class ChannelType(Enum):
FILESYSTEM = { FILESYSTEM = {
"id": "fs", "id": "fs",
"numeric": 0, "numeric": 0,
"channels": [Channel.FILESYSTEM_A, Channel.FILESYSTEM_B] "channels": [Channel.FILESYSTEM_A, Channel.FILESYSTEM_B, Channel.SCHEDULED_FALLBACK]
} }
HTTP = { HTTP = {
"id": "http", "id": "http",
......
...@@ -121,10 +121,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient): ...@@ -121,10 +121,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
def playlist_push(self, channel, uri): 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: Args:
channel (String): Liquidsoap Channel ID channel (String): Liquidsoap Source ID
uri (String): Path to the file uri (String): Path to the file
""" """
self.command(channel, 'push', uri) self.command(channel, 'push', uri)
...@@ -133,10 +133,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient): ...@@ -133,10 +133,10 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
def playlist_seek(self, channel, duration): 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: Args:
channel (String): Liquidsoap Channel ID channel (String): Liquidsoap Source ID
duration (Integer): Seek duration ins seconds duration (Integer): Seek duration ins seconds
Returns: Returns:
...@@ -148,19 +148,38 @@ class LiquidSoapPlayerClient(LiquidSoapClient): ...@@ -148,19 +148,38 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
def playlist_clear(self, channel): def playlist_clear(self, channel):
""" """
Clears all playlist entries of the given channel. Clears all `equeue` playlist entries of the given channel.
Args: Args:
channel (String): Liquidsoap Channel ID channel (String): Liquidsoap Source ID
duration (Integer): Seek duration ins seconds duration (Integer): Seek duration ins seconds
Returns: Returns:
Liquidsoap server response Liquidsoap server response
""" """
if channel == Channel.FILESYSTEM_A.value: if channel == Channel.FILESYSTEM_A.value:
self.command(channel, 'clear_filesystem_0') self.command(channel, 'clear')
elif channel == Channel.FILESYSTEM_B.value: 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: else:
return "Invalid filesystem channel '%s'" % channel return "Invalid filesystem channel '%s'" % channel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment