music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.23k stars 44 forks source link

Issue: Only a part of Jellyfin songs are available #2594

Open beankylla opened 1 week ago

beankylla commented 1 week ago

What version of Music Assistant has the issue?

2.0.b8

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

Without integration

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

The problem

Hi,

Only part of the jellyfin library is available in Music assistant.

I had to activate verbose to see the error below, it would not show up on info logs:

is this a known issue? and linked to the fact that not whole library syncs?

Is it caused by 1 song/album? is there any way to activate login to know on which entry this happens?

How to reproduce

Scan media from the jellyfin provider, wait.

Music Providers

Jellyfin

Player Providers

All

Full log output

_2024-07-07 07:56:14.461 WARNING (MainThread) [music_assistant.music] Sync task for xx.com completed with errors
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/music.py", line 700, in run_sync
await provider.sync_library(media_types)
File "/usr/local/lib/python3.12/site-packages/music_assistant/server/models/music_provider.py", line 396, in sync_library
async for prov_item in self._get_library_gen(media_type):
File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/init.py", line 354, in get_library_tracks
yield parse_track(self.logger, self.instance_id, self.client, track)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/parsers.py", line 170, in parse_track
content = jellyfin_track[ITEM_KEY_MEDIA_STREAMS][0][ITEM_KEY_MEDIA_CODEC]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Additional information

No additional info

What version of Home Assistant Core are your running

does not matter :)

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

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

Jc2k commented 1 week ago

I've added some extra logging in https://github.com/music-assistant/server/pull/1469, and syncing should continue too. That will be in the next beta.

Don't know why you have tracks that don't have any MediaStreams, though. If you have /some/ tracks then I don't think its permissions related. Do you have any music videos or obscure audio file formats in the Jellyfin library? Or maybe we've found some tracks that exist in the Jellyfin db but not on disk?

Are you running Jellyfin 10.9.7?

OzGav commented 1 week ago

@beankylla The sync should continue now and the problems logged. Please confirm this is the case

beankylla commented 1 week ago

No change in behavior. No additional song in my Music Assistant

I have different logs (i mean they mention different lines:


Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/music.py", line 694, in run_sync
    await provider.sync_library(media_types)
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/models/music_provider.py", line 402, in sync_library
    async for prov_item in self._get_library_gen(media_type):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/__init__.py", line 360, in get_library_tracks
    yield parse_track(self.logger, self.instance_id, self._client, track)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/parsers.py", line 166, in parse_track
    content = jellyfin_track[ITEM_KEY_MEDIA_STREAMS][0][ITEM_KEY_MEDIA_CODEC]
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
2024-07-09 08:56:11.786 DEBUG (MainThread) [music_assistant.music] Performing database cleanup...
2024-07-09 08:56:11.812 DEBUG (MainThread) [music_assistant.music] Database cleanup done
2024-07-09 08:57:30.567 DEBUG (MainThread) [music_assistant.music.artist] updated Artist in database: 816
2024-07-09 08:57:30.570 DEBUG (MainThread) [music_assistant.music.artist] updated Artist in database: (id 816)
2024-07-09 08:58:24.953 WARNING (MainThread) [music_assistant.music] Sync task for XXX completed with errors
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/music.py", line 694, in run_sync
    await provider.sync_library(media_types)
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/models/music_provider.py", line 402, in sync_library
    async for prov_item in self._get_library_gen(media_type):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/__init__.py", line 360, in get_library_tracks
    yield parse_track(self.logger, self.instance_id, self._client, track)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/parsers.py", line 166, in parse_track
    content = jellyfin_track[ITEM_KEY_MEDIA_STREAMS][0][ITEM_KEY_MEDIA_CODEC]
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
2024-07-09 08:58:24.955 DEBUG (MainThread) [music_assistant.music] Performing database cleanup...
2024-07-09 08:58:24.988 DEBUG (MainThread) [music_assistant.music] Database cleanup done
2024-07-09 08:59:35.891 WARNING (MainThread) [music_assistant.music] Sync task for XXX completed with errors
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/music.py", line 694, in run_sync
    await provider.sync_library(media_types)
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/models/music_provider.py", line 402, in sync_library
    async for prov_item in self._get_library_gen(media_type):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/__init__.py", line 360, in get_library_tracks
    yield parse_track(self.logger, self.instance_id, self._client, track)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/jellyfin/parsers.py", line 166, in parse_track
    content = jellyfin_track[ITEM_KEY_MEDIA_STREAMS][0][ITEM_KEY_MEDIA_CODEC]
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
2024-07-09 08:59:35.892 DEBUG (MainThread) [music_assistant.music] Performing database cleanup...
2024-07-09 08:59:35.926 DEBUG (MainThread) [music_assistant.music] Database cleanup done```
Jc2k commented 1 week ago

There were 2 places that needed the change, and I only changed the first. Fixed in https://github.com/music-assistant/server/pull/1484.

beankylla commented 1 week ago

Thanks! looking fw to the next beta :) Will it provide an insight on the problematic songs / albums?

Jc2k commented 1 week ago

You'll get a log message like:

Invalid track Yellow Submarine: Does not have any media streams

I'll need your help to find out whats wrong with any tracks that it logs. I'll want to know whether it plays in Jellyfin. And i'll probably want screenshots from the jellyfin UI showing any metadata.

beankylla commented 1 week ago

awesoooome. will be happy to provide this!

Jc2k commented 1 week ago

https://github.com/music-assistant/server/releases/tag/2.1.0b15 is out with the change.

OzGav commented 3 days ago

@beankylla do you have more information regarding this issue?

OzGav commented 2 days ago

@beankylla please try with rc2