def scraper(self, content, item, language="en"): # если есть специализированный скрабер, то запускаем его... scraped_item = self.scraper_default(item) if content == "tvdb": scraper = TvDb(language) elif content == "tmdb": scraper = TmDb(language) else: # if content == 'kinopoisk': scraper = KinoPoisk(language) name, search, year = item["label"], item["search"], item["year"] if not search: return scraped_item scraper_item = scraper.scraper(search, year) if not scraper_item: scraped_item["label"] = name return scraped_item scraped_item.update(scraper_item) scraped_item["label"] = name return scraped_item
def scraper_tvdb(self, item): scraper = self.scraper_default(item) tvdb = TvDb() if 'season' in item: season = int(item['season']) else: season = None name, search, year = item['label'], item['search'], item['year'] if not search: return scraper tvdb = tvdb.scraper(search, year, season) if not tvdb: scraper['label'] = name return scraper if season: return tvdb scraper.update(tvdb) scraper['label'] = name return scraper
def scraper(self, content, item, language='en'): # если есть специализированный скрабер, то запускаем его... scraped_item = self.scraper_default(item) if content == 'tvdb': scraper = TvDb(language) elif content == 'tmdb': scraper = TmDb(language) else: # if content == 'kinopoisk': scraper = KinoPoisk(language) name, search, year = item['label'], item['search'], item['year'] if not search: return scraped_item scraper_item = scraper.scraper(search, year) if not scraper_item: scraped_item['label'] = name return scraped_item scraped_item.update(scraper_item) scraped_item['label'] = name return scraped_item
def scraper_tvdb(self, item): scraper = self.scraper_default(item) tvdb = TvDb() # пробуем получить сезон plugin.log.debug("TVDB: parsing season from item" + str(item).encode("utf-8")) r = re.compile(u'Сезон[\:]{0,1}[\s]{1,}([0-9]+)', re.U).search(item['label']) if r: scraper['info']['season'] = int(r.group(1)) plugin.log.debug("TVDB: splitting name from " + item['label'].encode("utf-8")) name, search, year = self.split_name(item['label']) plugin.log.debug("TVDB: name split to [%s][%s]" % (name.encode("utf-8"), str(year))) if not search: return scraper tvdb = tvdb.scraper(search, year) plugin.log.debug("TVDB: scraper result" + str(tvdb)) if not tvdb: scraper['label'] = name return scraper scraper.update(tvdb) plugin.log.debug("Scraper data updated") scraper['label'] = name plugin.log.debug("Scraper label updated") # для поиска похожих раздач и поддиректорий scraper['search'] = scraper['subdir'] = search[0] if tvdb['info'].get('originaltitle'): scraper['search'] = tvdb['info']['originaltitle'] elif tvdb['info'].get('title'): scraper['search'] = tvdb['info']['title'] plugin.log.debug("Scraper info updated") # для создания поддиректорий scraper['subdir'] = scraper['search'] if scraper['info'].get('year'): scraper['subdir'] = u'.'.join( [scraper['subdir'], str(scraper['info']['year'])]) plugin.log.debug("Scraper subdir info updated") return scraper
def scraper_tvdb(self, item): scraper = self.scraper_default(item) tvdb = TvDb() # пробуем получить сезон plugin.log.debug("TVDB: parsing season from item" + str(item).encode("utf-8")) r = re.compile(u'Сезон[\:]{0,1}[\s]{1,}([0-9]+)', re.U).search(item['label']) if r: scraper['info']['season'] = int(r.group(1)) plugin.log.debug("TVDB: splitting name from " + item['label'].encode("utf-8")) name, search, year = self.split_name(item['label']) plugin.log.debug("TVDB: name split to [%s][%s]" % (name.encode("utf-8"), str(year))) if not search: return scraper tvdb = tvdb.scraper(search, year) plugin.log.debug("TVDB: scraper result" + str(tvdb)) if not tvdb: scraper['label'] = name return scraper scraper.update(tvdb) plugin.log.debug("Scraper data updated") scraper['label'] = name plugin.log.debug("Scraper label updated") # для поиска похожих раздач и поддиректорий scraper['search'] = scraper['subdir'] = search[0] if tvdb['info'].get('originaltitle'): scraper['search'] = tvdb['info']['originaltitle'] elif tvdb['info'].get('title'): scraper['search'] = tvdb['info']['title'] plugin.log.debug("Scraper info updated") # для создания поддиректорий scraper['subdir'] = scraper['search'] if scraper['info'].get('year'): scraper['subdir'] = u'.'.join([scraper['subdir'], str(scraper['info']['year'])]) plugin.log.debug("Scraper subdir info updated") return scraper