hellhand / SabdroidEx

SABDroidEx is a frontend for sabnzbd+, Sickbeard and Couchpotato on Android. It is used to monitor your servers and to interact with them in the most complete and intuitive way.
http://hellhand.github.io/SabdroidEx
8 stars 3 forks source link

broken for cp #5

Closed SamJongenelen closed 10 years ago

SamJongenelen commented 10 years ago

Should latest apk from Google play be working on couch potato server v2 (latest x86 Linux as of December 2013)?

I can't seem to get it to work..

hellhand commented 10 years ago

Hi, It should still work, did you close this issue as you were able to get it to work or anything else ?

SamJongenelen commented 10 years ago

Hey, I indeed accidentally closed the issue on my mobile phone.

I'm running CP server 'v2' (build 1 dec 2013) on an OPENELEC machine and this CP has the 'standard' form authentication instead of the 'old' 401 challenge..

I've filled out SabdroidEx without 'Server URI extension' (because it hasn't got it, url is plain http://address:8083) SB and SabNzb connections are doing fine, only the 'movies' tab stays empty and i can't find any logs (not on CP nor your client).

I'm downloading Eclipse again and your project to check why :)

SamJongenelen commented 10 years ago

Okay, i got some logcat:

12-14 14:43:18.284: D/com.sabdroidex.controllers.couchpotato.CouchPotatoController(5438): http://address.no-ip.biz:8083/api//movie.list/?status= 12-14 14:43:18.324: D/com.sabdroidex.controllers.couchpotato.CouchPotatoController(5438): http://address.no-ip.biz:8083/api//profile.list/ 12-14 14:43:18.384: W/com.sabdroidex.controllers.couchpotato.CouchPotatoController(5438): Value <!doctype of type java.lang.String cannot be converted to JSONObject 12-14 14:43:18.434: W/com.sabdroidex.controllers.couchpotato.CouchPotatoController(5438): Value <!doctype of type java.lang.String cannot be converted to JSONObject 12-14 14:43:18.484: W/com.sabdroidex.controllers.couchpotato.CouchPotatoController(5438): Value <!doctype of type java.lang.String cannot be converted to JSONObject

I'm guessing this is because the API key is missing when the JSON object is requested (sabdroidex doesn't have an input field for CP API key..?)

If I enrich the URL wit the API key (between the 2 slashes /) the URL works.

http://address.no-ip.biz:8083/api/%APIKEYHERE%/movie.list/?status=

So, basically; if you add and input box for CP API key and put the variable into the URL when requesting, it works :)

Unfortunately i don't have experience in GIT + android SDK so i can't really make the change :(

SamJongenelen commented 10 years ago

Okay so im trying to understand Java here (coming from c# it shouldnt be that hard) and my understanding now is that you request the API key from the CP server by querying it using the credentials.

However, the result of the getApiKey() method is 'failed' so the API key will stay NULL :')

hellhand commented 10 years ago

Ok, thanks for the tech feedback.

Yes it seems it does not retrieve the key as it used to, they probably changed their API/approach, which is much better now (well in my opinion). And yes Java and C# are pretty similar in some ways.

I'll add a settings field for Couch's API key.

hellhand commented 10 years ago

Strangely they still mention :

Get the API key:
/getkey/?p=md5(password)&u=md5(username)
Will return {"api_key": "XXXXXXXXXX", "success": true}. 
When username or password is empty you don't need to md5 it. 

In their doc ...