options: add option for ignoring patch in resume mechanism

Whatever.

Fixes #1281.
This commit is contained in:
wm4 2014-12-12 23:57:49 +01:00
parent 98e400216d
commit 82317593e9
4 changed files with 13 additions and 4 deletions

View File

@ -414,6 +414,9 @@ Program Behavior
This option may expose privacy-sensitive information and is thus
disabled by default.
``--ignore-path-in-watch-later-config``
Ignore path (i.e. use filename only) when using watch later feature.
``--show-profile=<profile>``
Show the description and content of a profile.

View File

@ -502,6 +502,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("resume-playback", position_resume, 0),
OPT_FLAG("save-position-on-quit", position_save_on_quit, 0),
OPT_FLAG("write-filename-in-watch-later-config", write_filename_in_watch_later_config, 0),
OPT_FLAG("ignore-path-in-watch-later-config", ignore_path_in_watch_later_config, 0),
OPT_FLAG("ordered-chapters", ordered_chapters, 0),
OPT_STRING("ordered-chapters-files", ordered_chapters_files, M_OPT_FILE),

View File

@ -167,6 +167,7 @@ typedef struct MPOpts {
int position_resume;
int position_save_on_quit;
int write_filename_in_watch_later_config;
int ignore_path_in_watch_later_config;
int pause;
int keep_open;
int audio_id;

View File

@ -179,10 +179,14 @@ static char *mp_get_playback_resume_config_filename(struct mpv_global *global,
const char *realpath = fname;
bstr bfname = bstr0(fname);
if (!mp_is_url(bfname)) {
char *cwd = mp_getcwd(tmp);
if (!cwd)
goto exit;
realpath = mp_path_join(tmp, bstr0(cwd), bstr0(fname));
if (opts->ignore_path_in_watch_later_config) {
realpath = mp_basename(fname);
} else {
char *cwd = mp_getcwd(tmp);
if (!cwd)
goto exit;
realpath = mp_path_join(tmp, bstr0(cwd), bstr0(fname));
}
}
if (bstr_startswith0(bfname, "dvd://"))
realpath = talloc_asprintf(tmp, "%s - %s", realpath, opts->dvd_device);