epoupon / lms

Lightweight Music Server. Access your self-hosted music using a web interface.
http://lms-demo.poupon.dev
GNU General Public License v3.0
1.09k stars 62 forks source link

Unexpected response from /rest/getIndexes endpoint #184

Closed pluggemi closed 2 years ago

pluggemi commented 2 years ago

First of all, really like this software - especially since it is the only Subsonic compatible server software that I have found that correctly parses multi-value attributes for the Artist tag - so thanks for that!

While investigating some weird behavior on a client app - specifically iSub on IOS - I noticed that the result of the /rest/getIndexes endpoint was not what I was expecting. Put simply, all of the returned artists were showed <index name="?"> instead of being broken up into separate letters.

I confirmed this by doing a curl command to the server - specifically this command:

curl 'http://localhost:5082/rest/getIndexes?c=iSub&v=1.16.0&u=<MASKED>&p=<MASKED>' > sample.xml

The result is this - sample.xml

<?xml version="1.0" encoding="utf-8"?>
<subsonic-response status="ok" version="1.16.0">
  <indexes ignoredArticles="" lastModified="946684800000">
    <index name="?">
      <artist id="ar-1" name="A Winged Victory for the Sullen"/>
      <artist id="ar-2" name="Adam Bryanbaum Wiltzie"/>
      <artist id="ar-5" name="DJ Pone"/>
      <artist id="ar-4" name="dOP"/>
      <artist id="ar-12" name="Elam"/>
      <artist id="ar-11" name="Hilyard"/>
      <artist id="ar-6" name="Jaw"/>
      <artist id="ar-10" name="Jon McCafferty"/>
      <artist id="ar-13" name="Northumbria"/>
      <artist id="ar-3" name="Petite Noir"/>
      <artist id="ar-9" name="Stars of the Lid"/>
      <artist id="ar-7" name="The Shoes"/>
      <artist id="ar-8" name="Thomas Azier"/>
    </index>
  </indexes>
</subsonic-response>

Expected result This is the result that I expected - expected.xml

<?xml version="1.0" encoding="utf-8"?>
<subsonic-response status="ok" version="1.16.0">
  <indexes ignoredArticles="" lastModified="946684800000">
    <index name="A">
      <artist id="ar-1" name="A Winged Victory for the Sullen"/>
      <artist id="ar-2" name="Adam Bryanbaum Wiltzie"/>
    </index>
    <index name="D">
      <artist id="ar-5" name="DJ Pone"/>
      <artist id="ar-4" name="dOP"/>
    </index>
    <index name="E">
      <artist id="ar-12" name="Elam"/>
    </index>
    <index name="H">
      <artist id="ar-11" name="Hilyard"/>
    </index>
    <index name="J">
      <artist id="ar-6" name="Jaw"/>
      <artist id="ar-10" name="Jon McCafferty"/>
    </index>
    <index name="N">
      <artist id="ar-13" name="Northumbria"/>
    </index>
    <index name="P">
      <artist id="ar-3" name="Petite Noir"/>
    </index>
    <index name="S">
      <artist id="ar-9" name="Stars of the Lid"/>
      <artist id="ar-7" name="The Shoes"/>
    </index>
    <index name="T">
      <artist id="ar-8" name="Thomas Azier"/>
    </index>
  </indexes>
</subsonic-response>

Is the expected result a correct assumption?

I am using the epoupon/lms Docker container of version 3.27.0 for amd64, digest 5ab9b8f92072.

Thoughts? Thanks!

epoupon commented 2 years ago

Hello!

Yes indeed it is currently implemented this way. I have a question: what should we do with non-latin artist names?

pluggemi commented 2 years ago

Excellent question and I am not sure what the correct answer is. Sorting (and by extension creating an Index) for non-Latin characters is a widespread challenge.

However, what I have seen other programs do is rely on the ARTISTSORT/ALBUMARTISTSORT tag for this. Musicbrainz requires Latin script for the sort name for this reason.

Other non-default tag combos include COMPOSER/COMPOSERSORT and CONDUCTOR/CONDUCTORSORT and a few other *SORT options listed here: https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html

So for example:

That would also address names that are in RTL scripts such as Arabic:

So I guess the logic would be if there is an ARTISTSORT, use that for the the index, otherwise put it in the <index name="?">?

Thoughts?