Navidrome: Music Folder IDs are strings in JSON

Created on 9 May 2020  路  3Comments  路  Source: deluan/navidrome

Thanks for your work in creating navidrome, it's very usable and efficient!

While working on an API client, I discovered an incompatibility between Navidrome's Subsonic API implementation and the officially documented one in JSON mode- IDs of numerically addressed items (specifically MusicFolders) are returned as json strings rather than integers. Here's a response sample from Navidrome's latest release:

{
  "subsonic-response": {
    "status": "ok",
    "version": "1.10.2",
    "type": "navidrome",
    "serverVersion": "0.17.0 (13ce218)",
    "musicFolders": {
      "musicFolder": [
        {
          "id": "0",
          "name": "Music Library"
        }
      ]
    }
  }
}

and the Subsonic demo server's response:

{
   "subsonic-response" : {
      "status" : "ok",
      "version" : "1.16.1",
      "musicFolders" : {
         "musicFolder" : [ {
            "id" : 0,
            "name" : "Music"
         } ]
      }
   }
}

The XML API formats are equivalent, this is only a difference in the JSON format. This makes it difficult for my golang client to consistently unmarshal the value between different server implementations.

Most helpful comment

@deluan yes! I'm working on a command-line Subsonic client because there are no good ones available and it could be easily cross-platform in Go. Right now I'm making a Subsonic client library, and I'm cross-testing it with a number of different server implementations. The code is still pretty rough so it's in a private repo- I'll let you know when the library & client are ready for others' eyes :smile:

All 3 comments

The same behavior is present on the getIndexes endpoint's lastModified property- here's Navidrome:

$ navicurl getIndexes | jq '."subsonic-response".indexes.lastModified'
"1589043648480"

and the demo server:

$ curl -s 'http://demo.subsonic.org/rest/getIndexes?u=guest5&p=guest&f=json&c=curling&v=1.8.0' | jq '."subsonic-response".indexes.lastModified'
1589060024525

Yeah, you are right. I'll fix these tonight. Thanks for reporting it.

By the way, are you working in a GoLang Subsonic client? Great! Is it open source? Will it be a desktop client? If you are making it public, I'd love to be a tester :)

@deluan yes! I'm working on a command-line Subsonic client because there are no good ones available and it could be easily cross-platform in Go. Right now I'm making a Subsonic client library, and I'm cross-testing it with a number of different server implementations. The code is still pretty rough so it's in a private repo- I'll let you know when the library & client are ready for others' eyes :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheForcer picture TheForcer  路  5Comments

ElleshaHackett picture ElleshaHackett  路  6Comments

ericgaspar picture ericgaspar  路  4Comments

yarg-kane picture yarg-kane  路  5Comments

axllent picture axllent  路  8Comments