Closed tdelesio closed 7 years ago
Hi! Thank you first of all for your interest in this project! Firstly, I would like to point out, that you'd better exclude your Plex token from your post (found at the last part of the error stack). The error is produced because the PLEX_URL env variable isn't set correctly. You used dots for the ip address up front, but it should actually be '-' in between, leading to this Plex URL: https://68-84-99-171.ee51a749bffb4ba6a60b868cba10a375.plex.direct:32400 As for your other questions:
Thanks for the feedback. I removed my token. After I asked the question and went back and looked at the code. I saw in the code how it just streams to the device. I guess in theory I could then connect the echo back to my receiver as a bluetooth device. My ultimate goal is to be able to tell alexa to play my music so that it plays off my receiver. I made the change you suggested and changed the ip address from . to - and the error went away but it seams to have generated a new error.
[2017-01-04 19:24:45,351] ERROR in app: Exception on /plex [POST] 2017-01-04T19:24:45.355352+00:00 app[web.1]: Traceback (most recent call last): 2017-01-04T19:24:45.355354+00:00 app[web.1]: response = self.full_dispatch_request() 2017-01-04T19:24:45.355353+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app 2017-01-04T19:24:45.355355+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request 2017-01-04T19:24:45.355355+00:00 app[web.1]: rv = self.handle_user_exception(e) 2017-01-04T19:24:45.355356+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception 2017-01-04T19:24:45.355357+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2017-01-04T19:24:45.355357+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise 2017-01-04T19:24:45.355358+00:00 app[web.1]: raise value 2017-01-04T19:24:45.355359+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request 2017-01-04T19:24:45.355359+00:00 app[web.1]: rv = self.dispatch_request() 2017-01-04T19:24:45.355361+00:00 app[web.1]: return self.view_functionsrule.endpoint 2017-01-04T19:24:45.355360+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request 2017-01-04T19:24:45.355361+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask_ask/core.py", line 516, in _flask_view_func 2017-01-04T19:24:45.355362+00:00 app[web.1]: result = self._map_intent_to_view_func(self.request.intent)() 2017-01-04T19:24:45.355362+00:00 app[web.1]: File "/app/plexmusicplayer/intents/plex_intents.py", line 26, in playArtist 2017-01-04T19:24:45.355363+00:00 app[web.1]: speech, playlist = methods.processQuery(artist, MediaType.Artist) 2017-01-04T19:24:45.355365+00:00 app[web.1]: File "/app/plexmusicplayer/methods.py", line 56, in parseArtistJson 2017-01-04T19:24:45.355364+00:00 app[web.1]: File "/app/plexmusicplayer/methods.py", line 91, in processQuery 2017-01-04T19:24:45.355364+00:00 app[web.1]: artist, server, playlist = parseArtistJson(json_obj) 2017-01-04T19:24:45.355365+00:00 app[web.1]: artist = json_obj['MediaContainer']['Directory']['@title'] 2017-01-04T19:24:45.355372+00:00 app[web.1]: KeyError: 'Directory' 2017-01-04T19:24:45.362227+00:00 heroku[router]: at=info method=POST path="/plex" host=alexaplexmusic.herokuapp.com request_id=fcc4a663-0197-4e01-8a36-d825b99d58d5 fwd="72.21.217.112" dyno=web.1 connect=1ms service=395ms status=500 bytes=456
If you connect to a bluetooth receiver via the Echo, it is possible to have your Plex music playback on that receiver!
The error generated comes from the fact that the requested Artist (as litterary written by Alexa Voice Services) could not be found on your Plex device. Yesterday, I added a fix so that this error is caught and an appropriate response is given back. You should thus update your Heroku server with the latest version of PlexMusicPlayer. To do this, open a terminal (or command prompt), navigate to the folder where you have cloned this Git repository from and execute the following commands:
git pull
git push heroku master
git pull should update your local copy to the latest version, while git push heroku master updates the copy on your deployed Heroku server.
I figured that out after playing around with a couple more artists. I got it to work both on my echo and got my echo to play through the receiver. I just updated the code base. This is very cool as it now works. Now I need to write something to switch the inputs on my receiver. Thank you for your help.
Happy to help! Good luck!
First of all, this has been exactly what I've been looking to to. I want to be able to put on music using my echo. I saw this and was very excited to see that this application solves the problem. I tried to deploy the application to heroku (which I've never used before) and got it up and running. When I interact with the echo however, it times out. I was testing using hte service simulator on developer.amazon.com as well. A couple of questions first before I post the error:
Now the error: I asked alexa: "ask plex to play counting stars" via the developer.amazon.com service simulator.
heroku logs: Traceback (most recent call last): 2017-01-03T17:26:17.499331+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app 2017-01-03T17:26:17.499332+00:00 app[web.1]: response = self.full_dispatch_request() 2017-01-03T17:26:17.499332+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request 2017-01-03T17:26:17.499333+00:00 app[web.1]: rv = self.handle_user_exception(e) 2017-01-03T17:26:17.499334+00:00 app[web.1]: reraise(exc_type, exc_value, tb) 2017-01-03T17:26:17.499334+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception 2017-01-03T17:26:17.499335+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise 2017-01-03T17:26:17.499336+00:00 app[web.1]: raise value 2017-01-03T17:26:17.499336+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request 2017-01-03T17:26:17.499338+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request 2017-01-03T17:26:17.499339+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/flask_ask/core.py", line 516, in _flask_view_func 2017-01-03T17:26:17.499339+00:00 app[web.1]: result = self._map_intent_to_view_func(self.request.intent)() 2017-01-03T17:26:17.499337+00:00 app[web.1]: rv = self.dispatch_request() 2017-01-03T17:26:17.499338+00:00 app[web.1]: return self.view_functionsrule.endpoint 2017-01-03T17:26:17.499345+00:00 app[web.1]: speech, playlist = methods.processQuery(artist, MediaType.Artist) 2017-01-03T17:26:17.499340+00:00 app[web.1]: File "/app/plexmusicplayer/intents/plex_intents.py", line 26, in playArtist 2017-01-03T17:26:17.499346+00:00 app[web.1]: File "/app/plexmusicplayer/methods.py", line 80, in processQuery 2017-01-03T17:26:17.499346+00:00 app[web.1]: json_obj = getJsonFromPlex(searchQueryUrl) 2017-01-03T17:26:17.499347+00:00 app[web.1]: File "/app/plexmusicplayer/methods.py", line 23, in getJsonFromPlex 2017-01-03T17:26:17.499348+00:00 app[web.1]: response = requests.get(url) 2017-01-03T17:26:17.499348+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/requests/api.py", line 70, in get 2017-01-03T17:26:17.499349+00:00 app[web.1]: return request('get', url, params=params, kwargs) 2017-01-03T17:26:17.499349+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/requests/api.py", line 56, in request 2017-01-03T17:26:17.499350+00:00 app[web.1]: return session.request(method=method, url=url, kwargs) 2017-01-03T17:26:17.499351+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/requests/sessions.py", line 488, in request 2017-01-03T17:26:17.499351+00:00 app[web.1]: resp = self.send(prep, send_kwargs) 2017-01-03T17:26:17.499352+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/requests/sessions.py", line 609, in send 2017-01-03T17:26:17.499353+00:00 app[web.1]: r = adapter.send(request, kwargs) 2017-01-03T17:26:17.499353+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.5/site-packages/requests/adapters.py", line 487, in send 2017-01-03T17:26:17.499354+00:00 app[web.1]: raise ConnectionError(e, request=request) 2017-01-03T17:26:17.499355+00:00 app[web.1]: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='68.84.99.171.ee51a749bffb4ba6a60b868cba10a375.plex.direct', port=32400): Max retries exceeded with url: /search?query=counting%20stars&X-Plex-Token=&type=8 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5d1b42fba8>: Failed to establish a new connection: [Errno -5] No address associated with hostname',))
2017-01-03T17:26:17.524319+00:00 heroku[router]: at=info method=POST path="/plex" host=alexaplexmusic.herokuapp.com request_id=d1abdda2-2a76-4e19-8fd5-075c7e3b5f9c fwd="72.21.217.104" dyno=web.1 connect=2ms service=179ms status=500 bytes=456
I'm not sure what that fwd ip is as that is not my external ip that is listed. Any idea?