def add_item(self, params): error = False arg = {"play": params['url'], 'cp': 'sosac.ph', "title": params['name']} item_url = util._create_plugin_url(arg, 'plugin://' + self.addon_id + '/') print("item: ", item_url, params) new_items = False # self.showNotification('Linking', params['name']) if "movie" in params['url']: item_dir = self.getSetting('library-movies') (error, new_items) = self.add_item_to_library( os.path.join(item_dir, self.normalize_filename(params['name']), self.normalize_filename(params['name'])) + '.strm', item_url) else: if not ('notify' in params): self.showNotification(params['name'], 'Checking new content') subs = self.get_subs() item_dir = self.getSetting('library-tvshows') if not params['url'] in subs.keys(): subs.update({params['url']: params['name']}) self.set_subs(subs) # self.addon.setSetting('tvshows-subs', json.dumps(subs)) if not xbmcvfs.exists(os.path.join(item_dir, self.normalize_filename(params['name']), 'tvshow.nfo')): tvid = self.getTVDB(params['name']) if tvid: self.add_item_to_library(os.path.join(item_dir, self.normalize_filename( params['name']), 'tvshow.nfo'), 'http://thetvdb.com/index.php?tab=series&id=' + tvid) list = self.provider.list_tv_show(params['url']) for itm in list: nfo = re.search('[^\d+](?P<season>\d+)[^\d]+(?P<episode>\d+)', itm['title'], re.IGNORECASE | re.DOTALL) arg = {"play": itm['url'], 'cp': 'sosac.ph', "title": self.normalize_filename(itm['epname'])} """ info = ''.join(('<episodedetails><season>', nfo.group('season'), '</season><episode>', nfo.group('episode'), '</episode></episodedetails>')) """ item_url = util._create_plugin_url(arg, 'plugin://' + self.addon_id + '/') (err, new) = self.add_item_to_library(os.path.join( item_dir, self.normalize_filename(params['name']), 'Season ' + nfo.group('season'), "S" + nfo.group('season') + "E" + nfo.group('episode') + '.strm'), item_url) error |= err if new is True and not err: new_items = True if not error and new_items and not ('update' in params) and not ('notify' in params): self.showNotification(params['name'], 'New content') xbmc.executebuiltin('UpdateLibrary(video)') elif not error and not ('notify' in params): self.showNotification(params['name'], 'No new contents') if error and not ('notify' in params): self.showNotification('Failed, Please check kodi.util.info', 'Linking') return new_items
def item(params): info = scrapper.get_info(params["item"]) xbmc_info = scrapper.xbmc_info(info) page = util.request(info["trailers_url"], headers={"Referer": BASE_URL}) data = util.substr(page, '<label for="frmfilterSelectForm-filter">', "</select>") xbmcutil.add_dir( __language__(30007), params, info["img"], infoLabels=xbmc_info, menuItems={__language__(30007): "Action(info)"} ) add_addon_search(30006, "plugin.video.online-files", info, "search") def_trailer = None for m in re.finditer('<option value="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): url = info["url"] + "/videa/-filtr-" + m.group("url") trailer = util._create_plugin_url({"play": url}) if def_trailer == None: info["trailer"] = trailer scrapper.set_info(info) xbmc_info["Title"] = "%s - %s" % (info["title"], m.group("name")) xbmcutil.add_video( m.group("name"), {"play": url}, info["img"], infoLabels=xbmc_info, menuItems={__language__(30007): "Action(info)"}, ) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def add_plugin_call(name, plugin, params, logo="", infoLabels={}): name = util.decode_html(name) infoLabels["Title"] = name liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=logo) try: liz.setInfo(type="Video", infoLabels=infoLabels) except: traceback.print_exc() plugurl = util._create_plugin_url(params, plugin) return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=plugurl, listitem=liz, isFolder=True)
def add_item(self, params): error = False arg = { "play": params['url'], 'cp': 'sosac.ph', "title": params['name'] } item_url = util._create_plugin_url(arg, 'plugin://' + self.addon_id + '/') print("item: ", item_url, params) new_items = False #self.showNotification('Linking', params['name']) if self.scanRunning(): self.showNotification( 'Library scan or subscription update in progress.', 'Please wait for it to complete.', 5000) return if "movie" in params['url']: item_dir = self.getSetting('library-movies') (error, new_items) = self.add_item_to_library( os.path.join(item_dir, self.normalize_filename(params['name']), self.normalize_filename(params['name'])) + '.strm', item_url) else: if not ('notify' in params): self.showNotification(params['name'], 'Checking new content') subs = self.get_subs() item_dir = self.getSetting('library-tvshows') if not params['url'] in subs.keys(): subs.update({params['url']: params['name']}) self.set_subs(subs) #self.addon.setSetting('tvshows-subs', json.dumps(subs)) if not xbmcvfs.exists( os.path.join(item_dir, self.normalize_filename(params['name']), 'tvshow.nfo')): tvid = self.getTVDB(params['name']) if tvid: self.add_item_to_library( os.path.join(item_dir, self.normalize_filename(params['name']), 'tvshow.nfo'), 'http://thetvdb.com/index.php?tab=series&id=' + tvid) list = self.provider.list_tv_show(params['url']) for itm in list: nfo = re.search('[^\d+](?P<season>\d+)[^\d]+(?P<episode>\d+)', itm['title'], re.IGNORECASE | re.DOTALL) arg = { "play": itm['url'], 'cp': 'sosac.ph', "title": self.normalize_filename(itm['epname']) } #info = ''.join(('<episodedetails><season>',nfo.group('season'),'</season><episode>',nfo.group('episode'),'</episode></episodedetails>')) item_url = util._create_plugin_url( arg, 'plugin://' + self.addon_id + '/') (err, new) = self.add_item_to_library( os.path.join( item_dir, self.normalize_filename(params['name']), 'Season ' + nfo.group('season'), "S" + nfo.group('season') + "E" + nfo.group('episode') + '.strm'), item_url) error |= err if new == True and not err: new_items = True if not error and new_items and not ('update' in params) and not ( 'notify' in params): self.showNotification(params['name'], 'New content') xbmc.executebuiltin('UpdateLibrary(video)') elif not error and not ('notify' in params): self.showNotification(params['name'], 'No new contents') if error and not ('notify' in params): self.showNotification('Failed, Please check kodi.util.info', 'Linking') return new_items