Exemplo n.º 1
0
def videos(args):
    game_ids = _get_game_ids(args.game)

    print_out("<dim>Loading videos...</dim>")
    generator = twitch.channel_videos_generator(args.channel_name,
                                                args.limit,
                                                args.sort,
                                                args.type,
                                                game_ids=game_ids)

    first = 1

    for videos, has_more in generator:
        count = len(videos["edges"]) if "edges" in videos else 0
        total = videos["totalCount"]
        last = first + count - 1

        for video in videos["edges"]:
            print_video(video["node"])

        if not has_more:
            break

        first += count
    else:
        print_out("<yellow>No videos found</yellow>")
Exemplo n.º 2
0
def videos_id_only(channel_name, limit, sort, type, game, **kwargs):
    game_ids = _get_game_ids(game)

    generator = twitch.channel_videos_generator(channel_name,
                                                limit,
                                                sort,
                                                type,
                                                game_ids=game_ids)

    first = 1

    for videos, has_more in generator:
        count = len(videos["edges"]) if "edges" in videos else 0
        total = videos["totalCount"]
        last = first + count - 1

        for video in videos["edges"]:
            video_id = video["node"]["id"]

            if not os.path.isfile(
                    str(Path.home()) + "/.twitchdownloads/" + video_id):
                print(video["node"]["id"])

        if not has_more:
            break

        first += count
Exemplo n.º 3
0
def videos(args):
    game_ids = _get_game_ids(args.game)

    print_out("<dim>Loading videos...</dim>")
    generator = twitch.channel_videos_generator(
        args.channel_name, args.limit, args.sort, args.type, game_ids=game_ids)

    first = 1

    for videos, has_more in generator:
        count = len(videos["edges"]) if "edges" in videos else 0
        total = videos["totalCount"]
        last = first + count - 1

        print_out("-" * 80)
        print_out("<yellow>Showing videos {}-{} of {}</yellow>".format(first, last, total))

        for video in videos["edges"]:
            print_video(video["node"])

        if not args.pager:
            print_out(
                "\n<dim>There are more videos. "
                "Increase the --limit or use --pager to see the rest.</dim>"
            )
            break

        if not has_more or not _continue():
            break

        first += count
    else:
        print_out("<yellow>No videos found</yellow>")