Skip to content

Commit

Permalink
Merge pull request #477 from anxdpanic/pr-1
Browse files Browse the repository at this point in the history
Failed playback fixups
  • Loading branch information
anxdpanic authored Jan 22, 2020
2 parents 94dbcfe + c4de7d4 commit 77be31b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
<extension point='xbmc.addon.metadata'>
<platform>all</platform>
<news>
[fix] resolve indefinite busy dialog on failed playback
[fix] sort by viewers for followed live channels, restoring previous behavior
[fix] menu settings not taking effect
[fix] handle no stream available error
[rem] remove Playlists
</news>
<assets>
Expand Down
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
2.4.8
[fix] resolve indefinite busy dialog on failed playback
[fix] sort by viewers for followed live channels, restoring previous behavior
[fix] menu settings not taking effect
[fix] handle no stream available error
[rem] remove Playlists

2.4.7
Expand Down
9 changes: 7 additions & 2 deletions resources/lib/twitch_addon/addon/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .common import kodi, log_utils
from .constants import Keys, SCOPES
from .error_handling import api_error_handler
from .twitch_exceptions import TwitchException
from .twitch_exceptions import PlaybackFailed, TwitchException

from twitch import queries as twitch_queries
from twitch import oauth
Expand Down Expand Up @@ -368,7 +368,12 @@ def get_user_blocks(self):

@staticmethod
def error_check(results):
if 'error' in results: raise TwitchException(results)
if 'stream' in results and results['stream'] is None:
raise PlaybackFailed()

if 'error' in results:
raise TwitchException(results)

return results

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions resources/lib/twitch_addon/addon/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def wrapper(*args, **kwargs):
message = error.message
log_utils.log('Playback Failed |{0}|'.format(message), log_utils.LOGDEBUG)
kodi.notify(kodi.get_name(), i18n('playback_failed'), duration=5000, sound=False)
kodi.set_resolved_url(kodi.ListItem(), succeeded=False)
except TwitchException as error:
_error = ''
if PY3:
Expand Down
2 changes: 2 additions & 0 deletions resources/lib/twitch_addon/routes/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ def _set_seek_time(value):
utils.exec_irc_script(username, name)
return
else:
kodi.set_resolved_url(kodi.ListItem(), succeeded=False)
return

raise PlaybackFailed()
except:
_reset()
Expand Down

0 comments on commit 77be31b

Please sign in to comment.