Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube Music Not syncing #3485

Closed
1 task done
Doug411 opened this issue Jan 21, 2025 · 7 comments · Fixed by music-assistant/server#1924
Closed
1 task done

YouTube Music Not syncing #3485

Doug411 opened this issue Jan 21, 2025 · 7 comments · Fixed by music-assistant/server#1924
Labels
bug Something isn't working

Comments

@Doug411
Copy link

Doug411 commented Jan 21, 2025

What version of Music Assistant has the issue?

2.40b18

What version of the Home Assistant Integration have you got installed?

No response

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

  • Yes

The problem

My YTM provider stopped syncing. Its failing when attempting to sync playlists. It was working, and had synced all my YTM playlists previously

I verified that none of the playlists in YTM are empty.
I've compared inventory of playlists in my YTM library to my inventory of playlists in MA. They are the same. Most are YTM generated playlists (not created by me). They had all synced successfully in the past

Things I've tried.

  1. Deleting all my albums, artists and tracks from YTM. Only Playlists in library now (didnt work)
  2. Updating my cookie for the YTM provider in MA (didn't work)
  3. Deleting YTM provider in MA and readding (didn't work... now it really sucks, because I have nothing to play in MA)

This is an exerpt from the verbose log (I will attach the non-verbose one below). It seems to indicate there is a null value somewhere.

2025-01-21 12:37:33.673 INFO (MainThread) [music_assistant] Loaded music provider ytmusic
2025-01-21 12:37:33.687 DEBUG (MainThread) [music_assistant.ytmusic] Start sync of artist items.
2025-01-21 12:37:33.851 DEBUG (MainThread) [music_assistant.ytmusic] Start sync of album items.
2025-01-21 12:37:33.957 DEBUG (MainThread) [music_assistant.webserver] Handling command config/providers
2025-01-21 12:37:34.005 DEBUG (MainThread) [music_assistant.ytmusic] Start sync of track items.
2025-01-21 12:37:34.153 DEBUG (MainThread) [music_assistant.ytmusic] Start sync of playlist items.
2025-01-21 12:37:34.567 WARNING (MainThread) [music_assistant] Exception in task Task-216 - target: <coroutine object MusicController._start_provider_sync..run_sync at 0x7f56e65ceb40>: NOT NULL constraint failed: playlists.is_editable
Traceback (most recent call last):
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/music.py", line 931, in run_sync
await provider.sync_library(media_types)
File "/app/venv/lib/python3.12/site-packages/music_assistant/models/music_provider.py", line 616, in sync_library
library_item = await controller.add_item_to_library(prov_item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/media/base.py", line 127, in add_item_to_library
library_id = await self._add_library_item(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/media/playlists.py", line 283, in _add_library_item
db_id = await self.mass.music.database.insert(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/helpers/database.py", line 179, in insert
row_id = await self._db.execute_insert(sql_query, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 203, in execute_insert
return await self._execute(self._execute_insert, sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 132, in _execute
return await future
^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 115, in run
result = function()
^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 88, in _execute_insert
cursor = self._conn.execute(sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.IntegrityError: NOT NULL constraint failed: playlists.is_editable
2025-01-21 12:37:34.567 WARNING (MainThread) [music_assistant.music] Sync task for YouTube Music completed with errors
Traceback (most recent call last):
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/music.py", line 931, in run_sync
await provider.sync_library(media_types)
File "/app/venv/lib/python3.12/site-packages/music_assistant/models/music_provider.py", line 616, in sync_library
library_item = await controller.add_item_to_library(prov_item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/media/base.py", line 127, in add_item_to_library
library_id = await self._add_library_item(item)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/controllers/media/playlists.py", line 283, in _add_library_item
db_id = await self.mass.music.database.insert(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/music_assistant/helpers/database.py", line 179, in insert
row_id = await self._db.execute_insert(sql_query, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 203, in execute_insert
return await self._execute(self._execute_insert, sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 132, in _execute
return await future
^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 115, in run
result = function()
^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/aiosqlite/core.py", line 88, in _execute_insert
cursor = self._conn.execute(sql, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.IntegrityError: NOT NULL constraint failed: playlists.is_editable

How to reproduce

Sync YTM

Music Providers

Sirius
YTM
Audiobookshelf
RadioBrowser
Jellyfin

Player Providers

Chromecast

Full log output

music-assistant-log.pdf

Additional information

No response

What version of Home Assistant Core are your running

2025.1.3

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Generic x86-64 (e.g. Intel NUC)

@Doug411 Doug411 added the triage label Jan 21, 2025
@OzGav
Copy link
Contributor

OzGav commented Jan 21, 2025

@MarvinSchenkel

@MarvinSchenkel
Copy link
Contributor

@marcelveldt I see you added a new property to the Playlist object is_editable. However, the YTM code you added seems fine to me (https://github.com/music-assistant/server/blob/067bce4925ebea67a333ca38699970cbf33b8417/music_assistant/providers/ytmusic/__init__.py#L648). I don't see how this would translate to a NULL value in the database.

Could there be something missing in the serialisation of the Playlist object when inserting it into the database?

@Doug411
Copy link
Author

Doug411 commented Jan 22, 2025

Hey guys, while you are looking at this. Is there a reason why all items in the YTM library are brought in as favorites? (Songs, Albums, Artists, Playlists, etc). In my case, I like to add a lot of ablums to my library. Every track in every album is imported as a favorite in MASS (even if it wasnt a favorite in YTM). My preference would be to be able to use my discretion on what to favorite within MASS. Its a lot of work to unfavorite everything.... So either bring my YTM library in with no favorites in MASS, or only favorite the items that are favorites in YTM. Thoughts?

Were you able to replicate the problem above on your library? I see that there was a new property added. Just curious if there is something unique to my library, or if it is causing issues in other libraries. FYI, I deleted everything out of my YTM library except for 3 user generated playlists, and still had the issue.

@MarvinSchenkel
Copy link
Contributor

MarvinSchenkel commented Jan 27, 2025

@Doug411 is this still an issue in the latest beta (2.4.0 b20)?

@MarvinSchenkel
Copy link
Contributor

Update, managed to reproduce the issue. Will fix it.

@OzGav OzGav added bug Something isn't working and removed triage labels Jan 29, 2025
@Doug411
Copy link
Author

Doug411 commented Jan 29, 2025

Much Thanks Marvin! I'm anxious to get my playlists back! : )

In addition to the playlists not syncing due to null.....Any thoughts on not favoriting all items when syncing YTM library?

@MarvinSchenkel
Copy link
Contributor

@OzGav Do you happen to know if this is default behaviour in MA, e.g. 'items in the provider's library are considered favourites?' I checked for YTM, and even though the favourite property of the item is False, it still shows up as 'hearted' in MA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants