diff --git a/code/piplayer3.py b/code/piplayer3.py index 18b1eca..12b26fc 100644 --- a/code/piplayer3.py +++ b/code/piplayer3.py @@ -69,9 +69,8 @@ def call(method, params=None): try: response = requests.post(MOPIDY_RPC_URL, data=json, timeout=REQUEST_TIMEOUT) logging.info('Response: ' + response.text) - except Exception as ex: - logging.error('Exeption during request') - logging.error(ex.output) + except requests.exceptions.Timeout: + logging.error('The request timed out') return response @@ -174,7 +173,7 @@ try: response = requests.post(MOPIDY_RPC_URL, data='{"jsonrpc": "2.0", "id": 1, "method": "core.tracklist.clear"}', timeout=REQUEST_TIMEOUT) except: logging.debug("Timeout while connecting to the server") - time.sleep(1) + time.sleep(5) continue play_sound(SOUND_OK)