Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lars Kruse
aura-engine
Commits
b988f0dc
Commit
b988f0dc
authored
May 04, 2021
by
David Trattnig
Browse files
Namespace fix and refactor note. #65 #72
parent
d38fcf67
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/client/client.py
View file @
b988f0dc
...
...
@@ -31,10 +31,12 @@ from src.base.utils import TerminalColors
class
LiquidSoapClient
:
"""
"""
LiquidSoapClient Class
Connects to a LiquidSoap instance over a socket and sends commands to it
#TODO Refactor class: https://gitlab.servus.at/aura/engine/-/issues/65
"""
mutex
=
None
logger
=
None
...
...
@@ -191,7 +193,7 @@ class LiquidSoapClient:
param
=
(
param
.
strip
()
if
param
.
strip
()
==
""
else
" "
+
urllib
.
parse
.
unquote
(
param
.
strip
()))
if
self
.
connected
:
# print namespace + '.' + command + param + "\n"
if
namespace
is
""
:
if
namespace
==
""
:
message
=
str
(
command
)
+
str
(
param
)
+
str
(
"
\n
"
)
else
:
message
=
str
(
namespace
)
+
str
(
"."
)
+
str
(
command
)
+
str
(
param
)
+
str
(
"
\n
"
)
...
...
src/client/connector.py
View file @
b988f0dc
...
...
@@ -22,7 +22,7 @@ import time
from
src.base.config
import
AuraConfig
from
src.base.utils
import
TerminalColors
,
SimpleUtil
as
SU
from
src.base.exceptions
import
LQConnectionError
from
src.base.exceptions
import
LQConnectionError
from
src.client.playerclient
import
LiquidSoapPlayerClient
...
...
@@ -30,6 +30,8 @@ from src.client.playerclient import LiquidSoapPlayerClient
class
PlayerConnector
():
"""
Establishes a Socket connection to Liquidsoap.
#TODO Refactor class: https://gitlab.servus.at/aura/engine/-/issues/65
"""
client
=
None
logger
=
None
...
...
@@ -80,26 +82,26 @@ class PlayerConnector():
# FIXME REFACTOR all calls in a common way
if
command
in
[
"queue_push"
,
"queue_seek"
,
"queue_clear"
,
"playlist_uri_set"
,
"queue_push"
,
"queue_seek"
,
"queue_clear"
,
"playlist_uri_set"
,
"playlist_uri_clear"
,
"stream_set_url"
,
"stream_start"
,
"stream_stop"
,
"stream_set_url"
,
"stream_start"
,
"stream_stop"
,
"stream_status"
,
]:
func
=
getattr
(
lqs_instance
,
command
)
result
=
func
(
str
(
namespace
),
*
args
)
elif
namespace
==
"mixer"
or
namespace
==
"mixer_fallback"
:
elif
namespace
==
"mixer"
or
namespace
==
"mixer_fallback"
:
func
=
getattr
(
lqs_instance
,
command
)
result
=
func
(
str
(
namespace
),
*
args
)
else
:
func
=
getattr
(
lqs_instance
,
namespace
)
result
=
func
(
command
,
*
args
)
result
=
func
(
command
,
*
args
)
if
not
self
.
disable_logging
:
...
...
src/client/playerclient.py
View file @
b988f0dc
...
...
@@ -22,6 +22,8 @@ from src.client.client import LiquidSoapClient
class
LiquidSoapPlayerClient
(
LiquidSoapClient
):
#TODO Refactor class: https://gitlab.servus.at/aura/engine/-/issues/65
#
# Mixer
#
...
...
@@ -143,7 +145,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
self
.
command
(
channel
,
'seek'
,
str
(
duration
))
return
self
.
message
def
queue_clear
(
self
,
channel
):
"""
Clears all `equeue` playlist entries of the given channel.
...
...
@@ -174,7 +176,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Liquidsoap server response
"""
self
.
command
(
channel
,
'uri'
,
uri
)
self
.
command
(
channel
,
'uri'
,
uri
)
return
self
.
message
...
...
@@ -189,7 +191,7 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
Returns:
Liquidsoap server response
"""
self
.
command
(
channel
,
'clear'
)
self
.
command
(
channel
,
'clear'
)
return
self
.
message
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment