From 51c40c7435bfec12ddaa884d5a26e91d0ffe5cd6 Mon Sep 17 00:00:00 2001 From: marcelveldt Date: Mon, 14 Oct 2019 00:55:24 +0200 Subject: [PATCH] skip ssl verification --- music_assistant/homeassistant.py | 4 ++-- music_assistant/http_streamer.py | 2 +- music_assistant/metadata.py | 4 ++-- music_assistant/musicproviders/qobuz.py | 2 +- music_assistant/musicproviders/spotify.py | 2 +- music_assistant/web.py | 15 ++++++++++++--- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/music_assistant/homeassistant.py b/music_assistant/homeassistant.py index dae0feb3..3b884425 100644 --- a/music_assistant/homeassistant.py +++ b/music_assistant/homeassistant.py @@ -292,7 +292,7 @@ class HomeAssistant(): if self._use_ssl: url = "https://%s/api/%s" % (self._host, endpoint) headers = {"Authorization": "Bearer %s" % self._token, "Content-Type": "application/json"} - async with self.http_session.get(url, headers=headers) as response: + async with self.http_session.get(url, headers=headers, verify_ssl=False) as response: return await response.json() async def __post_data(self, endpoint, data): @@ -301,5 +301,5 @@ class HomeAssistant(): if self._use_ssl: url = "https://%s/api/%s" % (self._host, endpoint) headers = {"Authorization": "Bearer %s" % self._token, "Content-Type": "application/json"} - async with self.http_session.post(url, headers=headers, json=data) as response: + async with self.http_session.post(url, headers=headers, json=data, verify_ssl=False) as response: return await response.json() \ No newline at end of file diff --git a/music_assistant/http_streamer.py b/music_assistant/http_streamer.py index 966eb207..5335cec5 100755 --- a/music_assistant/http_streamer.py +++ b/music_assistant/http_streamer.py @@ -387,7 +387,7 @@ class HTTPStreamer(): LOGGER.debug('Start analyzing track %s' % item_key) if streamdetails['type'] == 'url': async with aiohttp.ClientSession() as session: - async with session.get(streamdetails["path"]) as resp: + async with session.get(streamdetails["path"], verify_ssl=False) as resp: audio_data = await resp.read() elif streamdetails['type'] == 'executable': process = await asyncio.create_subprocess_shell(streamdetails["path"], diff --git a/music_assistant/metadata.py b/music_assistant/metadata.py index 6863f9f7..103c73df 100755 --- a/music_assistant/metadata.py +++ b/music_assistant/metadata.py @@ -127,7 +127,7 @@ class MusicBrainz(): headers = {'User-Agent': 'Music Assistant/1.0.0 https://github.com/marcelveldt'} params['fmt'] = 'json' async with self.throttler: - async with self.http_session.get(url, headers=headers, params=params) as response: + async with self.http_session.get(url, headers=headers, params=params, verify_ssl=False) as response: try: result = await response.json() except Exception as exc: @@ -177,7 +177,7 @@ class FanartTv(): url = 'http://webservice.fanart.tv/v3/%s' % endpoint params['api_key'] = '639191cb0774661597f28a47e7e2bad5' async with self.throttler: - async with self.http_session.get(url, params=params) as response: + async with self.http_session.get(url, params=params, verify_ssl=False) as response: result = await response.json() if 'error' in result and 'limit' in result['error']: raise Exception(result['error']) diff --git a/music_assistant/musicproviders/qobuz.py b/music_assistant/musicproviders/qobuz.py index ac0448fd..085d3a32 100644 --- a/music_assistant/musicproviders/qobuz.py +++ b/music_assistant/musicproviders/qobuz.py @@ -538,7 +538,7 @@ class QobuzProvider(MusicProvider): params["user_auth_token"] = await self.__auth_token() try: async with self.throttler: - async with self.http_session.get(url, headers=headers, params=params) as response: + async with self.http_session.get(url, headers=headers, params=params, verify_ssl=False) as response: result = await response.json() if not result or 'error' in result: LOGGER.error(url) diff --git a/music_assistant/musicproviders/spotify.py b/music_assistant/musicproviders/spotify.py index c284f21d..9bc99f76 100644 --- a/music_assistant/musicproviders/spotify.py +++ b/music_assistant/musicproviders/spotify.py @@ -477,7 +477,7 @@ class SpotifyProvider(MusicProvider): token = await self.get_token() headers = {'Authorization': 'Bearer %s' % token["accessToken"]} async with self.throttler: - async with self.http_session.get(url, headers=headers, params=params) as response: + async with self.http_session.get(url, headers=headers, params=params, verify_ssl=False) as response: result = await response.json() if not result or 'error' in result: LOGGER.error(url) diff --git a/music_assistant/web.py b/music_assistant/web.py index 83bac063..d3533fdb 100755 --- a/music_assistant/web.py +++ b/music_assistant/web.py @@ -341,13 +341,22 @@ class Web(): only support for basic commands ''' data = await request.json() - LOGGER.info("jsonrpc: %s" % data) + LOGGER.debug("jsonrpc: %s" % data) params = data['params'] player_id = params[0] cmds = params[1] cmd_str = " ".join(cmds) - if cmd_str in ['play', 'pause', 'stop']: - await self.mass.player.player_command(player_id, cmd_str) + player = await self.mass.player.get_player(player_id) + if cmd_str == 'play': + await player.play() + elif cmd_str == 'pause': + await player.pause() + elif cmd_str == 'stop': + await player.stop() + elif cmd_str == 'next': + await player.next() + elif cmd_str == 'previous': + await player.previous() elif 'power' in cmd_str: args = cmds[1] if len(cmds) > 1 else None await self.mass.player.player_command(player_id, cmd_str, args) -- 2.34.1