ampache / ampache-xbmc-plugin

KODI plugin for Ampache
Other
8 stars 3 forks source link

Handling albums with no `disk` node #6

Closed paulijar closed 3 years ago

paulijar commented 3 years ago

When the Nextcloud Music returns album elements, those never include the node disk. The Kodi Ampache plugin shows currently "[ Disk None ]" on such albums which looks quite ugly and crowded. Would you consider handling such cases gracefully, and not show the disc number if there is none?

Leaving out the disk has been an intentional design choice in the Nextcloud Music. To have a single disc number on an album means, that you have to show each disc of an album like they were separate albums. Then it will be difficult to e.g. shuffle play over the whole album. The Music app worked like this originally but I felt that it was a bit wrong, and so did many of my users. I feel that an album ought to be a single entity, and splitting it to multiple discs is just a technical detail caused by the limited capacity of the CD (or LP) format.

So nowadays, the Music app handles multi-disc albums so that they are stored and shown as just one album. To enable correct ordering by disc/track number, we create artificial track numbers for the songs of multi-disc albums: The first disc has tracks 101, 102, 103,..., then second disc has tracks 201, 202, 203,... and so on. This isn't quite optimal, but I think it's good enough compromise.

screenshot000

PS: There seems to be something wrong in the Kodi plugin also regarding to the handling of non-ASCII characters: As can be seen also in the screenshot above, the artist name is not shown on those albums where either the album name or the artist name contains any non-ASCII characters. In my library, the non-ASCII characters present are 'ä', 'ö', and 'é', and none of the albums containing any of these characters have the artist name shown in the albums view.

lusum commented 3 years ago

I will check with some strange name album, the disk number should be only a simply check, the unicode part is quite a pain cause the differences between python2 and python3 and the necessity of mantain both. Have you checked the non-ASCII characters with kodi 19? Kodi 18 is python2, kodi 19 is python3. If they are ok in python3, i will have to fix only the python2 part.

paulijar commented 3 years ago

Thanks for the quick reply. I have been using the latest Kodi release version which is 18.9. But I can check the v19 beta2 too, just a minute...

lusum commented 3 years ago

Disk issue solved, it was a simply if disknumber != "None", the api return None, that is cast to a string, i prefer to not change this code, cause i don't fix working code :smile:

paulijar commented 3 years ago

Just tested the v19 beta2, and the problem with the non-ASCII characters is not present there.

lusum commented 3 years ago

The function is https://github.com/ampache/ampache-xbmc-plugin/blob/master/default.py#L61

ok, so this code is the problem, node.findtext("name").encode("utf-8") , in python2 i have to encode in utf-8 that is the standard encoding sent by ampache server <?xml version="1.0" encoding="UTF-8" ?>

Nextcloud server don't send encoding <?xml version="1.0"?> , at least on my setup, so have no idea how to fix this bug, in the 19 it is not present, so, maybe we have only to wait.

paulijar commented 3 years ago

Do you mean the encoding attribute in the XML head element, e.g. <?xml version="1.0" encoding="UTF-8" ?>? I can probably add this attribute to the responses from Nextcloud Music if that would be helpful.

lusum commented 3 years ago

No, i don't this it would be helpful, i have found that album string in python2 were ascii and not utf-8, i have commited a fix, i hope it will fix something, try it on kodi 18 and 19 ( to see if something is broken ) and write me the results.

Edit: i have committed a better fix, i will pass everything in charge to future library, cause the previous fix had the problem that don't concatenate some album and artists

paulijar commented 3 years ago

I just downloaded the latest master branch version and it seems to work great now on Kodi 18.9!

I no longer have the Kodi 19 installed as it turned out that there really can't be parallel versions of Kodi installed on one system: When I first installed the v19 alongside the v18.9, everything seemed fine and the Ampache plugin was usable on the v19 without any extra steps. But then I realized that the plugin no longer worked on 18.9, but only showed an error popup. I uninstalled v19 and reinstalled v18.9 and the Ampache plugin, but still the plugin was broken. What solved the issue, was to uninstall v18.9 and let the uninstaller delete also my profile. Then, installed the v18.9 from scratch and reinstalled the plugin and then it worked.

Edit: I probably add the encoding="UTF-8" to XML responses of Nextcloud Music anyway to mimic the real Ampache and Subsonic servers, even though it's not relevant here.

lusum commented 3 years ago

I use kodi 18.9 on my default operating system, kodi 19 on a linux virtual machine to test the plugin. I have also other setups for different servers. So, if you want to test with multiple clients i suggest the virtual machine solution. I have found a lot of bugs only switching between servers and clients.