def parse_series(self, data, **kwargs): log.debug('Parsing series: `%s` kwargs: %s', data, kwargs) start = time.clock() parser = SeriesParser(**kwargs) try: parser.parse(data) except ParseWarning as pw: log_once(pw.value, logger=log) # TODO: Returning this invalid object seems a bit silly, raise an exception is probably better if not parser.valid: return SeriesParseResult(valid=False) result = SeriesParseResult(data=data, name=parser.name, episodes=parser.episodes, id=parser.id, id_type=parser.id_type, quality=parser.quality, proper_count=parser.proper_count, special=parser.special, group=parser.group, season_pack=parser.season_pack, strict_name=parser.strict_name, identified_by=parser.identified_by) end = time.clock() log.debug('Parsing result: %s (in %s ms)', parser, (end - start) * 1000) return result
def parse_series(self, data, **kwargs): log.debug('Parsing series: `%s` kwargs: %s', data, kwargs) start = preferred_clock() parser = SeriesParser(**kwargs) try: parser.parse(data) except ParseWarning as pw: log_once(pw.value, logger=log) # TODO: Returning this invalid object seems a bit silly, raise an exception is probably better if not parser.valid: return SeriesParseResult(valid=False) result = SeriesParseResult( data=data, name=parser.name, episodes=parser.episodes, id=parser.id, id_type=parser.id_type, quality=parser.quality, proper_count=parser.proper_count, special=parser.special, group=parser.group, season_pack=parser.season_pack, strict_name=parser.strict_name, identified_by=parser.identified_by ) log.debug('Parsing result: %s (in %s ms)', parser, (preferred_clock() - start) * 1000) return result
def parse(self, movie_filename): for serie in SERIES: parser = SeriesParser(name=serie) parser.parse(data=movie_filename) if parser.valid: break return parser
def parse_series(self, data, **kwargs): log.debug('Parsing series: `%s` kwargs: %s', data, kwargs) start = time.clock() parser = SeriesParser(**kwargs) try: parser.parse(data) except ParseWarning as pw: log_once(pw.value, logger=log) end = time.clock() log.debug('Parsing result: %s (in %s ms)', parser, (end - start) * 1000) return parser
def parse(self, data, type_=None, name=None, **kwargs): internal_parser = None if kwargs is None: kwargs = {} if name: kwargs['name'] = name metainfo = False try: metainfo = kwargs.pop('metainfo') except KeyError: pass if metainfo and type_ == PARSER_EPISODE: internal_parser = SeriesParser(**kwargs) internal_parser.assume_quality = types.MethodType(assume_quality_func, internal_parser) if self.parse_serie(internal_parser, data): return internal_parser else: type_ == PARSER_MOVIE if type_ == PARSER_EPISODE: internal_parser = SeriesParser(**kwargs) elif type_ == PARSER_MOVIE: internal_parser = MovieParser() else: internal_parser = MovieParser() internal_parser.assume_quality = types.MethodType(assume_quality_func, internal_parser) internal_parser.parse(data) return internal_parser
def parse_series(self, data, **kwargs): log.debug('Parsing series: `%s` kwargs: %s', data, kwargs) start = time.clock() quality = kwargs.pop('quality', None) parser = SeriesParser(**kwargs) try: parser.parse(data) except ParseWarning as pw: log_once(pw.value, logger=log) # Passed in quality overrides parsed one if quality: parser.quality = quality end = time.clock() log.debug('Parsing result: %s (in %s ms)', parser, (end - start) * 1000) return parser
def parse(self, data, type_=None, name=None, **kwargs): internal_parser = None if kwargs is None: kwargs = {} if name: kwargs['name'] = name metainfo = False try: metainfo = kwargs.pop('metainfo') except KeyError: pass if metainfo and type_ == PARSER_EPISODE: internal_parser = SeriesParser(**kwargs) internal_parser.assume_quality = types.MethodType( assume_quality_func, internal_parser) if self.parse_serie(internal_parser, data): return internal_parser else: type_ == PARSER_MOVIE if type_ == PARSER_EPISODE: internal_parser = SeriesParser(**kwargs) elif type_ == PARSER_MOVIE: internal_parser = MovieParser() else: internal_parser = MovieParser() internal_parser.assume_quality = types.MethodType( assume_quality_func, internal_parser) internal_parser.parse(data) return internal_parser
import re from datetime import datetime from sqlalchemy import Column, Unicode, Integer from flexget import plugin from flexget.event import event from flexget.utils import requests from flexget.utils.soup import get_soup from flexget.utils.titles.series import SeriesParser from flexget.db_schema import versioned_base log = logging.getLogger('pogcal_acquired') Base = versioned_base('pogcal_acquired', 0) session = requests.Session(max_retries=3) series_parser = SeriesParser() class PogcalShow(Base): __tablename__ = 'pogcal_shows' id = Column(Integer, primary_key=True, autoincrement=False, nullable=False) name = Column(Unicode) class PogcalAcquired(object): schema = { 'type': 'object', 'properties': { 'username': { 'type': 'string'