Tyzer34 / plexMusicPlayer

Playback music with Alexa from your Plex Server!
https://medium.com/@Tyzer34/plex-alexa-the-perfect-wedding-38b14b41faf0#.b71cd6lsn
GNU General Public License v3.0
35 stars 19 forks source link

Perform searches using local URL if environment variable is set - #13 #19

Closed jamesshaw1987 closed 7 years ago

Tyzer34 commented 7 years ago

Thanks for the adjustment in the Readme file as well! Looks good, but I'm wondering why you changed the getStreamUrl method? As it is written now, if you only use the Global URL, it will be ok. However, when you would be using the Local URL, the base_url will be replaced, but as the getStreamUrl uses the _stream_baseurl variable, it will still call upon the Global URL. Could this be the case?

jamesshaw1987 commented 7 years ago

Yeah, so if the _PLEX_LOCALURL environment variable is set, _baseurl will be set to that value. And if getStreamUrl() then just uses _baseurl it will attempt to fetch the media streams from the local network, which will fail because the request is made by the Alexa servers.

_stream_baseurl is always set to the value of _PLEXURL, so will always be the publicly available URL. Which means getStreamUrl() can safely use that variable, knowing it will always provide a publicly available stream URL.

Tyzer34 commented 7 years ago

AH yes, I forgot that Alexa needed an external URL to be able to cope with music playback. Thanks!