def renumber(itemlist, item='', typography=''): info() dict_series = load(itemlist[0]) if len(itemlist) > 0 else {} if item: # from core.support import dbg;dbg() item.channel = item.from_channel if item.from_channel else item.channel title = item.fulltitle.rstrip() already_renumbered = scrapertools.find_single_match( itemlist[0].title, r'(\d+\D\d+)') if already_renumbered: return itemlist elif item.channel in item.channel_prefs and TAG_TVSHOW_RENUMERATE in item.channel_prefs[ item.channel] and title not in dict_series: from core.videolibrarytools import check_renumber_options from specials.videolibrary import update_videolibrary check_renumber_options(item) update_videolibrary(item) elif inspect.stack()[2][3] == 'find_episodes': return itemlist elif title in dict_series and TAG_ID in dict_series[title]: ID = dict_series[title][TAG_ID] Episode = dict_series[title][TAG_EPISODE] Season = dict_series[title][ TAG_SEASON] if TAG_SEASON in dict_series[title] else '' Mode = dict_series[title][TAG_MODE] if TAG_MODE in dict_series[ title] else False Type = dict_series[title][TAG_TYPE] if TAG_TYPE in dict_series[ title] else 'auto' renumeration(itemlist, item, typography, dict_series, ID, Season, Episode, Mode, title, Type) else: if config.get_setting('autorenumber', item.channel): config_item(item, itemlist, typography, True) else: return itemlist else: for item in itemlist: title = item.fulltitle.rstrip() if title in dict_series and TAG_ID in dict_series[title]: ID = dict_series[title][TAG_ID] exist = True else: exist = False if item.contentType != 'movie': if item.context: context2 = item.context item.show = item.fulltitle = title item.context = context(exist) + context2 else: item.show = item.fulltitle = title item.context = context(exist)
def __init__(self, itemlist, item=None): self.item = item self.itemlist = itemlist self.auto = False self.dictSeries = load( self.itemlist[0]) if self.itemlist else load(item) if item else {} self.Episodes = {} self.sp = False if self.item: self.auto = config.get_setting('autorenumber', item.channel) self.title = self.item.fulltitle.strip() if match(self.itemlist[0].title, patron=r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)').match: item.exit = True return elif self.item.channel in self.item.channel_prefs and TVSHOW_RENUMERATE in self.item.channel_prefs[ item.channel] and self.title not in self.dictSeries: from core.videolibrarytools import check_renumber_options from specials.videolibrary import update_videolibrary check_renumber_options(self.item) update_videolibrary(self.item) if self.title in self.dictSeries and ID in self.dictSeries[ self.title] and self.dictSeries[self.title][ID] != '0': self.id = self.dictSeries[self.title][ID] self.Episodes = b64(self.dictSeries[self.title][EPISODE], 'decode') if EPISODE in self.dictSeries[ self.title] else {} self.Season = self.dictSeries[self.title][SEASON] self.Mode = self.dictSeries[self.title].get(MODE, False) self.Type = self.dictSeries[self.title].get(TYPE, False) if self.item.renumber: self.config() else: self.renumber() elif self.auto or self.item.renumber: self.Episodes = {} self.config() else: for item in self.itemlist: item.context = [{ "title": typo(config.get_localized_string(70585), 'bold'), "action": "start", "channel": "autorenumber", "from_channel": item.channel, "from_action": item.action }]
def import_videolibrary(item): logger.info() zip_file = unicode( platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip")) if zip_file == "": return if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)): return p_dialog = platformtools.dialog_progress_bg( config.get_localized_string(20000), config.get_localized_string(80007)) # p_dialog.update(0) if filetools.exists(temp_path): shutil.rmtree(temp_path) filetools.mkdir(videolibrary_temp_path) unzip(videolibrary_temp_path, zip_file) p_dialog.update(20) if config.is_xbmc() and config.get_setting("videolibrary_kodi"): xbmc_videolibrary.clean() p_dialog.update(30) shutil.rmtree(videolibrary_movies_path) shutil.rmtree(videolibrary_tvshows_path) p_dialog.update(50) config.verify_directories_created() if filetools.exists(movies_path): copy_tree(movies_path, videolibrary_movies_path) p_dialog.update(70) if filetools.exists(tvshows_path): copy_tree(tvshows_path, videolibrary_tvshows_path) p_dialog.update(90) shutil.rmtree(temp_path) p_dialog.update(100) xbmc.sleep(1000) p_dialog.close() platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), time=5000, sound=False) videolibrary.update_videolibrary() if config.is_xbmc() and config.get_setting("videolibrary_kodi"): xbmc_videolibrary.update()
def __init__(self, itemlist, item=None): self.item = item self.itemlist = itemlist self.selectspecials = False self.manual = False self.auto = False if self.item: self.renumberdict = load(item) self.auto = config.get_setting('autorenumber', item.channel) self.title = self.item.fulltitle.strip() if match(self.itemlist[0].title, patron=r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)').match: item.exit = True return elif self.item.channel in self.item.channel_prefs and RENUMBER in self.item.channel_prefs[ item.channel] and self.title not in self.renumberdict: from core.videolibrarytools import check_renumber_options from specials.videolibrary import update_videolibrary check_renumber_options(self.item) update_videolibrary(self.item) self.series = self.renumberdict.get(self.title, {}) self.id = self.series.get(ID, 0) self.episodes = self.series.get(EPISODES, {}) self.seasonsdict = self.series.get(SEASONSDICT, {}) self.season = self.series.get(SEASON, -1) self.episode = self.series.get(EPISODE, -1) self.manual = self.series.get(MANUALMODE, False) self.specials = self.series.get(SPECIALEPISODES, {}) if self.id and self.episodes and self.season >= 0 and self.episode >= 0: if self.item.renumber: self.config() else: self.renumber() elif self.auto or self.item.renumber: self.episodes = {} self.config() else: self.renumberdict = {} for item in self.itemlist: if item.contentType != 'movie': item.context = [{ "title": typo(config.get_localized_string(70585), 'bold'), "action": "start", "channel": "autorenumber", "from_channel": item.channel, "from_action": item.action }]
def import_videolibrary(item): logger.info() zip_file = platformtools.dialog_browse(1, config.get_localized_string(80005)) if zip_file == "": return if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)): return p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80007)) p_dialog.update(0) if filetools.exists(temp_path): filetools.rmdirtree(temp_path) filetools.mkdir(temp_path) unzipper = ziptools.ziptools() unzipper.extract(zip_file, temp_path) p_dialog.update(20) if config.is_xbmc() and config.get_setting("videolibrary_kodi"): xbmc_videolibrary.clean() p_dialog.update(30) filetools.rmdirtree(videolibrarytools.MOVIES_PATH) filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH) p_dialog.update(50) config.verify_directories_created() if filetools.exists(movies_path): copy_tree(movies_path, videolibrarytools.MOVIES_PATH) p_dialog.update(70) if filetools.exists(tvshows_path): copy_tree(tvshows_path, videolibrarytools.TVSHOWS_PATH) p_dialog.update(90) filetools.rmdirtree(temp_path) p_dialog.update(100) xbmc.sleep(1000) p_dialog.close() platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), time=5000, sound=False) videolibrary.update_videolibrary() if config.is_xbmc() and config.get_setting("videolibrary_kodi"): xbmc_videolibrary.update()