tsquillario/Jamstash

Search doesn't work in MusicCabinet

Closed this issue · 7 comments

I'm using latest stable Google Chrome, MusicCabinet and Jamstash.com, mostly for playing random playlists. Noticed search doesn't work at all, just throbber loading forever.

Search

I also can't get to the artist view when clicking an artist in A-Z view.

Chrome dev tools console:

scripts.min.91b918f8.js:2 k$$asyncQueue: Array[0]$$childHead: null$$childTail: null$$destroyed: false$$isolateBindings: Object$$listenerCount: Object$$listeners: Object$$nextSibling: a.$$childScopeClass.$$childScopeClass$$phase: null$$postDigestQueue: Array[0]$$prevSibling: null$$watchers: null$id: "009"$parent: a.$$childScopeClass.$$childScopeClass$root: konEnter: function (a){return f(b,a)}this: k__proto__: k

scripts.min.91b918f8.js:2 Uncaught TypeError: Cannot read property 'index' of undefined
scripts.min.91b918f8.js:2 k$$asyncQueue: Array[0]$$childHead: null$$childTail: null$$destroyed: false$$isolateBindings: Object$$listenerCount: Object$$listeners: Object$$nextSibling: a.$$childScopeClass.$$childScopeClass$$phase: null$$postDigestQueue: Array[0]$$prevSibling: null$$watchers: null$id: "0KO"$parent: a.$$childScopeClass.$$childScopeClass$root: konEnter: function (a){return f(b,a)}this: k__proto__: k

scripts.min.91b918f8.js:2 Uncaught TypeError: Cannot read property 'index' of undefined
scripts.min.91b918f8.js:2 Uncaught TypeError: Cannot read property 'artist' of undefined

I'm guessing the JSON returned is formatted differently than Subsonic. F12 in Chrome, click the Network tab, then click things. You'll see the response, I'm curious to see what it looks like.

I'm using Mac, but you probably mean Developer Tools, which is familiar to me.

It looks like this:

Search

Here are the Request Headers (XX are actually real characters and IDs but for security reasons I'm excluding them here):

GET /rest/search2.view?u=XXXXXXXX&p=enc:XXXXXX&f=jsonp&v=1.8.0&c=Jamstash&query=XXXXXXX&callback=jQuery2030633240532130003_1429288007255&_=1429288007258 HTTP/1.1
Host: subsonic.peikko.us
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Referer: http://jamstash.com/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: player-61646d696e=44; JSESSIONID=XXXXXX

Here are the Response Headers:

HTTP/1.1 200 OK
Date: Fri, 17 Apr 2015 16:30:00 GMT
Server: Jetty(8.y.z-SNAPSHOT)
Content-Type: text/javascript;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Length: 13134
Set-Cookie: player-61646d696e=44;Path=/;Expires=Sat, 16-Apr-2016 16:30:00 GMT
Connection: close

Full response looks okay, not going to paste it here, but the last three lines are

 },
 "status": "ok",
 "version": "1.8.0",
 "xmlns": "http://subsonic.org/restapi"
}});

I've managed to create a test Music Cabinet server, @tsquillario I've sent you an email with the login info to it, as I won't have access to my dev environment next week and won't be able to fix that issue.

I wired Jamstash up with it and it's just like you suspected. Apparently, Subsonic + Music Cabinet returns a search2 object when you call search2.view, but regular Subsonic returns a searchResult2 object, which is what we expect. In v4.4.5 it fails and the spinner stays on forever and in v4.4.6 (after merging #208), it displays "No results.", so it might just be a matter of also checking the search2 object to fix the search.

Regarding the Artists matter, it seems to depend on the selected Music folder. When I choose the default "All Folders", a request to getIndexes.view, which is supposed to populate the artist list and the A-Z view, just fails with the following response :

angular.callbacks._0({"subsonic-response": {
 "error": {
  "code": 0,
  "message": -2
 },
 "status": "failed",
 "version": "1.8.0",
 "xmlns": "http://subsonic.org/restapi"
}});

Server-side, I get the following logs :

[4/17/15 7:23:13 PM UTC]    DEBUG   RESTController  genreId = -1
[4/17/15 7:23:13 PM UTC]    WARN    RESTFilter  Error in REST API: -2

Which seem to indicate that the "All Folders" is assigned a -1 id.
But when I select the Music Folder "All genres" (which must be created by Music Cabinet), it works and I do get the server's Artists as gathered by Music Cabinet. Not sure what we'll need to do about that, I expect it to be a longer fix, maybe check that we aren't going to query with an id of -1, but choosing "All Folders" should still work on regular Subsonic, so... yeah, it'll need some thought.

Maybe there are other requests failing too, I haven't really looked.

Anyway, hope I could help.

I've got a fix incoming for this issue, I'll take a couple of days to test it and then it'll ship in the next beta version (4.5.0).

This issue should be fixed on http://beta.jamstash.com, let me know how it is on your side and we can close it.

Thanks! I'll let you know.

Hello. Confirmed working in beta, thanks!

Minor improvement suggestion: Song / Album / Artist option could be selected in default (Song for example) instead of empty selection.