question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V1.1.8: error deleting playlists

See original GitHub issue

I had several file system playlists without content, so decided to delete them. Two issues found: 1: when I delete a playlist, it remains in the list till I close the playlist overview. 2: I had one playlist that I can’t remove and caused two errors:

[546718140736] Error handling message: Unknown error (unknown_error)
21:12:55 – (ERROR) Home Assistant WebSocket API (custom integration)
Job [Add file://playlist/albumsnightwishnightwishm3u to database] failed with error 'utf-8' codec can't decode byte 0xe4 in position 3021: invalid continuation byte.
21:12:55 – (ERROR) /usr/local/lib/python3.9/site-packages/music_assistant/mass.py

Details:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/mass/websockets.py:736 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 21:12:55 (1 occurrences) 
Last logged: 21:12:55

[546718140736] Error handling message: Unknown error (unknown_error)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/config/custom_components/mass/websockets.py", line 96, in async_get_mass_func
    await orig_func(hass, connection, msg, mass)
  File "/config/custom_components/mass/websockets.py", line 736, in websocket_library_remove
    await mass.music.remove_from_library(item.media_type, item.item_id, item.provider)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/__init__.py", line 220, in remove_from_library
    await ctrl.remove_from_library(
  File "/usr/local/lib/python3.9/site-packages/music_assistant/models/media_controller.py", line 153, in remove_from_library
    db_item = await self.get(
  File "/usr/local/lib/python3.9/site-packages/music_assistant/models/media_controller.py", line 96, in get
    return await self.add(details)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/playlists.py", line 52, in add
    await self.mass.metadata.get_playlist_metadata(item)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/metadata/__init__.py", line 102, in get_playlist_metadata
    for track in await self.mass.music.playlists.tracks(
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/playlists.py", line 47, in tracks
    return await provider.get_playlist_tracks(item_id)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/providers/filesystem.py", line 285, in get_playlist_tracks
    for line in await _file.readlines():
  File "/usr/local/lib/python3.9/site-packages/aiofiles/threadpool/utils.py", line 45, in method
    return (yield from self._loop.run_in_executor(self._executor, cb))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 3021: invalid continuation byte


Logger: music_assistant.mass
Source: /usr/local/lib/python3.9/site-packages/music_assistant/mass.py:243 
First occurred: 21:12:55 (1 occurrences) 
Last logged: 21:12:55

Job [Add file://playlist/albumsnightwishnightwishm3u to database] failed with error 'utf-8' codec can't decode byte 0xe4 in position 3021: invalid continuation byte.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/playlists.py", line 52, in add
    await self.mass.metadata.get_playlist_metadata(item)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/metadata/__init__.py", line 102, in get_playlist_metadata
    for track in await self.mass.music.playlists.tracks(
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/playlists.py", line 47, in tracks
    return await provider.get_playlist_tracks(item_id)
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/providers/filesystem.py", line 285, in get_playlist_tracks
    for line in await _file.readlines():
  File "/usr/local/lib/python3.9/site-packages/aiofiles/threadpool/utils.py", line 45, in method
    return (yield from self._loop.run_in_executor(self._executor, cb))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 3021: invalid continuation byte

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
marcelveldtcommented, May 20, 2022

The other issue is still in. The removed (hidden) playlist is not removed from the list until you close the playlist view and re-open the view. That is at least confusing.

Ah yes, I need to notify the listing that the content needs to be refreshed. I’m going to introduce a generic approach for that with an event from the backend, same logic that is now used when the metadata of an object was lazy loaded in the background and you automagically see the new details.

By the way. After upgrading from 1.1.9 to 1.1.11 I got a rescan and all previously deleted playlist where back. No problem while I’m beta, but something to avoid once final

Yes, at this time I’m too lazy to write migration logic so I just reset the db each I time I make a possibly breaking change in the model. I think we’re almost at the point where we reach the first stable version after which I will also follow a more structured release pattern and try to avoid db rescans whenever possible 😉

For me the last things before I consider things as “MVP” or “first stable version” is when the magic logic and metadata issues are all fixed because that is the foundation of everything. I think we’re almost there. Only this change is left:

https://github.com/music-assistant/hass-music-assistant/issues/184#issuecomment-1132604363

1reaction
erkrcommented, May 20, 2022

Looks good:

Logger: music_assistant.mass.music.file
Source: /usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/providers/filesystem.py:294 
First occurred: 12:23:29 (2 occurrences) 
Last logged: 12:23:29

Error while parsing playlist /media/MP3_normalized/Albums/NightWish/NightWish.m3u
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/music_assistant/controllers/music/providers/filesystem.py", line 286, in get_playlist_tracks
    for line in await _file.readlines():
  File "/usr/local/lib/python3.9/site-packages/aiofiles/threadpool/utils.py", line 45, in method
    return (yield from self._loop.run_in_executor(self._executor, cb))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 3021: invalid continuation byte
Read more comments on GitHub >

github_iconTop Results From Across the Web

I cannot delete a playlist, error message always occur which ...
To do this, tap Library / Playlists, tap the playlist concerned, then tap the pencil icon, and change the privacy to Private, then...
Read more >
Cannot Delete Playlists - Samsung Community - 1692664
I'm using Samsung Music. When I delete a Playlist and restart my tablet, the playlists is back. Why, and how do I delete...
Read more >
I can't delete my playlist : r/YoutubeMusic - Reddit
Try deleting them through regular YouTube.com, it might help.
Read more >
LUNA Release Notes - Universal Audio Support Home
Shift + Command + delete deletes selected tracks ... LUNA sessions opened in v1.1.8 cannot be opened in earlier LUNA versions due to...
Read more >
API bug: Cannot remove specific song from a playlist ... - GitHub
Deleting in the official spotify app works, however not with the API. I was able to have 3 cases of this, one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found