def config(self): self.id = '' if self.title in self.dictSeries: self.id = self.dictSeries[self.title].get(ID, '') # Pulizia del Titolo if any(word in self.title.lower() for word in ['specials', 'speciali']): self.title = re.sub(r'\s*specials|\s*speciali', '', self.title.lower()) elif not self.item.infoLabels['tvdb_id']: self.item.contentSerieName = self.title.rstrip('123456789 ') while not self.item.exit: tvdb.find_and_set_infoLabels(self.item) if self.item.infoLabels['tvdb_id']: self.item.exit = True else: self.item = platformtools.dialog_info(self.item, 'tvdb') # Rinumerazione Automatica if (not self.id and self.auto) or self.item.renumber: self.id = self.item.infoLabels[ 'tvdb_id'] if 'tvdb_id' in self.item.infoLabels else '' if self.id: self.dictRenumber = {ID: self.id} self.dictSeries[self.title] = self.dictRenumber if any(word in self.title.lower() for word in ['specials', 'speciali']): season = '0' elif RepresentsInt(self.title.split()[-1]): season = self.title.split()[-1] else: season = '1' self.Season = self.dictRenumber[SEASON] = season self.renumber()
def config(self): # Pulizia del Titolo if any( word in self.title.lower() for word in ['specials', 'speciali']): self.title = re.sub(r'\s*specials|\s*speciali', '', self.title.lower()) elif not self.item.infoLabels['tmdb_id']: self.item.contentSerieName = self.title.rstrip('123456789 ') self.item.infoLabels['imdb_id'] = '' self.item.infoLabels['tvdb_id'] = '' self.item.infoLabels['tmdb_id'] = '' self.item.infoLabels['year'] = '-' self.item.contentType = 'tvshow' while not self.item.exit: tmdb.find_and_set_infoLabels(self.item) if self.item.infoLabels['tmdb_id']: self.item.exit = True else:self.item = platformtools.dialog_info(self.item, 'tmdb') # Rinumerazione Automatica if (not self.id and self.auto) or self.item.renumber: self.id = self.item.infoLabels['tmdb_id'] if 'tmdb_id' in self.item.infoLabels else 0 if self.id: self.series = {ID: self.id} self.renumberdict[self.title] = self.series if any(word in self.title.lower() for word in ['specials', 'speciali']): season = 0 elif RepresentsInt(self.title.split()[-1]): season = int(self.title.split()[-1]) else: season = 1 self.season = self.series[SEASON] = season self.episode = 1 self.renumber()
def find_and_set_infoLabels(item): """ function called to search and set infolabels :param item: :return: Boolean indicating if the 'code' could be found """ # from core.support import dbg;dbg() global scraper scraper = None # logger.debug("item:\n" + item.tostring('\n')) list_opciones_cuadro = [ config.get_localized_string(60223), config.get_localized_string(60224) ] # If more scrapers are added, they must be declared here-> "modulo_scraper": "Text_in_box" scrapers_disponibles = { 'tmdb': config.get_localized_string(60225), 'tvdb': config.get_localized_string(60226) } # Get the default Scraper of the configuration according to the content type if item.contentType == "movie": scraper_actual = 'tmdb' # scraper_actual = ['tmdb'][config.get_setting("scraper_movies", "videolibrary")] tipo_contenido = "movie" title = item.contentTitle # Complete list of options for this type of content list_opciones_cuadro.append(scrapers_disponibles['tmdb']) else: scraper_actual = 'tmdb' # scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")] tipo_contenido = "serie" title = item.contentSerieName # Complete list of options for this type of content list_opciones_cuadro.append(scrapers_disponibles['tmdb']) # list_opciones_cuadro.append(scrapers_disponibles['tvdb']) # We import the scraper try: scraper = __import__('core.%s' % scraper_actual, fromlist=["core.%s" % scraper_actual]) except ImportError: exec("import core." + scraper_actual + " as scraper") except: import traceback logger.error(traceback.format_exc()) while scraper: # We call the find_and_set_infoLabels function of the selected scraper scraper_result = scraper.find_and_set_infoLabels(item) # Check if there is a 'code' if scraper_result and item.infoLabels['code']: # correct code logger.debug("Identificador encontrado: %s" % item.infoLabels['code']) scraper.completar_codigos(item) return True elif scraper_result: # Content found but no 'code' msg = config.get_localized_string(60227) % title else: # Content not found msg = config.get_localized_string(60228) % title logger.debug(msg) # Show box with other options: item = platformtools.dialog_info(item, scraper_actual) if item.exit: logger.debug("You have clicked 'cancel' in the window '%s'" % msg) return False logger.error("Error importing the scraper module %s" % scraper_actual)