def onAction(self, action): try: action_id = action.getId( ) # change to just "action" as the ID is already returned in that. if action_id in self.info_actions: chosen_source = self.item_list[self.get_position( self.window_id)] chosen_source = chosen_source.getProperty('venom.source_dict') syssource = quote_plus(chosen_source) self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % syssource) if action_id in self.selection_actions: focus_id = self.getFocusId() if focus_id == 2001: return self.load_uncachedTorrents() chosen_source = self.item_list[self.get_position( self.window_id)] source = chosen_source.getProperty('venom.source') if 'UNCACHED' in source: debrid = chosen_source.getProperty('venom.debrid') source_dict = chosen_source.getProperty( 'venom.source_dict') link_type = 'pack' if 'package' in source_dict else 'single' sysname = quote_plus(self.meta.get('title')) if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: poster = self.meta.get( 'season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int( self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus( chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=cacheTorrent&caller=%s&type=%s&title=%s&items=%s&url=%s&source=%s&meta=%s)' % (debrid, link_type, sysname, quote_plus(jsdumps(self.results)), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(source_dict), quote_plus(jsdumps(self.meta)))) self.selected = (None, '') else: self.selected = ('play_Item', chosen_source) return self.close() elif action_id in self.context_actions: from re import match as re_match chosen_source = self.item_list[self.get_position( self.window_id)] source_dict = chosen_source.getProperty('venom.source_dict') cm_list = [('[B]Additional Link Info[/B]', 'sourceInfo')] if 'cached (pack)' in source_dict: cm_list += [('[B]Browse Debrid Pack[/B]', 'showDebridPack') ] source = chosen_source.getProperty('venom.source') if not 'UNCACHED' in source and self.dnlds_enabled: cm_list += [('[B]Download[/B]', 'download')] if re_match(r'^CACHED.*TORRENT', source): debrid = chosen_source.getProperty('venom.debrid') cm_list += [('[B]Save to %s Cloud[/B]' % debrid, 'saveToCloud')] chosen_cm_item = dialog.contextmenu([i[0] for i in cm_list]) if chosen_cm_item == -1: return cm_action = cm_list[chosen_cm_item][1] if cm_action == 'sourceInfo': self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % quote_plus(source_dict)) elif cm_action == 'showDebridPack': debrid = chosen_source.getProperty('venom.debrid') name = chosen_source.getProperty('venom.name') hash = chosen_source.getProperty('venom.hash') self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=showDebridPack&caller=%s&name=%s&url=%s&source=%s)' % (quote_plus(debrid), quote_plus(name), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(hash))) self.selected = (None, '') elif cm_action == 'download': sysname = quote_plus(self.meta.get('title')) poster = self.meta.get('poster', '') if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: sysname = quote_plus(self.meta.get('tvshowtitle')) poster = self.meta.get( 'season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int( self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus( chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=download&name=%s&image=%s&source=%s&caller=sources&title=%s)' % (new_sysname, quote_plus(poster), quote_plus(source_dict), sysname)) self.selected = (None, '') elif cm_action == 'saveToCloud': magnet = chosen_source.getProperty('venom.url') if debrid == 'AD': from resources.lib.debrid import alldebrid transfer_function = alldebrid.AllDebrid debrid_icon = alldebrid.ad_icon elif debrid == 'PM': from resources.lib.debrid import premiumize transfer_function = premiumize.Premiumize debrid_icon = premiumize.pm_icon elif debrid == 'RD': from resources.lib.debrid import realdebrid transfer_function = realdebrid.RealDebrid debrid_icon = realdebrid.rd_icon result = transfer_function().create_transfer(magnet) if result: notification(message='Sending MAGNET to the %s cloud' % debrid, icon=debrid_icon) elif action in self.closing_actions: self.selected = (None, '') self.close() except: from resources.lib.modules import log_utils log_utils.error()
def onAction(self, action): try: action_id = action.getId( ) # change to just "action" as the ID is already returned in that. if action_id in self.info_actions: chosen_source = self.item_list[self.get_position( self.window_id)] chosen_source = chosen_source.getProperty('venom.source_dict') syssource = quote_plus(chosen_source) self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % syssource) if action_id in self.selection_actions: chosen_source = self.item_list[self.get_position( self.window_id)] source = chosen_source.getProperty('venom.source') if 'UNCACHED' in source: debrid = chosen_source.getProperty('venom.debrid') source_dict = chosen_source.getProperty( 'venom.source_dict') link_type = 'pack' if 'package' in source_dict else 'single' sysname = quote_plus(self.meta.get('title')) if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: poster = self.meta.get( 'season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int( self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus( chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=cacheTorrent&caller=%s&type=%s&title=%s&items=%s&url=%s&source=%s&meta=%s)' % (debrid, link_type, sysname, quote_plus(jsdumps(self.uncached)), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(source_dict), quote_plus(jsdumps(self.meta)))) self.selected = (None, '') else: self.selected = (None, '') return self.close() elif action_id in self.context_actions: chosen_source = self.item_list[self.get_position( self.window_id)] source_dict = chosen_source.getProperty('venom.source_dict') cm_list = [('[B]Additional Link Info[/B]', 'sourceInfo')] source = chosen_source.getProperty('venom.source') if 'UNCACHED' in source: debrid = chosen_source.getProperty('venom.debrid') seeders = chosen_source.getProperty('venom.seeders') cm_list += [('[B]Cache to %s Cloud (seeders=%s)[/B]' % (debrid, seeders), 'cacheToCloud')] chosen_cm_item = dialog.contextmenu([i[0] for i in cm_list]) if chosen_cm_item == -1: return cm_action = cm_list[chosen_cm_item][1] if cm_action == 'sourceInfo': self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % quote_plus(source_dict)) if cm_action == 'cacheToCloud': debrid = chosen_source.getProperty('venom.debrid') source_dict = chosen_source.getProperty( 'venom.source_dict') link_type = 'pack' if 'package' in source_dict else 'single' sysname = quote_plus(self.meta.get('title')) if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: poster = self.meta.get( 'season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int( self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus( chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code( 'RunPlugin(plugin://plugin.video.venom/?action=cacheTorrent&caller=%s&type=%s&title=%s&items=%s&url=%s&source=%s&meta=%s)' % (debrid, link_type, sysname, quote_plus(jsdumps(self.uncached)), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(source_dict), quote_plus(jsdumps(self.meta)))) elif action in self.closing_actions: self.selected = (None, '') self.close() except: from resources.lib.modules import log_utils log_utils.error()
def onAction(self, action): try: if action in self.selection_actions: focus_id = self.getFocusId() if focus_id == 2060: # listItems position = self.get_position(self.window_id) chosen_listitem = self.item_list[position] imdb = chosen_listitem.getProperty('venom.imdb') if chosen_listitem.getProperty( 'venom.isSelected') == 'true': chosen_listitem.setProperty('venom.isSelected', '') if imdb in str(self.selected_items): pos = next( (index for (index, d) in enumerate(self.selected_items) if d["imdb"] == imdb), None) self.selected_items.pop(pos) else: chosen_listitem.setProperty('venom.isSelected', 'true') imdb = chosen_listitem.getProperty('venom.imdb') tvdb = chosen_listitem.getProperty('venom.tvdb') season = chosen_listitem.getProperty('venom.season') episode = chosen_listitem.getProperty('venom.episode') self.selected_items.append({ 'imdb': imdb, 'tvdb': tvdb, 'season': season, 'episode': episode }) elif focus_id == 2061: # OK Button self.close() elif focus_id == 2062: # Cancel Button self.selected_items = None self.close() elif focus_id == 2063: # Select All Button for item in self.item_list: item.setProperty('venom.isSelected', 'true') elif focus_id == 2045: # Stop Trailer Playback Button self.execute_code('PlayerControl(Stop)') sleep(500) self.setFocusId(self.window_id) elif action in self.context_actions: cm = [] chosen_listitem = self.item_list[self.get_position( self.window_id)] # media_type = chosen_listitem.getProperty('venom.media_type') source_trailer = chosen_listitem.getProperty('venom.trailer') if not source_trailer: from resources.lib.modules import trailer source_trailer = trailer.Trailer().worker( 'show', chosen_listitem.getProperty('venom.tvshowtitle'), chosen_listitem.getProperty('venom.year'), None, chosen_listitem.getProperty('venom.imdb')) if source_trailer: cm += [('[B]Play Trailer[/B]', 'playTrailer')] cm += [('[B]Browse Series[/B]', 'browseSeries')] chosen_cm_item = dialog.contextmenu([i[0] for i in cm]) if chosen_cm_item == -1: return cm_action = cm[chosen_cm_item][1] if cm_action == 'playTrailer': self.execute_code('PlayMedia(%s, 1)' % source_trailer) total_sleep = 0 while True: sleep(500) total_sleep += 500 self.hasVideo = condVisibility('Player.HasVideo') if self.hasVideo or total_sleep >= 10000: break if self.hasVideo: self.setFocusId(2045) while (condVisibility('Player.HasVideo') and not monitor.abortRequested()): self.setProgressBar() sleep(1000) self.hasVideo = False self.progressBarReset() self.setFocusId(self.window_id) else: self.setFocusId(self.window_id) if cm_action == 'browseSeries': systvshowtitle = quote_plus( chosen_listitem.getProperty('venom.tvshowtitle')) year = chosen_listitem.getProperty('venom.year') imdb = chosen_listitem.getProperty('venom.imdb') tmdb = chosen_listitem.getProperty('venom.tmdb') tvdb = chosen_listitem.getProperty('venom.tvdb') from resources.lib.modules.control import lang if not yesnoDialog(lang(32182), '', ''): return self.chosen_hide, self.chosen_unhide = None, None self.close() sysart = quote_plus( chosen_listitem.getProperty('venom.art')) self.execute_code( 'ActivateWindow(Videos,plugin://plugin.video.venom/?action=seasons&tvshowtitle=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&art=%s,return)' % (systvshowtitle, year, imdb, tmdb, tvdb, sysart)) elif action in self.closing_actions: self.selected_items = None if self.hasVideo: self.execute_code('PlayerControl(Stop)') else: self.close() except: from resources.lib.modules import log_utils log_utils.error() self.close()
def onAction(self, action): try: if action in self.selection_actions: focus_id = self.getFocusId() if focus_id == 2050: # listItems position = self.get_position(self.window_id) chosen_listitem = self.item_list[position] imdb = chosen_listitem.getProperty('dg.imdb') if chosen_listitem.getProperty('dg.isSelected') == 'true': chosen_listitem.setProperty('dg.isSelected', '') if imdb in self.selected_items: self.selected_items.remove(imdb) else: chosen_listitem.setProperty('dg.isSelected', 'true') self.selected_items.append(imdb) elif focus_id == 2051: # OK Button self.close() elif focus_id == 2052: # Cancel Button self.selected_items = None self.close() elif focus_id == 2053: # Select All Button for item in self.item_list: item.setProperty('dg.isSelected', 'true') elif focus_id == 2045: # Stop Trailer Playback Button self.execute_code('PlayerControl(Stop)') sleep(500) self.setFocusId(self.window_id) elif action in self.context_actions: cm = [] chosen_listitem = self.item_list[self.get_position( self.window_id)] # media_type = chosen_listitem.getProperty('dg.media_type') source_trailer = chosen_listitem.getProperty('dg.trailer') if not source_trailer: from resources.lib.modules import trailer source_trailer = trailer.Trailer().worker( 'movie', chosen_listitem.getProperty('dg.title'), chosen_listitem.getProperty('dg.year'), None, chosen_listitem.getProperty('dg.imdb')) if source_trailer: cm += [('[B]Play Trailer[/B]', 'playTrailer')] chosen_cm_item = dialog.contextmenu([i[0] for i in cm]) if chosen_cm_item == -1: return cm_action = cm[chosen_cm_item][1] if cm_action == 'playTrailer': self.execute_code('PlayMedia(%s, 1)' % source_trailer) total_sleep = 0 while True: sleep(500) total_sleep += 500 self.hasVideo = condVisibility('Player.HasVideo') if self.hasVideo or total_sleep >= 10000: break if self.hasVideo: self.setFocusId(2045) while (condVisibility('Player.HasVideo') and not monitor.abortRequested()): self.setProgressBar() sleep(1000) self.hasVideo = False self.progressBarReset() self.setFocusId(self.window_id) else: self.setFocusId(self.window_id) elif action in self.closing_actions: self.selected_items = None if self.hasVideo: self.execute_code('PlayerControl(Stop)') else: self.close() except: from resources.lib.modules import log_utils log_utils.error() self.close()
def onAction(self, action): try: action_id = action.getId() # change to just "action" as the ID is already returned in that. if action_id in self.info_actions: chosen_source = self.item_list[self.get_position(self.window_id)] chosen_source = chosen_source.getProperty('venom.source_dict') syssource = quote_plus(chosen_source) self.execute_code('RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % syssource) if action_id in self.selection_actions: focus_id = self.getFocusId() if focus_id == 2001: return self.load_uncachedTorrents() chosen_source = self.item_list[self.get_position(self.window_id)] source = chosen_source.getProperty('venom.source') if 'UNCACHED' in source: debrid = chosen_source.getProperty('venom.debrid') source_dict = chosen_source.getProperty('venom.source_dict') link_type = 'pack' if 'package' in source_dict else 'single' sysname = quote_plus(self.meta.get('title')) if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: poster = self.meta.get('season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int(self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus(chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code('RunPlugin(plugin://plugin.video.venom/?action=cacheTorrent&caller=%s&type=%s&title=%s&items=%s&url=%s&source=%s&meta=%s)' % (debrid, link_type, sysname, quote_plus(jsdumps(self.results)), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(source_dict), quote_plus(jsdumps(self.meta)))) self.selected = (None, '') else: self.selected = ('play_Item', chosen_source) return self.close() elif action_id in self.context_actions: chosen_source = self.item_list[self.get_position(self.window_id)] source_dict = chosen_source.getProperty('venom.source_dict') cm_list = [('[B]Additional Link Info[/B]', 'sourceInfo')] if 'cached (pack)' in source_dict: cm_list += [('[B]Browse Debrid Pack[/B]', 'showDebridPack')] source = chosen_source.getProperty('venom.source') if not 'UNCACHED' in source: cm_list += [('[B]Download[/B]', 'download')] chosen_cm_item = dialog.contextmenu([i[0] for i in cm_list]) if chosen_cm_item == -1: return cm_action = cm_list[chosen_cm_item][1] if cm_action == 'sourceInfo': self.execute_code('RunPlugin(plugin://plugin.video.venom/?action=sourceInfo&source=%s)' % quote_plus(source_dict)) elif cm_action == 'showDebridPack': debrid = chosen_source.getProperty('venom.debrid') name = chosen_source.getProperty('venom.name') hash = chosen_source.getProperty('venom.hash') self.execute_code('RunPlugin(plugin://plugin.video.venom/?action=showDebridPack&caller=%s&name=%s&url=%s&source=%s)' % (quote_plus(debrid), quote_plus(name), quote_plus(chosen_source.getProperty('venom.url')), quote_plus(hash))) self.selected = (None, '') elif cm_action == 'download': sysname = quote_plus(self.meta.get('title')) poster = self.meta.get('poster', '') if 'tvshowtitle' in self.meta and 'season' in self.meta and 'episode' in self.meta: sysname = quote_plus(self.meta.get('tvshowtitle')) poster = self.meta.get('season_poster') or self.meta.get('poster') sysname += quote_plus(' S%02dE%02d' % (int(self.meta['season']), int(self.meta['episode']))) elif 'year' in self.meta: sysname += quote_plus(' (%s)' % self.meta['year']) try: new_sysname = quote_plus(chosen_source.getProperty('venom.name')) except: new_sysname = sysname self.execute_code('RunPlugin(plugin://plugin.video.venom/?action=download&name=%s&image=%s&source=%s&caller=sources&title=%s)' % (new_sysname, quote_plus(poster), quote_plus(source_dict), sysname)) self.selected = (None, '') elif action in self.closing_actions: self.selected = (None, '') self.close() except: from resources.lib.modules import log_utils log_utils.error()