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

All albums tracks are listed twice with Plex music provider #2319

Open
1 task done
SirJohnDoe opened this issue May 17, 2024 · 27 comments
Open
1 task done

All albums tracks are listed twice with Plex music provider #2319

SirJohnDoe opened this issue May 17, 2024 · 27 comments
Labels
bug Something isn't working low prio This does not have very high prio

Comments

@SirJohnDoe
Copy link

SirJohnDoe commented May 17, 2024

What version of Music Assistant has the issue?

Stable 2.0.4, Beta 2.1.0b0

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

2024.5.1

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

  • Yes

The problem

All albums tracks are listed twice: once with an icon of the original source, once as 'in library'. The consequence is that every album that is queued will be played twice as it also adds these duplicate tracks.

How to reproduce

Sync a Plex music library. It looks like below. When sorting by track number it will show the 'in library' tracks at the top, and the Plex tracks at the bottom.

image

Music Providers

Plex

Player Providers

UPnP player provider

Full log output

log.txt

Additional information

I've added the Plex music provider again in Beta, and strarted from scratch in the stable release. In both cases it happened.

Unmarking the 'In library' tracks as favourite has no effect.

What version of Home Assistant Core are your running

2024.5.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)

@jonrbloom
Copy link

I'm seeing this too (on HA Yellow). I am using Music Assistant for the first time and assumed I'd messed up my library while tinkering. So I did a clean reinstall of the Addon (not just the Plex component), with the same results.

@sfnis
Copy link

sfnis commented May 22, 2024

I had this issue as well, I removed Plex as a provider, and went to just file system.

You can see the File system provider is not picking up the metadata correctly. Plex shows it as Disc 1 - Track 08, but MA shows it as 0/0.

The response here currently seems to be "fix your metadata" but I have many albums that work fine in Plex, and are still incorrect in MA. There should be some sort of feature request to be able to disable MA Metatdata matching for a provider... but ... I am not sure how that would work.

Also, @SirJohnDoe if the file is tagged correctly, post a screen shot of that here. I use this for tagging: https://www.softpointer.com/tr.htm

@OzGav OzGav added the low prio This does not have very high prio label May 23, 2024
@SirJohnDoe
Copy link
Author

I had this issue as well, I removed Plex as a provider, and went to just file system.

You can see the File system provider is not picking up the metadata correctly. Plex shows it as Disc 1 - Track 08, but MA shows it as 0/0.

The response here currently seems to be "fix your metadata" but I have many albums that work fine in Plex, and are still incorrect in MA. There should be some sort of feature request to be able to disable MA Metatdata matching for a provider... but ... I am not sure how that would work.

Also, @SirJohnDoe if the file is tagged correctly, post a screen shot of that here. I use this for tagging: https://www.softpointer.com/tr.htm

Unfortunately that's not really a solution then, I rely on Plex for correct(ing) metadata, and don't want to start editing all the files and maintaining it with extra tools.

I got the impression that the built in music provider for some reason duplicates all tracks (and favourites them), and for some reason you're not allowed to disable it.

@OzGav
Copy link
Contributor

OzGav commented May 27, 2024

I got the impression that the built in music provider for some reason duplicates all tracks (and favourites them), and for some reason you're not allowed to disable it

The favouriting thing is subject to a separate issue report. #2307

Marcel has worked hard to ensure MA compies with established standards. Just because something works "fine" in Plex does not mean there is a problem with MA as perhaps Plex has implemented some hack workaround.

@sfnis
Copy link

sfnis commented May 27, 2024

Does requiring the folder name to match exactly the album name, ignoring the id3 tag meet established standards?

@OzGav
Copy link
Contributor

OzGav commented May 27, 2024

If you would like to contribute constructively to the project you can submit a PR

@OzGav
Copy link
Contributor

OzGav commented May 27, 2024

You can see the File system provider is not picking up the metadata correctly. Plex shows it as Disc 1 - Track 08, but MA shows it as 0/0.

That is not what is happening based on the reporters own words.

All albums tracks are listed twice: once with an icon of the original source, once as 'in library'.

So the issue is as described by the OP that there appears to be a problem with the Plex provider duplicating the tracks (not the file system provider) but for some reason this is not widespread as this is the only report.

@jonrbloom
Copy link

Not the only report (as mentioned, I see the same thing), but it is fairly low report rate certaintly..

I will try updating to latest Plex server, but note that Bubble uPnP on Android doesn't duplicate. Not definitive proof that it's MA specific, but lends some weight.

What can we do to help isolate the cause?

@sfnis
Copy link

sfnis commented May 27, 2024

I experienced the duplicate file issue as well.

I’d guess that part of the low report rate is that the Plex provider is listed as not being actively developed and users being encouraged to just use the file system provider.

@OzGav
Copy link
Contributor

OzGav commented May 27, 2024

What can we do to help isolate the cause?

I can't think of anything at this point. I don't use Plex so I can't try and reproduce. I am assuming it affects all albums? At some point this will get looked at.

@OzGav OzGav added bug Something isn't working and removed triage labels May 27, 2024
@jonrbloom
Copy link

Ok, thanks. Yes, all albums that I tried exhibit the problem.

@Paul-Vdp
Copy link

Paul-Vdp commented Jun 1, 2024

I just noticed I am suffering from the same problem ...
As I guess all Plex users will (of which there must be many).

@vhsdream
Copy link

Seems to be fixed on 2.1.0b4, at least for me - whatever was done for this version has made using the Plex provider pretty damn awesome. Thank you!

@OzGav
Copy link
Contributor

OzGav commented Jun 12, 2024

@SirJohnDoe please confirm this has been fixed in 2.1.0b4

@jonrbloom
Copy link

Strange, I tried the beta version of the addon (2.1.0b4), but it's not fixed for me.

@OzGav
Copy link
Contributor

OzGav commented Jun 12, 2024

@jonrbloom Any chance you can remove the Plex provider to clear out all the duplicates and then try again?

@jonrbloom
Copy link

It's a clean install of BETA (i was using the release version previously). So my library was already empty.

Note also that I see this when I use the Browse folder to look directly at the Plex media assets.

@Paul-Vdp
Copy link

Paul-Vdp commented Jun 13, 2024

Not fixed for me either - in fact, I cannot see any difference. Removed one of my Plex libraries, let Mass trundle along adapting its libary contents, then re-added said library, let Mass synchronize it, then inspected the track info of some of the albums included, just to find that everything still/again appears twice. And on playing it, the queue again contains all tracks twice ...
As a side note : as a developer I would take a long hard look at my database design when noticing it takes Hass so awful long to get rid of all the info associated with a certain music provider upon deleting the latter. I dare say that with an optimised design such operations could be almost instantaneous ...

@OzGav
Copy link
Contributor

OzGav commented Jun 13, 2024

@Paul-Vdp if you can help out with optimising the DB that would be great.

@vhsdream
Copy link

I would like to rescind my previous comment about the duplication being fixed. It looks like I may have found the outlier that was not duplicated and thought it was fixed. I can't recall which album or artist did not have duplication at the time I checked, but will keep looking for it to see if there is anything different. But for now I am having the duplication issue with every album I've looked at so far (but want to be clear that the album entry is not duplicated, it is only when clicking into the album that the tracks themselves are).

@marcelveldt
Copy link
Member

The Plex API for music items is.... not great... It misses info such as Album artists and disc and track numbers.
Important info that is needed for matching and presenting the right info. I'll see if I can patch some more bandaid into the Plex provider again but its getting harder and harder for me to recommend the Plex provider if you care about your music.

Don't get me wrong, I really like Plex and I use it daily but for music its just plain crap, its entire datamodel is based around movies and tv shows and they tried to squeeze music in there. Maybe it works ok-ish in their own apps (where they probbaly worked around the quirks) but for an external party talking to their api this is not so great.

If anybody wants to help with improving the Plex provider please contact us as we currently do not have an active maintainer on it and me and the other MA core devs are maintaining it on a best-effort base.

@marcelveldt
Copy link
Member

As a side note : as a developer I would take a long hard look at my database design when noticing it takes Hass so awful long to get rid of all the info associated with a certain music provider upon deleting the latter. I dare say that with an optimised design such operations could be almost instantaneous ...

Works is in the progress for further optimizing. The design is rather complex due to all the provider linking and relation so we choose the safe way on removals which is bad for speed. We're even hitting some sqlite limitations. We get some help from database experts but their time is also limited for contributing to an open source project. So unless you are willing to PR some optimizations I'm going to ignore your comment here ;-)

@jonrbloom
Copy link

@marcelveldt: Thank you for the summary on why this is much harder than it sounds. It seems that we should not hold out on Plex, if the API is such a poor fit for music, and look for alternatives. I'm going to switch to smb i think

DLNA would be a better alternative for MASS, as it increases the reach beyond just Plex based music libraries, and is music savvy. It is a very heavy lift though, and I hear you on maintainer shortages. But, I wonder, could you instead connect HASS's media sources (which already supports DLNA servers) to MASS in a similar way to the existing HASS Player provider? Of course that's still that's more work for another non-existant maintainer. Just throwing it out as an idea for the roadmap.

@marcelveldt
Copy link
Member

marcelveldt commented Jun 15, 2024

@marcelveldt: Thank you for the summary on why this is much harder than it sounds. It seems that we should not hold out on Plex, if the API is such a poor fit for music, and look for alternatives. I'm going to switch to smb i think

I think our own file providers are better than Plex atm as they read the ID3 tags as-is.
There may still be bugs in there but that I can influence and fix. I can fix the Plex API if you know what I mean.
Yet somebody with more knowledge of the Plex API may know better and maybe has a few more tricks.
I will at least put a patch in the code for the disc/track numbers (and just ignore the zero numbered ones) in Plex but there is only so little we can do.

DLNA would be a better alternative for MASS, as it increases the reach beyond just Plex based music libraries, and is music savvy. It is a very heavy lift though, and I hear you on maintainer shortages. But, I wonder, could you instead connect HASS's media sources (which already supports DLNA servers) to MASS in a similar way to the existing HASS Player provider? Of course that's still that's more work for another non-existant maintainer. Just throwing it out as an idea for the roadmap.

The HA music sources lack even more metadata than the Plex api so while it may be tempting to use them, longer term it wont.

@jonrbloom
Copy link

Thank you, that all makes sense. I wondered why only the Players had a HASS connection.

... and thanks to the whole MASS team. It's an awesome piece of software. I am so pleased that I can finally kick Sonos into touch.

@marcelveldt
Copy link
Member

Fixed the code to prevent the duplicate albumtracks listing. The fix will be available in the next version (2.0.7 stable or 2.1.0b6 beta)

@Paul-Vdp
Copy link

Well ... installed 2.1.0b6 beta, did the same steps as mentioned in my previous comment, only to find that the double tracks still were there.
Just to make sure : are there any additional steps to take, or another procedure to be followed to get it right ?
If not, then I'm afraid we have to conclude it is not yet fixed ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low prio This does not have very high prio
Projects
Status: In progress
Development

No branches or pull requests

7 participants