src/streamlink_cli/main.py
def create_output(plugin):
    """Decides where to write the stream.

    Depending on arguments it can be one of these:
     - The stdout pipe
     - A subprocess' stdin pipe
     - A named pipe that the subprocess reads from
     - A regular file

    """

    if (args.output or args.stdout) and (args.record or args.record_and_pipe):
        console.exit("Cannot use record options with other file output options.")

    if args.output:
        if args.output == "-":
            out = FileOutput(fd=stdout)
        else:
            out = check_file_output(args.output, args.force)
    elif args.stdout:
        out = FileOutput(fd=stdout)
    elif args.record_and_pipe:
        record = check_file_output(args.record_and_pipe, args.force)
        out = FileOutput(fd=stdout, record=record)
    else:
        http = namedpipe = record = None

        if not args.player:
            console.exit("The default player (VLC) does not seem to be "
                         "installed. You must specify the path to a player "
                         "executable with --player.")

        if args.player_fifo:
            pipename = "streamlinkpipe-{0}".format(os.getpid())
            log.info("Creating pipe {0}", pipename)

            try:
                namedpipe = NamedPipe(pipename)
            except IOError as err:
                console.exit("Failed to create pipe: {0}", err)
        elif args.player_http:
            http = create_http_server()

        title = create_title(plugin)

        if args.record:
            record = check_file_output(args.record, args.force)

        log.info("Starting player: {0}", args.player)

        out = PlayerOutput(args.player, args=args.player_args,
                           quiet=not args.verbose_player,
                           kill=not args.player_no_close,
                           namedpipe=namedpipe, http=http,
                           record=record, title=title)

    return out
def create_output(plugin):
    if (args.output or args.stdout) and (args.record or args.record_and_pipe):
        console.exit("Cannot use record options with other file output options.")

    if args.output:
        if args.output == "-":
            out = FileOutput(fd=stdout)
        else:
            out = check_file_output(args.output, args.force)
    elif args.stdout:
        out = FileOutput(fd=stdout)
    elif args.record_and_pipe:
        record = check_file_output(args.record_and_pipe, args.force)
        out = FileOutput(fd=stdout, record=record)
    else:
        http = namedpipe = record = None

        if not args.player:
            console.exit("The default player (VLC) does not seem to be "
                         "installed. You must specify the path to a player "
                         "executable with --player.")

        if args.player_fifo:
            pipename = "streamlinkpipe-{0}".format(os.getpid())
            log.info("Creating pipe {0}", pipename)

            try:
                namedpipe = NamedPipe(pipename)
            except IOError as err:
                console.exit("Failed to create pipe: {0}", err)
        elif args.player_http:
            http = create_http_server()

        title = create_title(plugin)

        if args.record:
            record = check_file_output(args.record, args.force)

        log.info("Starting player: {0}", args.player)

        out = PlayerOutput(args.player, args=args.player_args,
                           quiet=not args.verbose_player,
                           kill=not args.player_no_close,
                           namedpipe=namedpipe, http=http,
                           record=record, title=title)

    return out
def create_output ( plugin ) : if ( args . output or args . stdout ) and ( args . record or args . record_and_pipe ) : console . exit ( "Cannot use record options with other file output options." ) if args . output : if args . output == "-" : out = FileOutput ( fd = stdout ) else : out = check_file_output ( args . output , args . force ) elif args . stdout : out = FileOutput ( fd = stdout ) elif args . record_and_pipe : record = check_file_output ( args . record_and_pipe , args . force ) out = FileOutput ( fd = stdout , record = record ) else : http = namedpipe = record = None if not args . player : console . exit ( "The default player (VLC) does not seem to be " "installed. You must specify the path to a player " "executable with --player." ) if args . player_fifo : pipename = "streamlinkpipe-{0}" . format ( os . getpid ( ) ) log . info ( "Creating pipe {0}" , pipename ) try : namedpipe = NamedPipe ( pipename ) except IOError as err : console . exit ( "Failed to create pipe: {0}" , err ) elif args . player_http : http = create_http_server ( ) title = create_title ( plugin ) if args . record : record = check_file_output ( args . record , args . force ) log . info ( "Starting player: {0}" , args . player ) out = PlayerOutput ( args . player , args = args . player_args , quiet = not args . verbose_player , kill = not args . player_no_close , namedpipe = namedpipe , http = http , record = record , title = title ) return out
Decides where to write the stream.

    Depending on arguments it can be one of these:
     - The stdout pipe
     - A subprocess' stdin pipe
     - A named pipe that the subprocess reads from
     - A regular file
Decides where to write the stream .