Skip to content

Commit

Permalink
Fix: leftover issues after repo split up
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Nov 2, 2024
1 parent 03530f9 commit cec5e7f
Show file tree
Hide file tree
Showing 41 changed files with 214 additions and 223 deletions.
6 changes: 3 additions & 3 deletions music_assistant/controllers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from cryptography.fernet import Fernet, InvalidToken
from music_assistant_models import config_entries
from music_assistant_models.config_entries import (
DEFAULT_CORE_CONFIG_ENTRIES,
DEFAULT_PROVIDER_CONFIG_ENTRIES,
ConfigEntry,
ConfigValueType,
CoreConfig,
Expand All @@ -30,14 +28,16 @@
PlayerCommandFailed,
UnsupportedFeaturedException,
)
from music_assistant_models.helpers.global_cache import get_global_cache_value
from music_assistant_models.helpers import get_global_cache_value

from music_assistant.constants import (
CONF_CORE,
CONF_PLAYERS,
CONF_PROVIDERS,
CONF_SERVER_ID,
CONFIGURABLE_CORE_CONTROLLERS,
DEFAULT_CORE_CONFIG_ENTRIES,
DEFAULT_PROVIDER_CONFIG_ENTRIES,
ENCRYPT_SUFFIX,
)
from music_assistant.helpers.api import api_command
Expand Down
12 changes: 2 additions & 10 deletions music_assistant/controllers/media/albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any

from music_assistant_models.enums import CacheCategory, ProviderFeature
from music_assistant_models.enums import AlbumType, CacheCategory, MediaType, ProviderFeature
from music_assistant_models.errors import (
InvalidDataError,
MediaNotFoundError,
UnsupportedFeaturedException,
)
from music_assistant_models.media_items import (
Album,
AlbumType,
Artist,
ItemMapping,
MediaType,
Track,
UniqueList,
)
from music_assistant_models.media_items import Album, Artist, ItemMapping, Track, UniqueList

from music_assistant.constants import DB_TABLE_ALBUM_ARTISTS, DB_TABLE_ALBUM_TRACKS, DB_TABLE_ALBUMS
from music_assistant.controllers.media.base import MediaControllerBase
Expand Down
12 changes: 2 additions & 10 deletions music_assistant/controllers/media/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@
import contextlib
from typing import TYPE_CHECKING, Any

from music_assistant_models.enums import CacheCategory, ProviderFeature
from music_assistant_models.enums import AlbumType, CacheCategory, MediaType, ProviderFeature
from music_assistant_models.errors import (
MediaNotFoundError,
ProviderUnavailableError,
UnsupportedFeaturedException,
)
from music_assistant_models.media_items import (
Album,
AlbumType,
Artist,
ItemMapping,
MediaType,
Track,
UniqueList,
)
from music_assistant_models.media_items import Album, Artist, ItemMapping, Track, UniqueList

from music_assistant.constants import (
DB_TABLE_ALBUM_ARTISTS,
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/controllers/media/playlists.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
ProviderUnavailableError,
UnsupportedFeaturedException,
)
from music_assistant_models.helpers.uri import create_uri, parse_uri
from music_assistant_models.media_items import Playlist, PlaylistTrack, Track

from music_assistant.constants import DB_TABLE_PLAYLISTS
from music_assistant.helpers.json import serialize_to_json
from music_assistant.helpers.uri import create_uri, parse_uri
from music_assistant.models.music_provider import MusicProvider

from .base import MediaControllerBase
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/controllers/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ProviderType,
)
from music_assistant_models.errors import MediaNotFoundError, ProviderUnavailableError
from music_assistant_models.helpers.global_cache import get_global_cache_value
from music_assistant_models.helpers import get_global_cache_value
from music_assistant_models.media_items import (
Album,
Artist,
Expand Down
4 changes: 2 additions & 2 deletions music_assistant/controllers/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
MusicAssistantError,
ProviderUnavailableError,
)
from music_assistant_models.helpers.global_cache import get_global_cache_value
from music_assistant_models.helpers.uri import parse_uri
from music_assistant_models.helpers import get_global_cache_value
from music_assistant_models.media_items import (
BrowseFolder,
ItemMapping,
Expand All @@ -55,6 +54,7 @@
from music_assistant.helpers.api import api_command
from music_assistant.helpers.database import DatabaseConnection
from music_assistant.helpers.datetime import utc_timestamp
from music_assistant.helpers.uri import parse_uri
from music_assistant.helpers.util import TaskManager
from music_assistant.models.core_controller import CoreController

Expand Down
8 changes: 2 additions & 6 deletions music_assistant/controllers/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

from aiofiles.os import wrap
from aiohttp import web
from music_assistant_models.config_entries import (
CONF_ENTRY_ENABLE_ICY_METADATA,
ConfigEntry,
ConfigValueOption,
ConfigValueType,
)
from music_assistant_models.config_entries import ConfigEntry, ConfigValueOption, ConfigValueType
from music_assistant_models.enums import (
ConfigEntryType,
ContentType,
Expand All @@ -39,6 +34,7 @@
CONF_BIND_PORT,
CONF_CROSSFADE,
CONF_CROSSFADE_DURATION,
CONF_ENTRY_ENABLE_ICY_METADATA,
CONF_HTTP_PROFILE,
CONF_OUTPUT_CHANNELS,
CONF_PUBLISH_IP,
Expand Down
6 changes: 3 additions & 3 deletions music_assistant/helpers/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

import aiofiles
from aiohttp import ClientTimeout
from music_assistant_models.enums import MediaType, StreamType, VolumeNormalizationMode
from music_assistant_models.enums import ContentType, MediaType, StreamType, VolumeNormalizationMode
from music_assistant_models.errors import (
InvalidDataError,
MediaNotFoundError,
MusicAssistantError,
ProviderUnavailableError,
)
from music_assistant_models.helpers.global_cache import set_global_cache_values
from music_assistant_models.media_items import AudioFormat, ContentType
from music_assistant_models.helpers import set_global_cache_values
from music_assistant_models.streamdetails import AudioFormat

from music_assistant.constants import (
CONF_EQ_BASS,
Expand Down
7 changes: 5 additions & 2 deletions music_assistant/helpers/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
from collections.abc import AsyncGenerator
from typing import TYPE_CHECKING

from music_assistant_models.enums import ContentType
from music_assistant_models.errors import AudioError
from music_assistant_models.helpers.global_cache import get_global_cache_value
from music_assistant_models.media_items import AudioFormat, ContentType
from music_assistant_models.helpers import get_global_cache_value

from music_assistant.constants import VERBOSE_LOG_LEVEL

from .process import AsyncProcess
from .util import TimedAsyncGenerator, close_async_generator

if TYPE_CHECKING:
from music_assistant_models.media_items import AudioFormat

LOGGER = logging.getLogger("ffmpeg")
MINIMAL_FFMPEG_VERSION = 6

Expand Down
28 changes: 0 additions & 28 deletions music_assistant/helpers/global_cache.py

This file was deleted.

4 changes: 4 additions & 0 deletions music_assistant/helpers/uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

from music_assistant_models.enums import MediaType
from music_assistant_models.errors import InvalidProviderID, InvalidProviderURI
from music_assistant_models.helpers import create_uri as create_uri_org

base62_length22_id_pattern = re.compile(r"^[a-zA-Z0-9]{22}$")

# create alias to original create_uri function
create_uri = create_uri_org


def valid_base62_length22(item_id: str) -> bool:
"""Validate Spotify style ID."""
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ async def load_provider_module(domain: str, requirements: list[str]) -> Provider

@lru_cache
def _get_provider_module(domain: str) -> ProviderModuleType:
return importlib.import_module(f".{domain}", ".providers")
return importlib.import_module(f".{domain}", "music_assistant.providers")

# ensure module requirements are met
for requirement in requirements:
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from music_assistant_models.enums import EventType, ProviderType
from music_assistant_models.errors import MusicAssistantError, SetupFailedError
from music_assistant_models.event import MassEvent
from music_assistant_models.helpers.global_cache import set_global_cache_values
from music_assistant_models.helpers import set_global_cache_values
from music_assistant_models.provider import ProviderManifest
from zeroconf import IPVersion, NonUniqueNameException, ServiceStateChange, Zeroconf
from zeroconf.asyncio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf
Expand Down
12 changes: 6 additions & 6 deletions music_assistant/models/player_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
from abc import abstractmethod
from typing import TYPE_CHECKING

from music_assistant_models.config_entries import (
from music_assistant_models.errors import UnsupportedFeaturedException
from zeroconf import ServiceStateChange
from zeroconf.asyncio import AsyncServiceInfo

from music_assistant.constants import (
BASE_PLAYER_CONFIG_ENTRIES,
CONF_ENTRY_ANNOUNCE_VOLUME,
CONF_ENTRY_ANNOUNCE_VOLUME_MAX,
CONF_ENTRY_ANNOUNCE_VOLUME_MIN,
CONF_ENTRY_ANNOUNCE_VOLUME_STRATEGY,
ConfigEntry,
PlayerConfig,
)
from music_assistant_models.errors import UnsupportedFeaturedException
from zeroconf import ServiceStateChange
from zeroconf.asyncio import AsyncServiceInfo

from .provider import Provider

if TYPE_CHECKING:
from music_assistant_models.config_entries import ConfigEntry, PlayerConfig
from music_assistant_models.player import Player, PlayerMedia

# ruff: noqa: ARG001, ARG002
Expand Down
28 changes: 12 additions & 16 deletions music_assistant/providers/airplay/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,7 @@
from random import randrange
from typing import TYPE_CHECKING

from music_assistant_models.config_entries import (
CONF_ENTRY_CROSSFADE,
CONF_ENTRY_CROSSFADE_DURATION,
CONF_ENTRY_EQ_BASS,
CONF_ENTRY_EQ_MID,
CONF_ENTRY_EQ_TREBLE,
CONF_ENTRY_FLOW_MODE_ENFORCED,
CONF_ENTRY_OUTPUT_CHANNELS,
CONF_ENTRY_SYNC_ADJUST,
ConfigEntry,
create_sample_rates_config_entry,
)
from music_assistant_models.config_entries import ConfigEntry
from music_assistant_models.enums import (
ConfigEntryType,
ContentType,
Expand All @@ -36,10 +25,16 @@
from zeroconf import ServiceStateChange
from zeroconf.asyncio import AsyncServiceInfo

from music_assistant.helpers import (
convert_airplay_volume,
get_model_from_am,
get_primary_ip_address,
from music_assistant.constants import (
CONF_ENTRY_CROSSFADE,
CONF_ENTRY_CROSSFADE_DURATION,
CONF_ENTRY_EQ_BASS,
CONF_ENTRY_EQ_MID,
CONF_ENTRY_EQ_TREBLE,
CONF_ENTRY_FLOW_MODE_ENFORCED,
CONF_ENTRY_OUTPUT_CHANNELS,
CONF_ENTRY_SYNC_ADJUST,
create_sample_rates_config_entry,
)
from music_assistant.helpers.audio import get_ffmpeg_stream
from music_assistant.helpers.datetime import utc
Expand All @@ -58,6 +53,7 @@
CONF_READ_AHEAD_BUFFER,
FALLBACK_VOLUME,
)
from .helpers import convert_airplay_volume, get_model_from_am, get_primary_ip_address
from .player import AirPlayPlayer

if TYPE_CHECKING:
Expand Down
13 changes: 9 additions & 4 deletions music_assistant/providers/apple_music/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@

import aiofiles
from music_assistant_models.config_entries import ConfigEntry, ConfigValueType
from music_assistant_models.enums import ConfigEntryType, ExternalID, ProviderFeature, StreamType
from music_assistant_models.enums import (
AlbumType,
ConfigEntryType,
ContentType,
ExternalID,
ImageType,
ProviderFeature,
StreamType,
)
from music_assistant_models.errors import MediaNotFoundError, ResourceTemporarilyUnavailable
from music_assistant_models.media_items import (
Album,
AlbumType,
Artist,
AudioFormat,
ContentType,
ImageType,
ItemMapping,
MediaItemImage,
MediaItemType,
Expand Down
20 changes: 9 additions & 11 deletions music_assistant/providers/bluesound/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,29 @@
import time
from typing import TYPE_CHECKING, TypedDict

from music_assistant_models.config_entries import (
CONF_ENTRY_CROSSFADE,
CONF_ENTRY_ENABLE_ICY_METADATA,
CONF_ENTRY_ENFORCE_MP3,
CONF_ENTRY_FLOW_MODE_ENFORCED,
CONF_ENTRY_HTTP_PROFILE_FORCED_2,
ConfigEntry,
ConfigValueType,
)
from music_assistant_models.enums import PlayerFeature, PlayerState, PlayerType, ProviderFeature
from music_assistant_models.errors import PlayerCommandFailed
from music_assistant_models.player import DeviceInfo, Player, PlayerMedia
from pyblu import Player as BluosPlayer
from pyblu import Status, SyncStatus
from zeroconf import ServiceStateChange

from music_assistant.constants import VERBOSE_LOG_LEVEL
from music_assistant.constants import (
CONF_ENTRY_CROSSFADE,
CONF_ENTRY_ENABLE_ICY_METADATA,
CONF_ENTRY_ENFORCE_MP3,
CONF_ENTRY_FLOW_MODE_ENFORCED,
CONF_ENTRY_HTTP_PROFILE_FORCED_2,
VERBOSE_LOG_LEVEL,
)
from music_assistant.helpers.util import (
get_port_from_zeroconf,
get_primary_ip_address_from_zeroconf,
)
from music_assistant.models.player_provider import PlayerProvider

if TYPE_CHECKING:
from music_assistant_models.config_entries import ProviderConfig
from music_assistant_models.config_entries import ConfigEntry, ConfigValueType, ProviderConfig
from music_assistant_models.provider import ProviderManifest
from zeroconf.asyncio import AsyncServiceInfo

Expand Down
2 changes: 1 addition & 1 deletion music_assistant/providers/builtin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
MediaNotFoundError,
ProviderUnavailableError,
)
from music_assistant_models.helpers.uri import parse_uri
from music_assistant_models.media_items import (
Artist,
AudioFormat,
Expand All @@ -42,6 +41,7 @@

from music_assistant.constants import MASS_LOGO, RESOURCES_DIR, VARIOUS_ARTISTS_FANART
from music_assistant.helpers.tags import AudioTags, parse_tags
from music_assistant.helpers.uri import parse_uri
from music_assistant.models.music_provider import MusicProvider

if TYPE_CHECKING:
Expand Down
Loading

0 comments on commit cec5e7f

Please sign in to comment.