Пример #1
0
 def _refine_file(video_file) -> List[SeriesEpisodeInfo]:
     log.debug("Refining file %s", video_file)
     try:
         video = Video.fromname(video_file)
     except ValueError:
         log.error("Cannot guess video file type from: %s", video_file)
         return []
     refiner = sorted(refiner_manager.names())
     refine(video, episode_refiners=refiner, movie_refiners=refiner)
     log.debug("refine result: %r", video)
     if isinstance(video, Episode):
         log.debug("series: %s", video.series)
         log.debug("season: %s", video.season)
         if not video.season:
             log.error("No season defined !")
             return []
         if isinstance(video.season, list):
             video.season = video.season[0]
             log.error("Multi season found, only using first one: %s",
                       video.season)
         log.debug("episode: %s", video.episode)
         log.debug("title: %s", video.title)
         log.debug("series_tvdb_id: %s", video.series_tvdb_id)
         r = []
         # Support for double episode
         if not isinstance(video.episode, list):
             video.episode = [video.episode]
         for video_episode in video.episode:
             r.append(
                 SeriesEpisodeInfo(
                     series_episode_uid=SeriesEpisodeUid(
                         tv_db_id=video.series_tvdb_id,
                         season_number=video.season,
                         episode_number=video_episode,
                     ),
                     series_title=video.series,
                     episode_title=video.title,
                     quality=None,
                     video_languages=None,
                     subtitles_languages=None,
                     media_filename=video_file,
                     dirty=True,
                 ))
         return r
     elif isinstance(video, Movie):
         log.debug("movie: %s", video.title)
     return []
Пример #2
0
    def convert(self, value, param, ctx):
        match = re.match(
            r'^(?:(?P<weeks>\d+?)w)?(?:(?P<days>\d+?)d)?(?:(?P<hours>\d+?)h)?$',
            value)
        if not match:
            self.fail('%s is not a valid age' % value)

        return timedelta(**{k: int(v) for k, v in match.groupdict(0).items()})


AGE = AgeParamType()

PROVIDER = click.Choice(sorted(provider_manager.names()))

REFINER = click.Choice(sorted(refiner_manager.names()))

dirs = AppDirs('subliminal')
cache_file = 'subliminal.dbm'
config_file = 'config.ini'


@click.group(context_settings={'max_content_width': 100},
             epilog='Suggestions and bug reports are greatly appreciated: '
             'https://github.com/Diaoul/subliminal/')
@click.option('--addic7ed',
              type=click.STRING,
              nargs=2,
              metavar='USERNAME PASSWORD',
              help='Addic7ed configuration.')
@click.option('--legendastv',
Пример #3
0
    """
    name = 'age'

    def convert(self, value, param, ctx):
        match = re.match(r'^(?:(?P<weeks>\d+?)w)?(?:(?P<days>\d+?)d)?(?:(?P<hours>\d+?)h)?$', value)
        if not match:
            self.fail('%s is not a valid age' % value)

        return timedelta(**{k: int(v) for k, v in match.groupdict(0).items()})

AGE = AgeParamType()

PROVIDER = click.Choice(sorted(provider_manager.names()))

REFINER = click.Choice(sorted(refiner_manager.names()))

dirs = AppDirs('subliminal')
cache_file = 'subliminal.dbm'
config_file = 'config.ini'


@click.group(context_settings={'max_content_width': 100}, epilog='Suggestions and bug reports are greatly appreciated: '
             'https://github.com/Diaoul/subliminal/')
@click.option('--addic7ed', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='Addic7ed configuration.')
@click.option('--legendastv', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD', help='LegendasTV configuration.')
@click.option('--opensubtitles', type=click.STRING, nargs=2, metavar='USERNAME PASSWORD',
              help='OpenSubtitles configuration.')
@click.option('--cache-dir', type=click.Path(writable=True, file_okay=False), default=dirs.user_cache_dir,
              show_default=True, expose_value=True, help='Path to the cache directory.')
@click.option('--debug', is_flag=True, help='Print useful information for debugging subliminal and for reporting bugs.')