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.14k stars 62 forks source link

Strawberry: Parameter 'id': bad format error #16

Closed bytepossum closed 4 years ago

bytepossum commented 4 years ago

When trying to refresh catalog in Strawberry (Clementine fork) I get "Parameter 'id': bad format" error. Relevant LMS logs:

Jan 20 04:10:46 host lms[25291]: <IP> - - [2020-Jan-20 04:10:46.087] "GET /rest/getAlbumList2.view?type=alphabeticalByName&c=Strawberry&v=1.11.0&f=json&u=<redacted>&p=enc%<redacted> HTTP/1.0" 200 623
Jan 20 04:10:46 host lms[25291]: <IP> - - [2020-Jan-20 04:10:46.250] "GET /rest/getAlbumList2.view?type=alphabeticalByName&offset=2&c=Strawberry&v=1.11.0&f=json&u=<redacted>&p=enc%<redacted> HTTP/1.0" 200 97
Jan 20 04:10:46 host lms[25291]: [2020-Jan-20 04:10:46.364] 25291 - [error] - [API_SUBSONIC] Error while processing request 'getAlbum', params = [{c=Strawberry}, {f=json}, {id=0}, {p=*SENSIBLE DATA*}, {u=<redacted>}, {v=1.11.0}, ], code = 0, msg = 'Parameter 'id': bad format'
Jan 20 04:10:46 host lms[25291]: <IP> - - [2020-Jan-20 04:10:46.366] "GET /rest/getAlbum.view?id=0&c=Strawberry&v=1.11.0&f=json&u=<redacted>&p=enc%<redacted> HTTP/1.0" 200 157

Not sure where this 0 comes from, album ids are definitely not zeroes:

{
    "subsonic-response" : {
        "albumList2" : {
            "album" : [
                {
                    "artist" : "<>",
                    "artistId" : "ar-348",
                    "coverArt" : "al-718",
                    "duration" : "<>",
                    "genre" : "<>",
                    "id" : "al-718",
                    "name" : "<>",
                    "songCount" : "9",
                    "year" : "<>"
                },
                ...
            ]
        },
        "status" : "ok",
        "version" : "1.12.0"
    }
}

I've noticed that in my Airsonic output and Subsonic example id fields are different from coverArt and lack the al- prefix. Also artistId contains just no ar- prefix:

{
   "subsonic-response" : {
      "status" : "ok",
      "version" : "1.15.0",
      "albumList2" : {
         "album" : [ {
            "id" : "542",
            "name" : "<>",
            "artist" : "<>",
            "artistId" : "148",
            "coverArt" : "al-542",
            "songCount" : 5,
            "duration" : 2034,
            "created" : "<>",
            "year" : <>,
            "genre" : "<>"
         },
         ...
         } ]
      }
   }
}

My wild guess is that apps like Strawberry just handle id field as a number and get 0 when trying to parse ids with letters from LMS. If that's the case, maybe it's better to change id and artistId format on LMS side to provide better compatibility?

I'm running LMS 3.2.0, Strawberry 0.6.8 and Airsonic 10.5.0.

epoupon commented 4 years ago

Hello, Thanks for reporting this! Regarding to the schema of the subsonic api documentation, albumId is supposed to be a string. LMS uses the "al-" prefix to make disambiguation on the getCover command. I guess your proposal should work. However, it seemed to work fime with Clementine the last time I used it, I will make some further tests.

bytepossum commented 4 years ago

Indeed, Clementine works fine but Strawberry Subsonic interface seems to be heavily modified. Unfortunately I have playback issues with Clementine and the project seems to be semi-abandoned.

A quick glance through the code gives this for Strawberry:

qint64 artist_id = 0;

And this for Clementine:

QString id = reader.attributes().value("id").toString();

I've found this document where all id items have xs:string type. Is that the best reference to present if I file a bug to Strawberry?

epoupon commented 4 years ago

Oh, you already performed the code investigation, thanks! You are right, it should be stored in a string as it is done in Clementine (and likely in all other players I have tested). It is definitely more an issue for the Strawberry team. I think the xsd file is the reference to be trusted.

bytepossum commented 4 years ago

I've filed an issue for Strawberry.