repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v2.3.0
+ hooks:
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
async def reader():
# task that reads flac endoded chunks from the subprocess
- self.logger.debug("start reader task")
chunksize = 32000 if output_fmt == ContentType.MP3 else 256000
async for audio_chunk in sox_proc.iterate_chunks(chunksize):
await resp.write(audio_chunk)
- self.logger.debug("reader task finished")
# feed raw pcm chunks into sox/ffmpeg to encode to flac
async def audio_callback(audio_chunk):
if audio_chunk == b"":
- self.logger.debug("last chunk received from stream")
sox_proc.write_eof()
return
await sox_proc.write(audio_chunk)
seconds_per_chunk = buffer_size / sample_size
seconds_needed = int(time() - start_timestamp + seconds_per_chunk)
if (seconds_streamed) > seconds_needed:
- self.logger.debug("cooldown %s seconds", seconds_per_chunk / 2)
await asyncio.sleep(seconds_per_chunk / 2)
# end of the track reached
# update actual duration to the queue for more accurate now playing info
from music_assistant.helpers.process import AsyncProcess, check_output
from music_assistant.helpers.typing import MusicAssistant, QueueItem
from music_assistant.helpers.util import create_tempfile
-from music_assistant.models.errors import AudioError
+from music_assistant.models.errors import AudioError, MediaNotFoundError
from music_assistant.models.media_items import (
ContentType,
MediaType,
)
else:
# always request the full db track as there might be other qualities available
- full_item = await mass.music.get_item_by_uri(
- queue_item.uri, force_refresh=not lazy, lazy=lazy
- )
+ try:
+ full_item = await mass.music.get_item_by_uri(
+ queue_item.uri, force_refresh=not lazy, lazy=lazy
+ )
+ except MediaNotFoundError as err:
+ LOGGER.warning(str(err))
+ return None
+
if not full_item:
return None
# sort by quality and check track availability
async def get_track(self, prov_track_id) -> Track:
"""Get full track details by id."""
- track_obj = await self._get_data("tracks/{prov_track_id}")
+ track_obj = await self._get_data(f"tracks/{prov_track_id}")
return await self._parse_track(track_obj) if track_obj else None
async def get_playlist(self, prov_playlist_id) -> Playlist:
enable=
use-symbolic-message-instead
+[IMPORTS]
+ignored-modules=aiofiles,aiohttp,asyncio_throttle,databases,mashumaro,tinytag
+
[REPORTS]
score=no
ignored-classes=_CountingAttr
[FORMAT]
-expected-line-ending-format=LF
\ No newline at end of file
+expected-line-ending-format=LF
PROJECT_NAME = "Music Assistant"
PROJECT_PACKAGE_NAME = "music_assistant"
-PROJECT_VERSION = "1.0.5"
+PROJECT_VERSION = "1.0.6"
PROJECT_REQ_PYTHON_VERSION = "3.9"
PROJECT_LICENSE = "Apache License 2.0"
PROJECT_AUTHOR = "Marcel van der Veldt"