Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine
Commits
55725a8a
Commit
55725a8a
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
More flexible Liquidsoap mixer handling.
#44
parent
119c4017
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/core/liquidsoap/client.py
+6
-4
6 additions, 4 deletions
modules/core/liquidsoap/client.py
modules/core/liquidsoap/playerclient.py
+26
-36
26 additions, 36 deletions
modules/core/liquidsoap/playerclient.py
with
32 additions
and
40 deletions
modules/core/liquidsoap/client.py
+
6
−
4
View file @
55725a8a
...
@@ -27,13 +27,15 @@ from multiprocessing import Lock
...
@@ -27,13 +27,15 @@ from multiprocessing import Lock
from
modules.base.exceptions
import
LQConnectionError
from
modules.base.exceptions
import
LQConnectionError
from
modules.base.utils
import
TerminalColors
from
modules.base.utils
import
TerminalColors
"""
LiquidSoapClient Class
Connects to a LiquidSoap instance over a socket and sends commands to it
"""
class
LiquidSoapClient
:
class
LiquidSoapClient
:
"""
LiquidSoapClient Class
Connects to a LiquidSoap instance over a socket and sends commands to it
"""
mutex
=
None
mutex
=
None
logger
=
None
logger
=
None
debug
=
False
debug
=
False
...
...
This diff is collapsed.
Click to expand it.
modules/core/liquidsoap/playerclient.py
+
26
−
36
View file @
55725a8a
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# FIXME Refactor to avoid use of Channel Class here
from
modules.core.channels
import
Channel
from
modules.core.liquidsoap.client
import
LiquidSoapClient
from
modules.core.liquidsoap.client
import
LiquidSoapClient
...
@@ -28,37 +26,37 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -28,37 +26,37 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
# Mixer
# Mixer
#
#
def
mixer
(
self
,
command
,
*
args
):
#
def mixer(self,
mixer_id,
command, *args):
if
command
==
"
status
"
:
#
if command == "status":
return
self
.
mixerstatus
(
*
args
)
#
return self.mixer
_
status(
mixer_id,
*args)
if
command
==
"
inputs
"
:
#
if command == "inputs":
return
self
.
mixerinputs
()
#
return self.mixer
_
inputs(
mixer_id
)
if
command
==
"
volume
"
:
#
if command == "volume":
return
self
.
mixer_volume
(
*
args
)
#
return self.mixer_volume(
mixer_id,
*args)
if
command
==
"
select
"
:
#
if command == "select":
if
len
(
args
)
==
2
:
#
if len(args) == 2:
return
self
.
mixer_select
(
args
[
0
],
args
[
1
])
#
return self.mixer_select(
mixer_id,
args[0], args[1])
if
command
==
"
activate
"
:
#
if command == "activate":
if
len
(
args
)
==
2
:
#
if len(args) == 2:
return
self
.
mixer_activate
(
args
[
0
],
args
[
1
])
#
return self.mixer_activate(
mixer_id,
args[0], args[1])
return
"
LiquidSoapPlayerClient does not understand mixer.
"
+
command
+
str
(
args
)
#
return "LiquidSoapPlayerClient does not understand mixer."+command+str(args)
# ------------------------------------------------------------------------------------------ #
# ------------------------------------------------------------------------------------------ #
def
mixerinputs
(
self
):
def
mixer
_
inputs
(
self
,
mixer_id
):
# send command
# send command
self
.
command
(
"
mixer
"
,
"
inputs
"
)
self
.
command
(
mixer
_id
,
"
inputs
"
)
# convert to list and return it
# convert to list and return it
return
self
.
message
.
strip
().
split
(
'
'
)
return
self
.
message
.
strip
().
split
(
'
'
)
# ------------------------------------------------------------------------------------------ #
# ------------------------------------------------------------------------------------------ #
def
mixerstatus
(
self
,
pos
=
""
):
def
mixer
_
status
(
self
,
mixer_id
,
pos
=
""
):
"""
"""
Get state of a source in the mixer
Get state of a source in the mixer
@type pos: string
@type pos: string
...
@@ -66,11 +64,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -66,11 +64,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
@rtype: string
@rtype: string
@return: Response from LiquidSoap
@return: Response from LiquidSoap
"""
"""
self
.
command
(
"
mixer
"
,
"
status
"
,
str
(
pos
))
self
.
command
(
mixer
_id
,
"
status
"
,
str
(
pos
))
return
self
.
message
return
self
.
message
def
mixer_volume
(
self
,
pos
,
volume
):
def
mixer_volume
(
self
,
mixer_id
,
pos
,
volume
):
"""
"""
Sets some mixer channel to the given volume
Sets some mixer channel to the given volume
...
@@ -81,11 +79,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -81,11 +79,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Returns:
(String): Liquidsoap server response
(String): Liquidsoap server response
"""
"""
self
.
command
(
"
mixer
"
,
"
volume
"
,
str
(
pos
)
+
"
"
+
str
(
volume
))
self
.
command
(
mixer
_id
,
"
volume
"
,
str
(
pos
)
+
"
"
+
str
(
volume
))
return
self
.
message
return
self
.
message
def
mixer_select
(
self
,
pos
,
select
):
def
mixer_select
(
self
,
mixer_id
,
pos
,
select
):
"""
"""
Selects some mixer channel or vice versa.
Selects some mixer channel or vice versa.
...
@@ -96,11 +94,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -96,11 +94,11 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Returns:
(String): Liquidsoap server response
(String): Liquidsoap server response
"""
"""
self
.
command
(
"
mixer
"
,
"
select
"
,
str
(
pos
)
+
"
"
+
str
(
select
).
lower
())
self
.
command
(
mixer
_id
,
"
select
"
,
str
(
pos
)
+
"
"
+
str
(
select
).
lower
())
return
self
.
message
return
self
.
message
def
mixer_activate
(
self
,
pos
,
activate
):
def
mixer_activate
(
self
,
mixer_id
,
pos
,
activate
):
"""
"""
Selects some mixer channel and increases the volume to 100 or vice versa.
Selects some mixer channel and increases the volume to 100 or vice versa.
...
@@ -111,7 +109,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -111,7 +109,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Returns:
(String): Liquidsoap server response
(String): Liquidsoap server response
"""
"""
self
.
command
(
"
mixer
"
,
"
activate
"
,
str
(
pos
)
+
"
"
+
str
(
activate
).
lower
())
self
.
command
(
mixer
_id
,
"
activate
"
,
str
(
pos
)
+
"
"
+
str
(
activate
).
lower
())
return
self
.
message
return
self
.
message
...
@@ -176,11 +174,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -176,11 +174,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Returns:
Liquidsoap server response
Liquidsoap server response
"""
"""
if
channel
==
Channel
.
SCHEDULED_FALLBACK
.
value
:
self
.
command
(
channel
,
'
uri
'
,
uri
)
self
.
command
(
channel
,
'
uri
'
,
uri
)
else
:
return
"
Invalid filesystem channel
'
%s
'"
%
channel
return
self
.
message
return
self
.
message
...
@@ -195,11 +189,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
...
@@ -195,11 +189,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Returns:
Liquidsoap server response
Liquidsoap server response
"""
"""
if
channel
==
Channel
.
SCHEDULED_FALLBACK
.
value
:
self
.
command
(
channel
,
'
clear
'
)
self
.
command
(
channel
,
'
clear
'
)
else
:
return
"
Invalid filesystem channel
'
%s
'"
%
channel
return
self
.
message
return
self
.
message
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment