Chore: some small code tweaks
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 5 Feb 2025 21:55:39 +0000 (22:55 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 5 Feb 2025 21:55:39 +0000 (22:55 +0100)
music_assistant/helpers/audio.py
music_assistant/providers/filesystem_local/__init__.py

index 592188da8d4c1c6943c06104386a0cb99ea90132..165b67a08ecdc8f56d4887befe6cbe9eaf6e2663 100644 (file)
@@ -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:
index d27566e211becd05a110f9627dda40734fd33184..d61f28bba4ecd5d9b96809ad75bd3d0a9decd497 100644 (file)
@@ -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(