From 02a120b476819d94a1d5fbee28c3565ab1bcf373 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 5 Feb 2025 22:55:39 +0100 Subject: [PATCH] Chore: some small code tweaks --- music_assistant/helpers/audio.py | 10 +++++----- music_assistant/providers/filesystem_local/__init__.py | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/music_assistant/helpers/audio.py b/music_assistant/helpers/audio.py index 592188da..165b67a0 100644 --- a/music_assistant/helpers/audio.py +++ b/music_assistant/helpers/audio.py @@ -413,17 +413,17 @@ async def get_media_stream( ffmpeg_proc.proc.pid, ) async for chunk in ffmpeg_proc.iter_chunked(pcm_format.pcm_sample_size): + if chunk_number == 0: + # At this point ffmpeg has started and should now know the codec used + # for encoding the audio. + streamdetails.audio_format.codec_type = ffmpeg_proc.input_format.codec_type + # for non-tracks we just yield all chunks directly if streamdetails.media_type != MediaType.TRACK: yield chunk bytes_sent += len(chunk) continue - if chunk_number == 0: - # At this point ffmpeg has started and should now know the codec used - # for encoding the audio. - streamdetails.audio_format.codec_type = ffmpeg_proc.input_format.codec_type - chunk_number += 1 # determine buffer size dynamically if chunk_number < 5 and strip_silence_begin: diff --git a/music_assistant/providers/filesystem_local/__init__.py b/music_assistant/providers/filesystem_local/__init__.py index d27566e2..d61f28bb 100644 --- a/music_assistant/providers/filesystem_local/__init__.py +++ b/music_assistant/providers/filesystem_local/__init__.py @@ -70,7 +70,6 @@ from .constants import ( CONF_ENTRY_CONTENT_TYPE_READ_ONLY, CONF_ENTRY_MISSING_ALBUM_ARTIST, CONF_ENTRY_PATH, - CONF_MISSING_ALBUM_ARTIST_ACTION, IMAGE_EXTENSIONS, PLAYLIST_EXTENSIONS, PODCAST_EPISODE_EXTENSIONS, @@ -1319,7 +1318,7 @@ class LocalFileSystemProvider(MusicProvider): album_artists.append(artist) else: # album artist tag is missing, determine fallback - fallback_action = self.config.get_value(CONF_MISSING_ALBUM_ARTIST_ACTION) + fallback_action = self.config.get_value(CONF_ENTRY_MISSING_ALBUM_ARTIST.key) if fallback_action == "folder_name" and album_dir: possible_artist_folder = os.path.dirname(album_dir) self.logger.warning( -- 2.34.1