happyleavesaoc / python-firetv

MIT License
184 stars 37 forks source link

start shows 200 success but nothing happens on device #10

Closed arraylabs closed 7 years ago

arraylabs commented 8 years ago

latest master, using the start endpoint gives a 200 success message but the app doesn't start. The stop command works.

juliangeiges commented 8 years ago

Which app do you try to start? I tried it with Kodi and Chrome and it worked. Perhaps your app has no splash intend?

arraylabs commented 8 years ago

Tried Netflix and mlbtv. Neither opened or showed in the running endpoint. Will try with kodi.

juliangeiges commented 8 years ago

Ok, it should work with Kodi but i will check Netflix tomorrow. I think is has something to do with a wrong intent. I think i have to fix a few lines....

juliangeiges commented 8 years ago

Hey, i found the problem with Netflix. It`s main activity is named different than kodi: com.netflix.ninja/.MainActivity

I will now try to implement a function which searches for correct starting activity with given package.

arraylabs commented 8 years ago

Great, will give it a shot once it gets merged (think thats the term, I'm kinda terrible with git).

arraylabs commented 8 years ago

All, netflix works properly now. Also tried playstation vue and it works great at well. Any thoughts on why SPMC might not work? I actually get a forbidden message when trying to start SPMC via the endpoint.

FYI, between home assistant and my echo & dot I can start apps directly by voice (i use a harmony smart hub and not the firetv remote plus i don't have to press and hold the voice button)!!

juliangeiges commented 8 years ago

Try XBMC ;) it works well :) I'dont know why SBMC doesn't work. I don't have that app on any of my fire Tv's so I can't test it at the moment. What kind of forbidden message do you get? Are you shute that you used the correct package name?

juliangeiges commented 8 years ago

Try XBMC ;) it works well :) I'dont know why SBMC doesn't work. I don't have that app on any of my fire Tv's so I can't test it at the moment. What kind of forbidden message do you get? Are you shute that you used the correct package name?

arraylabs commented 8 years ago

@juliangeiges i get a 403 forbidden "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server." Using "com.semperpax.spmc16" as app name, this is how its listed on the running endpoint.

juliangeiges commented 8 years ago

did you tried it with: com.semperpax.spmc?

arraylabs commented 8 years ago

@juliangeiges Yes i did try that but that gives a 500 server error and errors on the server console, specifically:

File "/usr/local/lib/python2.7/dist-packages/firetv/__init__.py", line 175, in launch_app mainActivity = self._mainActivity(app) File "/usr/local/lib/python2.7/dist-packages/firetv/__init__.py", line 277, in _mainActivity return self._adb.Shell(('pm dump {0} | grep -A 1 "MAIN" | grep {0}').format(app)).strip().split(" ")[1] IndexError: list index out of range

iantrich commented 8 years ago

I'm getting 404 Not Found when trying to start an application, but no problems when getting the state of an application. Any pointers?

curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:5556/devices/Basement/apps/state/com.netflix.ninja
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 22
Server: Werkzeug/0.11.11 Python/2.7.9
Date: Tue, 25 Oct 2016 03:05:26 GMT

{
  "status": "off"
}
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:5556/devices/Basement/apps/com.netflix.ninja/start
HTTP/1.0 404 NOT FOUND
Content-Type: text/html
Content-Length: 233
Server: Werkzeug/0.11.11 Python/2.7.9
Date: Tue, 25 Oct 2016 03:05:37 GMT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>
arraylabs commented 8 years ago

@juliangeiges found the issue, its the regex in main.py and the "16" in the app name. Changing it to "valid_app_id = re.compile('^[A-Za-z0-9.]+$')" seems to allow it to work.

juliangeiges commented 8 years ago

@arraylabs nice :) I never looked at this method as it was already given. Do you want to make the pr or should I?

arraylabs commented 8 years ago

@juliangeiges if you don't mind doing it that would be great, I'm just starting to learn git and github and am still a bit confused on how everything works. Could probably figure it out but don't want to mess anything up and cause issues for you or happyleaves.

juliangeiges commented 8 years ago

@arraylabs Ok, i will do that as soon i have time. Nevertheless don`t be shy... github is learning by doing :)