Exemple #1
0
def _refresh_incomplete_anime(db):
    with db:
        aids = sorted(set(_incomplete_anime(db)))
    for aid in aids:
        anime = request_anime(aid)
        query.update.add(db, anime)
        time.sleep(3)
Exemple #2
0
def command(state, args):
    """Add an anime from an AniDB search."""
    if len(args) < 2:
        print(f'Usage: {args[0]} {{ID|aid:AID}}')
        return
    aid = state.results.parse_aid(args[1], default_key='anidb')
    anime = request_anime(aid)
    query.update.add(state.db, anime)
Exemple #3
0
def func(cmd, args):
    """Update an existing anime from a local database search."""
    if args.watching:
        rows = query.select.select(cmd.db, 'regexp IS NOT NULL', [], ['aid'])
        aids = [anime.aid for anime in rows]
    elif args.incomplete:
        rows = query.select.select(cmd.db, 'enddate IS NULL', [], ['aid'])
        aids = [anime.aid for anime in rows]
    else:
        aid = cmd.results.parse_aid(args.aid, default_key='db')
        aids = [aid]
    if not aids:
        return
    anime = request_anime(aids.pop())
    query.update.add(cmd.db, anime)
    print('Updated {} {}'.format(anime.aid, anime.title))
    for aid in aids:
        time.sleep(2)
        anime = request_anime(aid)
        query.update.add(cmd.db, anime)
        print('Updated {} {}'.format(anime.aid, anime.title))
Exemple #4
0
def command(state, args):
    """Add an anime from an AniDB search."""
    args = parser.parse_args(args[1:])
    if args.watching:
        rows = query.select.select(state.db, 'regexp IS NOT NULL', [], ['aid'])
        aids = [anime.aid for anime in rows]
    elif args.incomplete:
        rows = query.select.select(state.db, 'enddate IS NULL', [], ['aid'])
        aids = [anime.aid for anime in rows]
    else:
        aid = state.results.parse_aid(args.aid, default_key='db')
        aids = [aid]
    if not aids:
        return
    anime = request_anime(aids.pop())
    query.update.add(state.db, anime)
    print('Updated {} {}'.format(anime.aid, anime.title))
    for aid in aids:
        time.sleep(2)
        anime = request_anime(aid)
        query.update.add(state.db, anime)
        print('Updated {} {}'.format(anime.aid, anime.title))
Exemple #5
0
def func(cmd, args):
    """Add an anime from an AniDB search."""
    aid = cmd.results.parse_aid(args.aid, default_key='anidb')
    anime = request_anime(aid)
    query.update.add(cmd.db, anime)