jellyfin / mopidy-jellyfin

Jellyfin Extension for Mopidy
https://jellyfin.org
Apache License 2.0
93 stars 16 forks source link

Don't crash if a reporting session isn't found #64

Closed mcarlton00 closed 4 years ago

mcarlton00 commented 4 years ago

better error handling so the application doesn't crash if playback reporting fails.

Fixes

INFO     2020-07-02 10:47:57,171 [391178:Thread-9] mopidy_jellyfin.http
  Jellyfin connection on try 0 with problem: Expecting value: line 1 column 1 (char 0)
ERROR    2020-07-02 10:48:22,352 [391178:MainThread] mopidy.audio.gst
  GStreamer error: Internal data stream error.
INFO     2020-07-02 10:53:34,987 [391178:Thread-9] mopidy_jellyfin.http
  Error parsing Jellyfin data: Expecting value: line 1 column 1 (char 0)
Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/matt/Projects/jellyfin/mopidy-jellyfin/mopidy_jellyfin/frontend.py", line 238, in _check_status
    self._update_playback()
  File "/home/matt/Projects/jellyfin/mopidy-jellyfin/mopidy_jellyfin/frontend.py", line 105, in _update_playback
    data = self._create_progress_payload()
  File "/home/matt/Projects/jellyfin/mopidy-jellyfin/mopidy_jellyfin/frontend.py", line 117, in _create_progress_payload
    session_id = self._get_session_id()
  File "/home/matt/Projects/jellyfin/mopidy-jellyfin/mopidy_jellyfin/frontend.py", line 62, in _get_session_id
    session_id = sessions[0].get('Id')
KeyError: 0
sonarcloud[bot] commented 4 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication