fix lint
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 27 Jan 2024 10:53:37 +0000 (11:53 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 27 Jan 2024 10:53:37 +0000 (11:53 +0100)
85 files changed:
music_assistant/__main__.py
music_assistant/client/__init__.py
music_assistant/client/client.py
music_assistant/client/connection.py
music_assistant/client/exceptions.py
music_assistant/client/music.py
music_assistant/client/players.py
music_assistant/common/helpers/datetime.py
music_assistant/common/helpers/util.py
music_assistant/common/models/config_entries.py
music_assistant/common/models/enums.py
music_assistant/common/models/media_items.py
music_assistant/common/models/player.py
music_assistant/common/models/player_queue.py
music_assistant/common/models/queue_item.py
music_assistant/constants.py
music_assistant/server/controllers/cache.py
music_assistant/server/controllers/config.py
music_assistant/server/controllers/media/albums.py
music_assistant/server/controllers/media/artists.py
music_assistant/server/controllers/media/base.py
music_assistant/server/controllers/media/playlists.py
music_assistant/server/controllers/media/radio.py
music_assistant/server/controllers/media/tracks.py
music_assistant/server/controllers/metadata.py
music_assistant/server/controllers/music.py
music_assistant/server/controllers/player_queues.py
music_assistant/server/controllers/players.py
music_assistant/server/controllers/streams.py
music_assistant/server/controllers/webserver.py
music_assistant/server/helpers/api.py
music_assistant/server/helpers/audio.py
music_assistant/server/helpers/auth.py
music_assistant/server/helpers/compare.py
music_assistant/server/helpers/database.py
music_assistant/server/helpers/didl_lite.py
music_assistant/server/helpers/images.py
music_assistant/server/helpers/logging.py
music_assistant/server/helpers/playlists.py
music_assistant/server/helpers/process.py
music_assistant/server/helpers/tags.py
music_assistant/server/helpers/util.py
music_assistant/server/helpers/webserver.py
music_assistant/server/models/__init__.py
music_assistant/server/models/core_controller.py
music_assistant/server/models/metadata_provider.py
music_assistant/server/models/music_provider.py
music_assistant/server/models/player_provider.py
music_assistant/server/models/plugin.py
music_assistant/server/models/provider.py
music_assistant/server/providers/airplay/__init__.py
music_assistant/server/providers/chromecast/__init__.py
music_assistant/server/providers/chromecast/helpers.py
music_assistant/server/providers/deezer/__init__.py
music_assistant/server/providers/deezer/gw_client.py
music_assistant/server/providers/dlna/__init__.py
music_assistant/server/providers/dlna/helpers.py
music_assistant/server/providers/fanarttv/__init__.py
music_assistant/server/providers/filesystem_local/__init__.py
music_assistant/server/providers/filesystem_local/base.py
music_assistant/server/providers/filesystem_local/helpers.py
music_assistant/server/providers/filesystem_smb/__init__.py
music_assistant/server/providers/musicbrainz/__init__.py
music_assistant/server/providers/opensubsonic/__init__.py
music_assistant/server/providers/opensubsonic/sonic_provider.py
music_assistant/server/providers/plex/__init__.py
music_assistant/server/providers/plex/helpers.py
music_assistant/server/providers/qobuz/__init__.py
music_assistant/server/providers/radiobrowser/__init__.py
music_assistant/server/providers/slimproto/__init__.py
music_assistant/server/providers/slimproto/cli.py
music_assistant/server/providers/slimproto/models.py
music_assistant/server/providers/snapcast/__init__.py
music_assistant/server/providers/sonos/__init__.py
music_assistant/server/providers/soundcloud/__init__.py
music_assistant/server/providers/soundcloud/soundcloudpy/asyncsoundcloudpy.py
music_assistant/server/providers/spotify/__init__.py
music_assistant/server/providers/theaudiodb/__init__.py
music_assistant/server/providers/tidal/helpers.py
music_assistant/server/providers/tunein/__init__.py
music_assistant/server/providers/ugp/__init__.py
music_assistant/server/providers/url/__init__.py
music_assistant/server/providers/ytmusic/__init__.py
music_assistant/server/server.py
script/profiler.py

index 63d7d9b875e00d2e39892ed520ac813b745de8b3..6ba281a7117aa74130adf0812c0651be0ecb9b72 100644 (file)
@@ -1,4 +1,5 @@
 """Run the Music Assistant Server."""
+
 from __future__ import annotations
 
 import argparse
index 5b1088ccb07f39bcc307c39166a8c2dee2dac8fa..731b8d528f52690f082592d8fc86fa3492c58c42 100644 (file)
@@ -1,2 +1,3 @@
 """Music Assistant Client: Manage a Music Assistant server remotely."""
+
 from .client import MusicAssistantClient  # noqa: F401
index 1700553dd3a2a3213e5166d997e69d44a4876c32..af79e88699f56c02fb8a0819d7a039de7f2993bc 100644 (file)
@@ -1,4 +1,5 @@
 """Music Assistant Client: Manage a Music Assistant server remotely."""
+
 from __future__ import annotations
 
 import asyncio
index b77f71ae867df5735671f47f1217ee1c3c8ce2c0..0fb1c49b3a3a792f9ae98bcdee812af6c36da4de 100644 (file)
@@ -1,4 +1,5 @@
 """"Connect o a remote Music Assistant Server using the default Websocket API."""
+
 from __future__ import annotations
 
 import logging
index a9b17157ba63db655a435b834df4f6de648d6623..fb1349c31b02ddc3e8ed493bd414e05738102410 100644 (file)
@@ -1,4 +1,5 @@
 """Client-specific Exceptions for Music Assistant."""
+
 from __future__ import annotations
 
 
index 21618865e1b68852eafe3ba371892e039a345654..2363039808e31eeb37e8cbe4dae5543324aa93b3 100644 (file)
@@ -1,4 +1,5 @@
 """Handle Music/library related endpoints for Music Assistant."""
+
 from __future__ import annotations
 
 import urllib.parse
index 6e6e1f8f168df655a4695196f3095e59f6d5bb80..b8ccda6b1e6fc61638d4531baca50ee48e2066ee 100644 (file)
@@ -1,4 +1,5 @@
 """Handle player related endpoints for Music Assistant."""
+
 from __future__ import annotations
 
 from collections.abc import Iterator
index 0006b65b52e7753cf539801c30dcf2e07054ab47..f0b262a726122f41ede50eb8be770b5d7c3d2442 100644 (file)
@@ -1,4 +1,5 @@
 """Helpers for date and time."""
+
 from __future__ import annotations
 
 import datetime
index 89eef728f09d6680f227698d3ffb841d963251d4..2bd40ecac4e71e403a7e69765f8ea7973a0b68d7 100755 (executable)
@@ -1,4 +1,5 @@
 """Helper and utility functions."""
+
 from __future__ import annotations
 
 import asyncio
index b6e5259626de5e6068181a5fdb9e80e3523010a6..f853f6f1c3b26294f1d95e419b838aeff9d70290 100644 (file)
@@ -1,4 +1,5 @@
 """Model and helpers for Config entries."""
+
 from __future__ import annotations
 
 import logging
index af05b17eacd1c79ce66402f20b988e2e955798c7..be9fd48322d1985d2649a000ca390f57c529d6d8 100644 (file)
@@ -1,4 +1,5 @@
 """All enums used by the Music Assistant models."""
+
 from __future__ import annotations
 
 from enum import StrEnum
index aace45cb13c1bdc109c114129158aab14d86cae3..53df3831e89c8c9e3ece7bc8465d720196d5b2e5 100755 (executable)
@@ -1,4 +1,5 @@
 """Models and helpers for media items."""
+
 from __future__ import annotations
 
 from dataclasses import dataclass, field, fields
index 157a1674f444f06386ba6384a98defab78106c23..86f85016eb8dd619b697f20a552906c5bf4af172 100644 (file)
@@ -1,4 +1,5 @@
 """Model(s) for Player."""
+
 from __future__ import annotations
 
 import time
index eca837227484056a4c0d6f3a97c36ba90bcd73c4..30b9cae71febd6dd78e96c484a6f0ec640522844 100644 (file)
@@ -1,4 +1,5 @@
 """Model(s) for PlayerQueue."""
+
 from __future__ import annotations
 
 import time
index 34729b44f6bae742c898ae696aee924eb4793ff7..d59eda26be38ab16d0f92d56af2b14b637bff44f 100644 (file)
@@ -1,4 +1,5 @@
 """Model a QueueItem."""
+
 from __future__ import annotations
 
 from dataclasses import dataclass
index ab5b81083e415d161882344fa64c7899f4bc25e0..57155dc61710cf244a4dbcbb5004650abbb71fcc 100755 (executable)
@@ -73,9 +73,9 @@ DB_TABLE_THUMBS: Final[str] = "thumbnails"
 DB_TABLE_PROVIDER_MAPPINGS: Final[str] = "provider_mappings"
 
 # all other
-MASS_LOGO_ONLINE: Final[
-    str
-] = "https://github.com/home-assistant/brands/raw/master/custom_integrations/mass/icon%402x.png"
+MASS_LOGO_ONLINE: Final[str] = (
+    "https://github.com/home-assistant/brands/raw/master/custom_integrations/mass/icon%402x.png"
+)
 ENCRYPT_SUFFIX = "_encrypted_"
 SECURE_STRING_SUBSTITUTE = "this_value_is_encrypted"
 CONFIGURABLE_CORE_CONTROLLERS = (
index fdb2cddce92097e5e8772d657f5ad6964e083279..d0995c6b6c42409436e41b709b2b445591c26260 100644 (file)
@@ -1,4 +1,5 @@
 """Provides a simple stateless caching system."""
+
 from __future__ import annotations
 
 import asyncio
index 8e3a983dbbf7bf811171051a6bc4fb01e8d09b32..0b2ddc3c857d8cd90f489eea45d1cc01fa8b0da1 100644 (file)
@@ -1,4 +1,5 @@
 """Logic to handle storage of persistent (configuration) settings."""
+
 from __future__ import annotations
 
 import asyncio
index 10d9c75c6a7a00c42769ba2809dfcc5201ec1394..945d490d114a999b9f30eb7c5381b8c0fa9fa6cb 100644 (file)
@@ -1,4 +1,5 @@
 """Manage MediaItems of type Album."""
+
 from __future__ import annotations
 
 import asyncio
index 6e8cbd151fd41cead7edcedb8edb26f6afcc4872..55794d947331983685354ae3a6eb4695409e481e 100644 (file)
@@ -1,4 +1,5 @@
 """Manage MediaItems of type Artist."""
+
 from __future__ import annotations
 
 import asyncio
index 56ce86af2a5ef7d3c7a0cedddb2e3f2f60e85878..0833f4c4a045717671e2aef13a06fca81bae9b82 100644 (file)
@@ -1,4 +1,5 @@
 """Base (ABC) MediaType specific controller."""
+
 from __future__ import annotations
 
 import logging
index ad9d4762f7cb30536d62455c2dca7ce9ad3d4b51..2659aa150b64a5927cb3c9f1b6ebd9f6a3265162 100644 (file)
@@ -1,4 +1,5 @@
 """Manage MediaItems of type Playlist."""
+
 from __future__ import annotations
 
 import asyncio
index 4ac7c0adc0be23c5084989adf38f25525f093fef..ccbf9271437aa4210c111058f9b4c82c430a0643 100644 (file)
@@ -1,4 +1,5 @@
 """Manage MediaItems of type Radio."""
+
 from __future__ import annotations
 
 import asyncio
index 4f3de56ae28b1c3d6629df4eada9d7be4b9dc594..4f00d267f3c119d6c1cdd4c8385c69f34c8768df 100644 (file)
@@ -1,4 +1,5 @@
 """Manage MediaItems of type Track."""
+
 from __future__ import annotations
 
 import asyncio
index 58d34ef73539e75679c690899cccbfc38fcdb6c3..f8e15bc1023ab9d6e74029343b8e8356a67f546d 100755 (executable)
@@ -1,4 +1,5 @@
 """All logic for metadata retrieval."""
+
 from __future__ import annotations
 
 import asyncio
index 96b00cadefabfca0258aca843d3a623b4c387671..b1a2ecaac9e4cd6bf4c22ad44b691b1f391f9707 100755 (executable)
@@ -1,4 +1,5 @@
 """MusicController: Orchestrates all data from music providers and sync to internal database."""
+
 from __future__ import annotations
 
 import asyncio
index 08b3a6ee56aa7b72a52295676c02b8f1ac3b9ab5..b234872d6492f2fa4aab3e58b769474f60603286 100755 (executable)
@@ -1,4 +1,5 @@
 """Logic to play music from MusicProviders to supported players."""
+
 from __future__ import annotations
 
 import logging
index e1b76fa21ed6acce7b3038eb04fc04dc262113d2..4cb8ea35be59221d75058c0179f4b8567c98abdf 100755 (executable)
@@ -1,4 +1,5 @@
 """Logic to play music from MusicProviders to supported players."""
+
 from __future__ import annotations
 
 import asyncio
index 1ad7e084d85b2c916cda6477d973e5cdc0f9655c..61b973844c1b40622560225ab14c6fe30dcbef77 100644 (file)
@@ -5,6 +5,7 @@ The streams controller hosts a basic, unprotected HTTP-only webserver
 purely to stream audio packets to players and some control endpoints such as
 the upnp callbacks and json rpc api for slimproto clients.
 """
+
 from __future__ import annotations
 
 import asyncio
index 2c802102e76c69bb3902f244358090d504d5489d..6d82c47fe5ddd0324ae69b6881bcc51441e7df42 100644 (file)
@@ -4,6 +4,7 @@ Controller that manages the builtin webserver that hosts the api and frontend.
 Unlike the streamserver (which is as simple and unprotected as possible),
 this webserver allows for more fine grained configuration to better secure it.
 """
+
 from __future__ import annotations
 
 import asyncio
index 31791a9bf396ec9782a45a9c7d7353038563714b..95af94bd4d3d196e9dc6cb88c966e4805b54103a 100644 (file)
@@ -1,4 +1,5 @@
 """Helpers for dealing with API's to interact with Music Assistant."""
+
 from __future__ import annotations
 
 import inspect
index 62ae2b814f64c306d7afadc1e24e44033484f378..09e0719d8233b05529abbc7adf94d457f17bd7fd 100644 (file)
@@ -1,4 +1,5 @@
 """Various helpers for audio manipulation."""
+
 from __future__ import annotations
 
 import asyncio
index aaf1ff709235a925afde16cb6665d234d0e3b7a1..c609943af2e95d799ede119c339568a1f0e05228 100644 (file)
@@ -1,4 +1,5 @@
 """Helper(s) to deal with authentication for (music) providers."""
+
 from __future__ import annotations
 
 import asyncio
index 900488a6d481e7c800a541de17b115e646dc4d23..259a5f210d5a77132bf0fe7770cd5ea48c0ed56e 100644 (file)
@@ -1,4 +1,5 @@
 """Several helper/utils to compare objects."""
+
 from __future__ import annotations
 
 import re
index 89e927218a15acd6839440e0c2accac08b4fe058..134b60f3547b489a8b324c0eaded2f6251c4896f 100755 (executable)
@@ -1,4 +1,5 @@
 """Database helpers and logic."""
+
 from __future__ import annotations
 
 from collections.abc import AsyncGenerator, Mapping
index 3c91f2c8c2069d5fd96a3b0dd099e35c98f7800f..dc7e84ca7e57eb3650a0a796c7f0ebefaa21dd04 100644 (file)
@@ -1,4 +1,5 @@
 """Helper(s) to create DIDL Lite metadata for Sonos/DLNA players."""
+
 from __future__ import annotations
 
 import datetime
index 66880ee521d29dfa110caf33bd9411b35859e0c6..9f85eec13c746aeb9999e5d25cead1ef80ba160b 100644 (file)
@@ -1,4 +1,5 @@
 """Utilities for image manipulation and retrieval."""
+
 from __future__ import annotations
 
 import asyncio
index b95e08e5b8ddd1343c46595452aff54d72ac953b..3034c80c71291e4a9543850015548b06c2ea8741 100644 (file)
@@ -6,6 +6,7 @@ https://github.com/home-assistant/core/blob/e5ccd85e7e26c167d0b73669a88bc3a7614d
 
 All rights reserved.
 """
+
 from __future__ import annotations
 
 import asyncio
@@ -108,15 +109,13 @@ def log_exception(format_err: Callable[..., Any], *args: Any) -> None:
 @overload
 def catch_log_exception(
     func: Callable[..., Coroutine[Any, Any, Any]], format_err: Callable[..., Any]
-) -> Callable[..., Coroutine[Any, Any, None]]:
-    ...
+) -> Callable[..., Coroutine[Any, Any, None]]: ...
 
 
 @overload
 def catch_log_exception(
     func: Callable[..., Any], format_err: Callable[..., Any]
-) -> Callable[..., None] | Callable[..., Coroutine[Any, Any, None]]:
-    ...
+) -> Callable[..., None] | Callable[..., Coroutine[Any, Any, None]]: ...
 
 
 def catch_log_exception(
index 4ea9229e1ea8d704cfbf534f36930de5b6efc65a..efbf2e84d6f30b36aa6a4eeb95758e7ab25f7102 100644 (file)
@@ -1,4 +1,5 @@
 """Helpers for parsing playlists."""
+
 from __future__ import annotations
 
 import asyncio
index 515255e766e9f4977f00dee2e0a47550f7711454..fa9ad501cce159d179e67dcc272196cd5013ff6b 100644 (file)
@@ -3,6 +3,7 @@
 The subprocess implementation in asyncio can (still) sometimes cause deadlocks,
 even when properly handling reading/writes from different tasks.
 """
+
 from __future__ import annotations
 
 import asyncio
index 73882928440410aa95c6264ca89b756831414da8..155e8bc81d1c89f6601c134d8c9904b58e587f07 100644 (file)
@@ -1,4 +1,5 @@
 """Helpers/utilities to parse ID3 tags from audio files with ffmpeg."""
+
 from __future__ import annotations
 
 import json
index 4627e50044b9049a5390d63888c3b5bf2a23f5f8..57b48417adfe48d2a3c6b22b54a256aad99e65d7 100644 (file)
@@ -1,4 +1,5 @@
 """Various (server-only) tools and helpers."""
+
 from __future__ import annotations
 
 import asyncio
index efa75f61241ebd47244c7b4bbdb41471c35c0109..2ce47c506d63f08a5f11db5404ba164f7f2df15f 100644 (file)
@@ -1,4 +1,5 @@
 """Base Webserver logic for an HTTPServer that can handle dynamic routes."""
+
 from __future__ import annotations
 
 import logging
index 7317cffa0650734079fde4f31ea51a585aae1f86..cdf98962dd224a3daee394a440d8b99ed538d152 100644 (file)
@@ -1,4 +1,5 @@
 """Server specific/only models."""
+
 from __future__ import annotations
 
 from typing import TYPE_CHECKING, Protocol
index 24199d8b8e08f926619c5ccef5d7ea1f6b1b6634..1e150dcb66ea6d624caa9936019074912faa83f2 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Core controller within Music Assistant."""
+
 from __future__ import annotations
 
 import logging
index 0e3f75b336b4f14e3226481c65b13eccec0a72c8..f9e9beed62aff37491e5973e28181bee16bb22cb 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Metadata Provider implementation."""
+
 from __future__ import annotations
 
 from typing import TYPE_CHECKING
index fb075054a3cd9f9a8679ca4990f55dcb4ac90271..0f96b474d9e06e74199e0a0e8a10da63122a2ad9 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Music Provider implementation."""
+
 from __future__ import annotations
 
 from collections.abc import AsyncGenerator
index 0d06a2afb9649df5ddfc8dd3f70283fdeae946bb..be404abf338f7044c5da7095e6dd8d0d15436da6 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Metadata Provider implementation."""
+
 from __future__ import annotations
 
 from abc import abstractmethod
index 6a535a39957c3a945a93fb05b7147f671715ae14..6e7207e24be0416cc5d25bc9d4d4a192eca3f82d 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Plugin Provider implementation."""
+
 from __future__ import annotations
 
 from typing import TYPE_CHECKING
index c649af1eea99fdc0e2864be637b839fe435fc8db..e820f90aeeadaca0b4d4abbe9ec8867f5f9dc239 100644 (file)
@@ -1,4 +1,5 @@
 """Model/base for a Provider implementation within Music Assistant."""
+
 from __future__ import annotations
 
 import logging
index a4313daae1b5cbbae8ee8dfcc3813c202ed690ab..10eca9ff92c925ef9f3a181ff8d91f1d50d31102 100644 (file)
@@ -4,6 +4,7 @@ This is more like a "virtual" player provider, running on top of slimproto.
 It uses the amazing work of Philippe44 who created a bridge from airplay to slimproto.
 https://github.com/philippe44/LMS-Raop
 """
+
 from __future__ import annotations
 
 import asyncio
index c0205029b312e6221334b78f160115d22d30e936..1bb7e826bce17ef1b8cf9b4d4d8ad2dc4e346990 100644 (file)
@@ -1,4 +1,5 @@
 """Chromecast Player provider for Music Assistant, utilizing the pychromecast library."""
+
 from __future__ import annotations
 
 import asyncio
@@ -633,13 +634,13 @@ class ChromecastProvider(PlayerProvider):
             stream_type = STREAM_TYPE_BUFFERED
             metadata = {
                 "metadataType": 3,
-                "albumName": queue_item.media_item.album.name
-                if queue_item.media_item.album
-                else "",
+                "albumName": (
+                    queue_item.media_item.album.name if queue_item.media_item.album else ""
+                ),
                 "songName": queue_item.media_item.name,
-                "artist": queue_item.media_item.artists[0].name
-                if queue_item.media_item.artists
-                else "",
+                "artist": (
+                    queue_item.media_item.artists[0].name if queue_item.media_item.artists else ""
+                ),
                 "title": queue_item.media_item.name,
                 "images": [{"url": image_url}] if image_url else None,
             }
index 925471ddad09fd956842557cbb06f50e10bcbdae..7959f5d7986c6d80454841b63bdc981b5eff3be1 100644 (file)
@@ -1,4 +1,5 @@
 """Helpers to deal with Cast devices."""
+
 from __future__ import annotations
 
 import urllib.error
index 6812aa7dc689667316e60c7a640da3d485c9dfba..65e05191754ddfbd1f3bd85351bd500ba08e04a0 100644 (file)
@@ -1,4 +1,5 @@
 """Deezer music provider support for MusicAssistant."""
+
 import datetime
 import hashlib
 import uuid
index 8e8ec5280f1097d56111507d3dc8da06c0d167a8..606e662a174eea5be9b5b2f49a1186651e0c1cbb 100644 (file)
@@ -3,6 +3,7 @@
 Credits go out to RemixDev (https://gitlab.com/RemixDev) for figuring out, how to get the arl
 cookie based on the api_token.
 """
+
 import datetime
 from http.cookies import BaseCookie, Morsel
 
index 9ce9c7c9a439013f935eb21c46208750c4e06389..53efeb7a52e66b78cf8b88e4bf38f0e4af7f597c 100644 (file)
@@ -5,6 +5,7 @@ https://github.com/home-assistant/core/blob/dev/homeassistant/components/dlna_dm
 
 All rights/credits reserved.
 """
+
 from __future__ import annotations
 
 import asyncio
index 0cbe74b918fcbc43a45b04702ca761cc45d63a88..88161a12b7a14c3126d2a584b2da3fa279823452 100644 (file)
@@ -1,4 +1,5 @@
 """Various helpers and utils for the DLNA Player Provider."""
+
 from __future__ import annotations
 
 from typing import TYPE_CHECKING
index 5c04e8278be8a184bbae3fd6b78d59005655673c..6398812b16ff56e2d699059ee60aaf4a9e06ea66 100644 (file)
@@ -1,4 +1,5 @@
 """Fanart.tv Metadata provider for Music Assistant."""
+
 from __future__ import annotations
 
 from json import JSONDecodeError
@@ -119,9 +120,10 @@ class FanartTvMetadataProvider(MetadataProvider):
         """Get data from api."""
         url = f"http://webservice.fanart.tv/v3/{endpoint}"
         kwargs["api_key"] = app_var(4)
-        async with self.throttler, self.mass.http_session.get(
-            url, params=kwargs, ssl=False
-        ) as response:
+        async with (
+            self.throttler,
+            self.mass.http_session.get(url, params=kwargs, ssl=False) as response,
+        ):
             try:
                 result = await response.json()
             except (
index e34b9f47f7767fd339a6e483f3893c810bd04def..21e86ea698dc1e119efaf60d6faa6aee08af4715 100644 (file)
@@ -1,4 +1,5 @@
 """Filesystem musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
index 41bdfe31343bebbaa003816c1654f47211ee3694..d9ef4da199d1475fb5981176d31e22812898a69a 100644 (file)
@@ -1,4 +1,5 @@
 """Filesystem musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
index 9ad90a506024c2be414de50affc861b0270faaba..acc42a8bf0950ba20a59e5e4c2da91fc4a0d5e9a 100644 (file)
@@ -1,4 +1,5 @@
 """Some helpers for Filesystem based Musicproviders."""
+
 from __future__ import annotations
 
 import os
index 1641eebb198248a2251f88e13e2630c938215686..1e46844226e7f6edf577d2df6cde064fcabffa8b 100644 (file)
@@ -1,4 +1,5 @@
 """SMB filesystem provider for Music Assistant."""
+
 from __future__ import annotations
 
 import asyncio
index da12609dbbd9fcd995a7238cf11805457356116a..a3980ad54edd240b2470ade0bd009735aa03de79 100644 (file)
@@ -2,6 +2,7 @@
 
 At this time only used for retrieval of ID's but to be expanded to fetch metadata too.
 """
+
 from __future__ import annotations
 
 import re
@@ -423,9 +424,10 @@ class MusicbrainzProvider(MetadataProvider):
             "User-Agent": f"Music Assistant/{self.mass.version} ( https://github.com/music-assistant )"  # noqa: E501
         }
         kwargs["fmt"] = "json"  # type: ignore[assignment]
-        async with self.throttler, self.mass.http_session.get(
-            url, headers=headers, params=kwargs, ssl=False
-        ) as response:
+        async with (
+            self.throttler,
+            self.mass.http_session.get(url, headers=headers, params=kwargs, ssl=False) as response,
+        ):
             try:
                 result = await response.json()
             except (
index 46415b51d267fa51da017b20e896a16003f4d262..81dbdabd2f67bb6f347479aa61b8259fac20c96b 100644 (file)
@@ -1,4 +1,5 @@
 """Open Subsonic music provider support for MusicAssistant."""
+
 from __future__ import annotations
 
 from music_assistant.common.models.config_entries import (
index 48598f58aea335c8cdb852f4a6d039fed10c2bec..1d6f72ef5dd886549cde3c12e4e24036319cf8d5 100644 (file)
@@ -1,4 +1,5 @@
 """The provider class for Open Subsonic."""
+
 from __future__ import annotations
 
 import asyncio
index 7dc5801df8d7cd85cf5bffa4e1282c27fcc4f00d..3086be23b88b2ad8262c8ef6209b433025d753b2 100644 (file)
@@ -1,4 +1,5 @@
 """Plex musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
@@ -462,9 +463,9 @@ class PlexProvider(MusicProvider):
                     provider_instance=self.instance_id,
                     available=available,
                     audio_format=AudioFormat(
-                        content_type=ContentType.try_parse(content)
-                        if content
-                        else ContentType.UNKNOWN,
+                        content_type=(
+                            ContentType.try_parse(content) if content else ContentType.UNKNOWN
+                        ),
                     ),
                     url=plex_track.getWebURL(),
                 )
index f5b846b56cce8e0dbac4ac4800f8748f7d824fcf..a60de938391f754b113dbc1104d4bdf5f8434b2e 100644 (file)
@@ -1,4 +1,5 @@
 """Several helpers/utils for the Plex Music Provider."""
+
 from __future__ import annotations
 
 import asyncio
index e35b0699befb1aa05713b6ddf4a9ebe289ac5122..504421c1ab78076ed479445bb2c7456d31295e1f 100644 (file)
@@ -1,4 +1,5 @@
 """Qobuz musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 import datetime
@@ -683,9 +684,10 @@ class QobuzProvider(MusicProvider):
             kwargs["request_sig"] = request_sig
             kwargs["app_id"] = app_var(0)
             kwargs["user_auth_token"] = await self._auth_token()
-        async with self._throttler, self.mass.http_session.get(
-            url, headers=headers, params=kwargs, ssl=False
-        ) as response:
+        async with (
+            self._throttler,
+            self.mass.http_session.get(url, headers=headers, params=kwargs, ssl=False) as response,
+        ):
             try:
                 result = await response.json()
                 # check for error in json
index b7f40ebdce87fc4c1c1356d5e5e46bdba15bbe0b..a55b0034ef6c02c855eca03e8fdd6e0d2d25d178 100644 (file)
@@ -1,4 +1,5 @@
 """RadioBrowser musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 from collections.abc import AsyncGenerator
index 949fa92fb59d24e6750b9cdf0edfdcbc0f240b6e..7a11a28ac0d87b9d9fb0d1a43e6262e6d7845395 100644 (file)
@@ -1,4 +1,5 @@
 """Base/builtin provider with support for players using slimproto."""
+
 from __future__ import annotations
 
 import asyncio
@@ -496,9 +497,11 @@ class SlimprotoProvider(PlayerProvider):
         await client.play_url(
             url=url,
             mime_type=f"audio/{url.split('.')[-1].split('?')[0]}",
-            metadata={"item_id": queue_item.queue_item_id, "title": queue_item.name}
-            if queue_item
-            else {"item_id": client.player_id, "title": "Music Assistant"},
+            metadata=(
+                {"item_id": queue_item.queue_item_id, "title": queue_item.name}
+                if queue_item
+                else {"item_id": client.player_id, "title": "Music Assistant"}
+            ),
             send_flush=send_flush,
             transition=SlimTransition.CROSSFADE if crossfade else SlimTransition.NONE,
             transition_duration=transition_duration,
index 095b8190a2880b6132e4e0bd6c3192e3c21aa63c..3822fd2e2f298c12832c039ec551edde886e4151 100644 (file)
@@ -8,6 +8,7 @@ Output is adjusted to conform to Music Assistant logic or just for simplificatio
 Goal is player compatibility, not API compatibility.
 Users that need more, should just stay with a full blown LMS server.
 """
+
 from __future__ import annotations
 
 import asyncio
@@ -362,9 +363,7 @@ class LmsCli:
                         "timestamp": time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime()),
                         "advice": {
                             # update interval for streaming mode
-                            "interval": 5000
-                            if streaming
-                            else 0
+                            "interval": 5000 if streaming else 0
                         },
                     }
                 )
@@ -1260,9 +1259,9 @@ class LmsCli:
                         "favorites_title": item.name,
                         "favorites_url": item.uri,
                         "favorites_type": item.media_type.value,
-                        "icon": self.mass.metadata.get_image_url(item.image, 256)
-                        if item.image
-                        else "",
+                        "icon": (
+                            self.mass.metadata.get_image_url(item.image, 256) if item.image else ""
+                        ),
                     },
                     "textkey": item.name[0].upper(),
                     "commonParams": {
index 214fcf539606728844757454b9da99f3362894ef..06f4e904ab1da79e4b277e8444168f883ba92fe3 100644 (file)
@@ -1,4 +1,5 @@
 """Models used for the JSON-RPC API."""
+
 from __future__ import annotations
 
 from typing import TYPE_CHECKING, Any, TypedDict
@@ -190,9 +191,9 @@ def playlist_item_from_mass(
         "artist": artist,
         "album": album,
         "remote": 1,
-        "artwork_url": mass.metadata.get_image_url(queue_item.image, 512)
-        if queue_item.image
-        else "",
+        "artwork_url": (
+            mass.metadata.get_image_url(queue_item.image, 512) if queue_item.image else ""
+        ),
         "coverid": "-187651250107376",
         "duration": queue_item.duration,
         "bitrate": bitrate,
index b71a3ace25a3830b2547b843e5f16cd41ad6ac2a..b624a2ae1eabe2217c5f0d52347d816040efd48d 100644 (file)
@@ -1,4 +1,5 @@
 """Snapcast Player provider for Music Assistant."""
+
 from __future__ import annotations
 
 import asyncio
index 5ade60512b06882c52bc7a567de1e7266c967e24..3106bd2a34288a765b193f7bb620c7af8b4f3eb6 100644 (file)
@@ -1,4 +1,5 @@
 """Sample Player provider for Music Assistant."""
+
 from __future__ import annotations
 
 import asyncio
index 3346752b6a59329b8c33f8a1cc5fa2eb20f65285..362e1d4bdd4cfe2a65c1d378893bdbfbc34ee397 100644 (file)
@@ -1,4 +1,5 @@
 """Soundcloud support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
index 00f450ce03be74ea1f84a70761815595863b77bd..cfda3b2366ee8ef3f7ce55826c62778dadc5e708 100644 (file)
@@ -4,6 +4,7 @@ Async helpers for connecting to the Soundcloud API.
 This file is based on soundcloudpy from Naím Rodríguez https://github.com/naim-prog
 Original package https://github.com/naim-prog/soundcloud-py
 """
+
 from __future__ import annotations
 
 from collections.abc import AsyncGenerator
index 1b68efebc430fdc9ebaf37cbaf9f89feec74043e..94f3b4343f811c7e174e1218a44a1ea5e7bb2562 100644 (file)
@@ -1,4 +1,5 @@
 """Spotify musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
index 75d2d15cae6c7e451b0526270699cefe7c5a5cff..fe6bcb605d7ccee418843844796e3911160623c7 100644 (file)
@@ -1,4 +1,5 @@
 """The AudioDB Metadata provider for Music Assistant."""
+
 from __future__ import annotations
 
 from json import JSONDecodeError
@@ -265,9 +266,10 @@ class AudioDbMetadataProvider(MetadataProvider):
     async def _get_data(self, endpoint, **kwargs) -> dict | None:
         """Get data from api."""
         url = f"https://theaudiodb.com/api/v1/json/{app_var(3)}/{endpoint}"
-        async with self.throttler, self.mass.http_session.get(
-            url, params=kwargs, ssl=False
-        ) as response:
+        async with (
+            self.throttler,
+            self.mass.http_session.get(url, params=kwargs, ssl=False) as response,
+        ):
             try:
                 result = await response.json()
             except (
index 919d8cb113165cd1114449a7a2ab65948a3f324a..cfe3f8629105a19a0731a51e541ab9b1b628edbd 100644 (file)
@@ -49,21 +49,29 @@ async def library_items_add_remove(
     def inner() -> None:
         match media_type:
             case MediaType.ARTIST:
-                TidalFavorites(session, user_id).add_artist(item_id) if add else TidalFavorites(
-                    session, user_id
-                ).remove_artist(item_id)
+                (
+                    TidalFavorites(session, user_id).add_artist(item_id)
+                    if add
+                    else TidalFavorites(session, user_id).remove_artist(item_id)
+                )
             case MediaType.ALBUM:
-                TidalFavorites(session, user_id).add_album(item_id) if add else TidalFavorites(
-                    session, user_id
-                ).remove_album(item_id)
+                (
+                    TidalFavorites(session, user_id).add_album(item_id)
+                    if add
+                    else TidalFavorites(session, user_id).remove_album(item_id)
+                )
             case MediaType.TRACK:
-                TidalFavorites(session, user_id).add_track(item_id) if add else TidalFavorites(
-                    session, user_id
-                ).remove_track(item_id)
+                (
+                    TidalFavorites(session, user_id).add_track(item_id)
+                    if add
+                    else TidalFavorites(session, user_id).remove_track(item_id)
+                )
             case MediaType.PLAYLIST:
-                TidalFavorites(session, user_id).add_playlist(item_id) if add else TidalFavorites(
-                    session, user_id
-                ).remove_playlist(item_id)
+                (
+                    TidalFavorites(session, user_id).add_playlist(item_id)
+                    if add
+                    else TidalFavorites(session, user_id).remove_playlist(item_id)
+                )
             case MediaType.UNKNOWN:
                 return
 
index ecf4bd763254dd9bf330ef249ca6b66d84e7b59d..eebae417eccdb36794946760b36e6f624e2c5d56 100644 (file)
@@ -1,4 +1,5 @@
 """Tune-In musicprovider support for MusicAssistant."""
+
 from __future__ import annotations
 
 from collections.abc import AsyncGenerator
@@ -258,9 +259,10 @@ class TuneInProvider(MusicProvider):
             kwargs["username"] = self.config.get_value(CONF_USERNAME)
             kwargs["partnerId"] = "1"
             kwargs["render"] = "json"
-        async with self._throttler, self.mass.http_session.get(
-            url, params=kwargs, ssl=False
-        ) as response:
+        async with (
+            self._throttler,
+            self.mass.http_session.get(url, params=kwargs, ssl=False) as response,
+        ):
             result = await response.json()
             if not result or "error" in result:
                 self.logger.error(url)
index 054eb4e2e8245ded4652c406f963442bf7f438de..5f2f3dda68e8003795b19681b0262850aa9d1bf6 100644 (file)
@@ -4,6 +4,7 @@ Universal Group Player provider.
 This is more like a "virtual" player provider,
 allowing the user to create player groups from all players known in the system.
 """
+
 from __future__ import annotations
 
 import asyncio
index 32d56b7f1317d05b59a2f96dd230aa406c42953c..f1e5575b7f0a2b62f71424531ff379e7b42be6e7 100644 (file)
@@ -1,4 +1,5 @@
 """Basic provider allowing for external URL's to be streamed."""
+
 from __future__ import annotations
 
 import os
index 6b3f667e98bd58cecbe53857c6f1449d8b66d854..ecfc97cc541afe5af9d2aff5f87255d83f5c8e23 100644 (file)
@@ -1,4 +1,5 @@
 """Youtube Music support for MusicAssistant."""
+
 from __future__ import annotations
 
 import asyncio
index 9af1238ff85f8d16f980e46732e820f45ef636a2..a0b1b309d64549437e5b64187afd5406e60bad5a 100644 (file)
@@ -1,4 +1,5 @@
 """Main Music Assistant class."""
+
 from __future__ import annotations
 
 import asyncio
index c5135bc338726e7fbaac7643e17972e9e16caf4c..681c901853712a6c19d16238517b8f3f54953272 100644 (file)
@@ -3,6 +3,7 @@ Helper to trace memory usage.
 
 https://www.red-gate.com/simple-talk/development/python/memory-profiling-in-python-with-tracemalloc/
 """
+
 import asyncio
 import tracemalloc