mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-24 11:53:25 +00:00
Merge branch 'pr/n99_rkuchumov'
This commit is contained in:
commit
8a2e71fcfb
@ -181,6 +181,7 @@ void init_options (struct ccx_s_options *options)
|
||||
options->send_to_srv = 0;
|
||||
options->tcpport = NULL;
|
||||
options->tcp_password = NULL;
|
||||
options->tcp_desc = NULL;
|
||||
options->srv_addr = NULL;
|
||||
options->srv_port = NULL;
|
||||
options->line_terminator_lf=0; // 0 = CRLF
|
||||
@ -433,7 +434,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (ccx_options.send_to_srv)
|
||||
{
|
||||
connect_to_srv(ccx_options.srv_addr, ccx_options.srv_port);
|
||||
connect_to_srv(ccx_options.srv_addr, ccx_options.srv_port, ccx_options.tcp_desc);
|
||||
}
|
||||
|
||||
if (ccx_options.write_format!=CCX_OF_NULL)
|
||||
|
@ -121,6 +121,7 @@ struct ccx_s_options // Options from user parameters
|
||||
unsigned send_to_srv;
|
||||
char *tcpport;
|
||||
char *tcp_password;
|
||||
char *tcp_desc;
|
||||
char *srv_addr;
|
||||
char *srv_port;
|
||||
int line_terminator_lf; // 0 = CRLF, 1=LF
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define OK 1
|
||||
#define PASSWORD 2
|
||||
#define BIN_MODE 3
|
||||
#define CC_DESC 4
|
||||
#define ERROR 51
|
||||
#define UNKNOWN_COMMAND 52
|
||||
#define WRONG_PASSWORD 53
|
||||
@ -66,7 +67,7 @@ void init_sockets (void);
|
||||
void pr_command(char c);
|
||||
#endif
|
||||
|
||||
void connect_to_srv(const char *addr, const char *port)
|
||||
void connect_to_srv(const char *addr, const char *port, const char *cc_desc)
|
||||
{
|
||||
if (NULL == addr)
|
||||
{
|
||||
@ -86,6 +87,12 @@ void connect_to_srv(const char *addr, const char *port)
|
||||
if (ask_passwd(srv_sd) < 0)
|
||||
fatal(EXIT_FAILURE, "Unable to connect\n");
|
||||
|
||||
if (cc_desc != NULL &&
|
||||
write_block(srv_sd, CC_DESC, cc_desc, strlen(cc_desc)) < 0)
|
||||
{
|
||||
fatal(EXIT_FAILURE, "Unable to connect\n");
|
||||
}
|
||||
|
||||
mprint("Connected to %s:%s\n", addr, port);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
void connect_to_srv(const char *addr, const char *port);
|
||||
void connect_to_srv(const char *addr, const char *port, const char *cc_desc);
|
||||
|
||||
void net_send_header(const unsigned char *data, size_t len);
|
||||
void net_send_cc(const unsigned char *data, size_t len);
|
||||
|
10
src/params.c
10
src/params.c
@ -429,6 +429,8 @@ void usage (void)
|
||||
mprint (" -tcp port: Reads the input data in BIN format according to CCExtractor's\n");
|
||||
mprint (" protocol, listening specified port on the local host\n");
|
||||
mprint (" -tcppassword password: Sets server password for new connections to tcp server\n");
|
||||
mprint (" -tcpdesc description: Sends to the server short description about captions e.g.\n");
|
||||
mprint (" channel name or file name\n");
|
||||
mprint ("Options that affect what will be processed:\n");
|
||||
mprint (" -1, -2, -12: Output Field 1 data, Field 2 data, or both\n");
|
||||
mprint (" (DEFAULT is -1)\n");
|
||||
@ -1667,6 +1669,14 @@ void parse_parameters (int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp (argv[i],"-tcpdesc")==0 && i<argc-1)
|
||||
{
|
||||
ccx_options.tcp_desc = argv[i + 1];
|
||||
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
fatal (EXIT_INCOMPATIBLE_PARAMETERS, "Error: Parameter %s not understood.\n", argv[i]);
|
||||
// Unrecognized switches are silently ignored
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user