Commit 5cf5ea8b authored by David Trattnig's avatar David Trattnig
Browse files

Ability to control scheduled fallbacks. #43

parent 5b2cf274
......@@ -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",
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment