Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tenfire committed Mar 13, 2024
1 parent a79d838 commit 43bf1f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions music_assistant/server/providers/plex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ async def get_config_entries(
values[CONF_LOCAL_SERVER_IP] = "Discovery failed, please add IP manually"
values[CONF_LOCAL_SERVER_PORT] = "Discovery failed, please add Port manually"
values[CONF_LOCAL_SERVER_SSL] = "Discovery failed, please set SSL manually"
values[CONF_LOCAL_SERVER_VERIFY_CERT] = "Discovery failed, please set Verify certificate manually"
values[CONF_LOCAL_SERVER_VERIFY_CERT] = ("Discovery failed, please set "
"Verify certificate manually")
else:
values[CONF_LOCAL_SERVER_IP] = server_details[0]
values[CONF_LOCAL_SERVER_PORT] = server_details[1]
Expand Down Expand Up @@ -154,7 +155,8 @@ async def get_config_entries(
server_http_port = values.get(CONF_LOCAL_SERVER_PORT)
server_http_ssl = values.get(CONF_LOCAL_SERVER_SSL)
server_http_verify_cert = values.get(CONF_LOCAL_SERVER_VERIFY_CERT)
if not (libraries := await get_libraries(mass, token, server_http_ssl, server_http_ip, server_http_port, server_http_verify_cert)):
if not (libraries := await get_libraries(mass, token, server_http_ssl, server_http_ip,
server_http_port, server_http_verify_cert)):
msg = "Unable to retrieve Servers and/or Music Libraries"
raise LoginFailed(msg)
conf_libraries.options = tuple(
Expand Down Expand Up @@ -234,8 +236,10 @@ async def handle_async_init(self) -> None:
def connect() -> PlexServer:
try:
session = requests.Session()
session.verify = self.config.get_value(CONF_LOCAL_SERVER_VERIFY_CERT) if self.config.get_value(CONF_LOCAL_SERVER_SSL) else False
local_server_protocol = "https" if self.config.get_value(CONF_LOCAL_SERVER_SSL) else "http"
session.verify = (self.config.get_value(CONF_LOCAL_SERVER_VERIFY_CERT)
if self.config.get_value(CONF_LOCAL_SERVER_SSL) else False)
local_server_protocol = ("https" if self.config.get_value(CONF_LOCAL_SERVER_SSL)
else "http")
plex_server = PlexServer(
f"{local_server_protocol}://{self.config.get_value(CONF_LOCAL_SERVER_IP)}:{self.config.get_value(CONF_LOCAL_SERVER_PORT)}",
token=self.config.get_value(CONF_AUTH_TOKEN), session=session,
Expand Down
6 changes: 4 additions & 2 deletions music_assistant/server/providers/plex/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@


async def get_libraries(
mass: MusicAssistant, auth_token: str, local_server_ssl: bool, local_server_ip: str, local_server_port: str, local_server_verify_cert: bool
mass: MusicAssistant, auth_token: str, local_server_ssl: bool, local_server_ip: str,
local_server_port: str, local_server_verify_cert: bool
) -> list[str]:
"""
Get all music libraries for all plex servers.
Expand All @@ -32,7 +33,8 @@ def _get_libraries():
session.verify = local_server_verify_cert
local_server_protocol = "https" if local_server_ssl else "http"
plex_server: PlexServer = PlexServer(
f"{local_server_protocol}://{local_server_ip}:{local_server_port}", auth_token, session=session
f"{local_server_protocol}://{local_server_ip}:{local_server_port}", auth_token,
session=session
)
for media_section in plex_server.library.sections():
media_section: PlexLibrarySection
Expand Down

0 comments on commit 43bf1f7

Please sign in to comment.