diff --git a/jellyfin_kodi/objects/actions.py b/jellyfin_kodi/objects/actions.py index ff312ca5..4ebfb671 100644 --- a/jellyfin_kodi/objects/actions.py +++ b/jellyfin_kodi/objects/actions.py @@ -61,44 +61,22 @@ class Actions(object): def play(self, item, db_id=None, transcode=False, playlist=False): - ''' Play item based on if playback started from widget ot not. - To get everything to work together, play the first item in the stack with setResolvedUrl, - add the rest to the regular playlist. + ''' Play requested item ''' listitem = xbmcgui.ListItem() LOG.info("[ play/%s ] %s", item['Id'], item['Name']) transcode = transcode or settings('playFromTranscode.bool') - kodi_playlist = self.get_playlist(item) play = playutils.PlayUtils(item, transcode, self.server_id, self.server, self.api_client) source = play.select_source(play.get_sources()) play.set_external_subs(source, listitem) self.set_playlist(item, listitem, db_id, transcode) - index = max(kodi_playlist.getposition(), 0) + 1 # Can return -1 - force_play = False self.stack[0][1].setPath(self.stack[0][0]) - try: - if not playlist and self.detect_widgets(item): - LOG.info(" [ play/widget ]") - - raise IndexError + if len(sys.argv) > 1: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, self.stack[0][1]) - self.stack.pop(0) - except IndexError: - force_play = True - - for stack in self.stack: - - kodi_playlist.add(url=stack[0], listitem=stack[1], index=index) - index += 1 - - if force_play: - if len(sys.argv) > 1: - xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, self.stack[0][1]) - xbmc.Player().play(kodi_playlist, windowed=False) def set_playlist(self, item, listitem, db_id=None, transcode=False): @@ -714,21 +692,6 @@ class Actions(object): return True - def detect_widgets(self, item): - - kodi_version = xbmc.getInfoLabel('System.BuildVersion') - - if kodi_version and "Git:" in kodi_version and kodi_version.split('Git:')[1].split("-")[0] in ('20171119', 'a9a7a20'): - LOG.info("Build does not require workaround for widgets?") - - return False - - if (not xbmc.getCondVisibility('Window.IsMedia') and ((item['Type'] == 'Audio' and not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(music),1)')) or not xbmc.getCondVisibility('Integer.IsGreater(Playlist.Length(video),1)'))): - - return True - - return False - class PlaylistWorker(threading.Thread):