Commit f593acdd authored by David Trattnig's avatar David Trattnig
Browse files

Fix for live channel selection. #81

parent e7ca792f
......@@ -54,6 +54,33 @@ class Channel(Enum):
return str(self.value)
class ChannelResolver():
Helpers for resolving channel enumerations.
def live_channel_for_resource(channel: str):
Returns the channel enum for a given channel string.
if not channel: return None
channel = "linein_" + channel.split("line://")[1]
if channel == Channel.LIVE_0.value:
return Channel.LIVE_0
elif channel == Channel.LIVE_1.value:
return Channel.LIVE_2
elif channel == Channel.LIVE_3.value:
return Channel.LIVE_3
elif channel == Channel.LIVE_4.value:
return Channel.LIVE_4
elif channel == Channel.LIVE_5.value:
return Channel.LIVE_5
return None
class ChannelType(Enum):
Engine channel types mapped to `Entry` source types.
......@@ -29,7 +29,7 @@ from src.base.config import AuraConfig
from src.base.utils import SimpleUtil as SU
from src.base.exceptions import LQConnectionError, InvalidChannelException, LQStreamException, LoadSourceException
from src.resources import ResourceClass, ResourceUtil
from src.channels import ChannelType, TransitionType, LiquidsoapResponse, EntryPlayState, ResourceType, ChannelRouter
from src.channels import ChannelType, TransitionType, LiquidsoapResponse, EntryPlayState, ResourceType, ChannelRouter, ChannelResolver
from import EngineEventDispatcher
from src.control import EngineControlInterface
from src.mixer import Mixer, MixerType
......@@ -229,7 +229,10 @@ class Player:
if entry.get_content_type() in ResourceClass.LIVE.types: = "linein_" + entry.source.split("line://")[1] = ChannelResolver.live_channel_for_resource(entry.source)
if == None:
self.logger.critical("Invalid live channel '{entry.source}' requested!"))
entry.previous_channel = None
is_ready = True
channel_type = self.channel_router.type_for_resource(entry.get_content_type())
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