コード例 #1
0
def func(cmd, args):
    # pylint: disable=unused-argument
    """Purge all caches."""
    cmd.cache_manager.teardown()
    cmd.cache_manager.setup()
    EpisodeTypes.forget(cmd.db)
    del cmd.file_picker
コード例 #2
0
def func(cmd, args):
    """Show anime data."""
    aid = cmd.results.parse_aid(args.aid, default_key='db')
    anime = query.select.lookup(cmd.db, aid, episode_fields=args.episode_fields)

    complete_string = 'yes' if anime.complete else 'no'
    print(SHOW_MSG.format(
        anime.aid,
        anime.title,
        anime.type,
        anime.watched_episodes,
        anime.episodecount,
        fromtimestamp(anime.startdate) if anime.startdate else 'N/A',
        fromtimestamp(anime.enddate) if anime.enddate else 'N/A',
        complete_string,
    ))
    if anime.regexp:
        print('Watching regexp: {}'.format(anime.regexp))
    if hasattr(anime, 'episodes'):
        episodes = sorted(anime.episodes, key=lambda x: (x.type, x.number))
        print('\n', tabulate(
            (
                (
                    EpisodeTypes.from_db(cmd.db).get_epno(episode),
                    episode.title,
                    episode.length,
                    'yes' if episode.user_watched else '',
                )
                for episode in episodes
            ),
            headers=['Number', 'Title', 'min', 'Watched'],
        ))
コード例 #3
0
ファイル: purgecache.py プロジェクト: darkfeline/animanager
def command(state, args):
    """Purge all caches."""
    state.cache_manager.teardown()
    state.cache_manager.setup()
    EpisodeTypes.forget(state.db)
    del state.file_picker