screenshot: avoid confusing template error message with no file

Previously, with mpv --force-window=yes --idle=yes --screenshot-template="%f",
mpv would display an error saying that the template was incorrect, which it
isn't, there's just no file to put in the format. In this case, just use the
string "NO_FILE".
This commit is contained in:
Kevin Mitchell 2015-09-01 19:41:16 -07:00 committed by wm4
parent eabc530945
commit a8e6de90fe
1 changed files with 11 additions and 9 deletions

View File

@ -165,15 +165,17 @@ static char *create_fname(struct MPContext *mpctx, char *template,
}
case 'f':
case 'F': {
if (!mpctx->filename)
goto error_exit;
char *video_file = mp_basename(mpctx->filename);
if (video_file) {
char *name = video_file;
if (fmt == 'F')
name = stripext(res, video_file);
append_filename(&res, name);
}
char *video_file = NULL;
if (mpctx->filename)
video_file = mp_basename(mpctx->filename);
if (!video_file)
video_file = "NO_FILE";
char *name = video_file;
if (fmt == 'F')
name = stripext(res, video_file);
append_filename(&res, name);
break;
}
case 'x':