mazkolain-zz / spotimc

GNU General Public License v3.0
302 stars 42 forks source link

Failed: HTTP response code said error(22) #170

Open ghost opened 7 years ago

ghost commented 7 years ago

Running the latest OpenElec, I cannot use the app anymore. When I start a song it erorrs.

Linux datKassie 4.9.21 #1 SMP Fri Apr 14 21:26:30 CEST 2017 armv7l GNU/Linux RPi 2

Latest (beta5) from SuperRepo

21:21:42.627 T:1947152400   ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.697 T:1947152400   ERROR: Previous line repeats 1 times.
21:21:42.697 T:1947152400   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
21:21:42.697 T:1947152400   ERROR: CCurlFile::Open failed with code 403 for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.711 T:1947152400   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
21:21:42.711 T:1947152400   ERROR: CCurlFile::Open failed with code 403 for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.712 T:1947152400   ERROR: Open - failed to open source <http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29>
21:21:42.712 T:1947152400   ERROR: Init: Error opening file http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.736 T:1947152400   ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.750 T:1947152400   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
21:21:42.750 T:1947152400   ERROR: CCurlFile::Open failed with code 403 for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.764 T:1947152400   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403
21:21:42.764 T:1947152400   ERROR: CCurlFile::Open failed with code 403 for http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.764 T:1947152400   ERROR: Open - failed to open source <http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29>
21:21:42.765 T:1947152400   ERROR: Init: Error opening file http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.765 T:1947152400   ERROR: CAudioDecoder: Unable to Init Codec while loading file http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29
21:21:42.765 T:1947152400 WARNING: PAPlayer::QueueNextFileEx - Failed to create the decoder
21:21:42.766 T:1947152400   ERROR: Playlist Player: skipping unplayable item: 0, path [http://127.0.0.1:8081/track/3ZFwFe104aquLWAwagKgtg.wav?idx=0|X-Spotify-Token=d9b96e8f48b83d7654b9bbd50cc3715fc62a9f4f&User-Agent=Spotimc%2F1.0-beta5+%28XBMC%2F17.1+Git%3A39e9963%29]
21:21:47.163 T:1594962848   ERROR: 19:21:47.162 E [ap:4210] ChannelError(0, 1, playlist)
21:22:27.296 T:1594962848   ERROR: 19:22:27.295 E [ap:4210] ChannelError(0, 1, playlist)
21:22:32.375 T:1594962848   ERROR: 19:22:32.374 E [ap:4210] ChannelError(0, 1, playlist)
21:22:49.576 T:1594962848   ERROR: 19:22:49.575 E [ap:4210] ChannelError(0, 1, playlist)
21:22:49.649 T:1594962848   ERROR: 19:22:49.648 E [ap:4210] ChannelError(0, 1, playlist)
21:22:59.726 T:1594962848   ERROR: 19:22:59.725 E [ap:4210] ChannelError(0, 1, playlist)
21:23:09.763 T:1594962848   ERROR: 19:23:09.762 E [ap:4210] ChannelError(0, 1, playlist)
21:23:19.292 T:1594962848   ERROR: 19:23:19.291 E [ap:4210] ChannelError(1, 1, playlist)
21:23:20.526 T:1594962848   ERROR: 19:23:20.525 E [ap:4210] ChannelError(0, 1, playlist)
Patafke commented 7 years ago

I have the same problem here, same conditions. Did you notice that it fails while tying to fetch something on localhost?

ghost commented 7 years ago

yes, probably there should be some service running, it also needs a reboot so I assume this is installed as a daemon, or not, in our case

Patafke commented 7 years ago

Yeahr cloud be. I reinstalled and rebooted it many times and nothing changes there. Sounds a bit like broken installation. Do you use Kodi 17.1 too?

ghost commented 7 years ago

Openelec 8 so that is Kodi 17.1

mazkolain-zz commented 7 years ago

Hi, Spotimc runs an embeded http server, which publishes track streams as wave files. This streams are protected by some basic token mechanism, which doesn't seem to work on the latest Kodi (haven't checked myself, just figuring this out from the 403 status codes). Will check the next week, seems that this can be fairly easy to solve (or at least disable the token mechanism in the meantime).

Patafke commented 7 years ago

Hi, that would be really great. Thank you ;)

Steve19802 commented 7 years ago

Hi, Since i'm not familiar with kodi's addons framework I could only deactivate the token based auth that is implemented in the proxy. For some reason the 'X-Spotify-Token' header attribute is missing in the request. Therefore, the function _check_request in the file resources/libs/pyspotify-ctypes-proxy/src/spotifyproxy/httpproxy.py returns a 403 error code.

In order to overcome this problem until the author fix the root cause, it's necessary to comment some lines of the _check_request function. My patched function looks like this:

def _check_request(self):
        method = cherrypy.request.method.upper()
        headers = cherrypy.request.headers

        #Fail for other methods than get or head
        if method not in ("GET", "HEAD"):
            raise cherrypy.HTTPError(405)

        #Error if no token or user agent are provided
        # -- Steve19802: Start --
        #if 'User-Agent' not in headers or 'X-Spotify-Token' not in headers:
        #    raise cherrypy.HTTPError(403)
        # -- Steve19802: End --
        #Error if the requester is not allowed
        if headers['Remote-Addr'] not in self.__allowed_ips:
            raise cherrypy.HTTPError(403)

        #Check that the supplied token is correct
        # -- Steve19802: Start --
        #user_token = headers['X-Spotify-Token']
        #user_agent = headers['User-Agent']
        #correct_token = create_user_token(self.__base_token, user_agent)
        #if user_token != correct_token:
        #    raise cherrypy.HTTPError(403)
        # -- Steve19802: End --
        return method