From 82317593e9bc5bd3d7d35ae96ef777ccf801a81c Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 12 Dec 2014 23:57:49 +0100 Subject: options: add option for ignoring patch in resume mechanism Whatever. Fixes #1281. --- DOCS/man/options.rst | 3 +++ options/options.c | 1 + options/options.h | 1 + player/configfiles.c | 12 ++++++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 412d4d355d..3cca6c3326 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -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=`` Show the description and content of a profile. diff --git a/options/options.c b/options/options.c index fb48c39e74..f1bdfde4f8 100644 --- a/options/options.c +++ b/options/options.c @@ -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), diff --git a/options/options.h b/options/options.h index c73764ceba..a2edf1bb79 100644 --- a/options/options.h +++ b/options/options.h @@ -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; diff --git a/player/configfiles.c b/player/configfiles.c index a18facad6d..0de1a7ba76 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -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); -- cgit v1.2.3