Merge pull request #679 from saurabhshri/print_usage

Changes regarding output file name and minor print_usage corrections.
This commit is contained in:
Carlos Fernandez Sanz 2017-02-06 11:09:37 -08:00 committed by GitHub
commit 6a90829744
5 changed files with 23 additions and 10 deletions

View File

@ -49,6 +49,14 @@ void sigint_handler(int sig)
exit(EXIT_SUCCESS);
}
void print_end_msg()
{
mprint("Issues? Open a ticket here\n");
mprint("https://github.com/CCExtractor/ccextractor/issues\n");
}
struct ccx_s_options ccx_options;
int main(int argc, char *argv[])
{
@ -434,14 +442,13 @@ int main(int argc, char *argv[])
if (!ret)
mprint("\nNo captions were found in input.\n");
mprint("Issues? Open a ticket here\n");
mprint("https://github.com/CCExtractor/ccextractor/issues\n");
print_end_msg();
if (show_myth_banner)
{
mprint("NOTICE: Due to the major rework in 0.49, we needed to change part of the timing\n");
mprint("code in the MythTV's branch. Please report results to the address above. If\n");
mprint("something is broken it will be fixed. Thanks\n");
}
return ret ? EXIT_OK : EXIT_NO_CAPTIONS;
}

View File

@ -770,10 +770,10 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg)
char *extension = NULL; // Input filename without the extension
#define check_ret(filename) if (ret != EXIT_OK) \
#define check_ret(filename) if (ret != EXIT_OK) \
{ \
print_error(cfg->gui_mode_reports,"Failed %s\n", filename); \
return ret; \
fatal(CCX_COMMON_EXIT_FILE_CREATION_FAILED,"Failed to open output file: %s\nDetails : %s\n", filename, strerror(errno)); \
return ret; \
}
if (cfg->cc_to_stdout == CCX_FALSE && cfg->send_to_srv == CCX_FALSE && cfg->extract == 12)
@ -817,6 +817,11 @@ static int init_output_ctx(struct encoder_ctx *ctx, struct encoder_cfg *cfg)
basefilename = get_basename(ctx->first_input_file);
extension = get_file_extension(cfg->write_format);
if (basefilename == NULL)
{
basefilename = get_basename("utitled");
}
if (cfg->extract == 12)
{
ret = init_write(&ctx->out[0], create_outfilename(basefilename, "_1", extension), cfg->with_semaphore);

View File

@ -151,6 +151,9 @@ struct lib_ccx_ctx
struct lib_ccx_ctx* init_libraries(struct ccx_s_options *opt);
void dinit_libraries( struct lib_ccx_ctx **ctx);
//ccextractor.c
void print_end_msg();
//params.c
int parse_parameters (struct ccx_s_options *opt, int argc, char *argv[]);
void print_usage (void);

View File

@ -298,10 +298,6 @@ void print_usage (void)
mprint (" -o outputfilename: Use -o parameters to define output filename if you don't\n");
mprint (" like the default ones (same as infile plus _1 or _2 when\n");
mprint (" needed and file extension, e.g. .srt).\n");
mprint (" -o or -o1 -> Name of the first (maybe only) output\n");
mprint (" file.\n");
mprint (" -o2 -> Name of the second output file, when\n");
mprint (" it applies.\n");
mprint (" -cf filename: Write 'clean' data to a file. Cleans means the ES\n");
mprint (" without TS or PES headers.\n");
mprint (" -stdout: Write output to stdout (console) instead of file. If\n");
@ -846,6 +842,7 @@ void print_usage (void)
mprint(" ccextractor video.mp4 -hardsubx -subcolor white -detect_italics \n");
mprint(" -whiteness_thresh 90 -conf_thresh 60\n");
mprint("\n");
mprint ("\n --version : Display current CCExtractor version and detailed information.\n");
}
unsigned char sha256_buf[16384];

View File

@ -265,6 +265,7 @@ void fatal(int exit_code, const char *fmt, ...)
fprintf(stderr, "\rError: ");
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
print_end_msg();
va_end(args);
exit(exit_code);
}