History

command: add current-watch-later-dir property

It will be used in the next commit.

Guido Cella committed 1 year ago

Commit b530b401 parent 0c3c4a35 files · +16 −1Browse files

Unified · Split

5 files
  1. DOCS/interface-changes/current-watch-later-dir.txt +1 −0
  2. DOCS/man/input.rst +5 −0
  3. player/command.c +8 −0
  4. player/configfiles.c +1 −1
  5. player/core.h +1 −0
DOCS/interface-changes/current-watch-later-dir.txt+1−0
@@ -0,0 +1 @@
1+add `current-watch-later-dir` property
DOCS/man/input.rst+5−0
@@ -3753,6 +3753,11 @@ Property list · 3752 unmodified lines
37533753 The working directory of the mpv process. Can be useful for JSON IPC users,
37543754 because the command line player usually works with relative paths.
37553755
3756+``current-watch-later-dir``
3757+ The directory in which watch later config files are stored. This returns
3758+ ``--watch-later-dir``, or the default directory if ``--watch-later-dir`` has
3759+ not been modified, with tilde placeholders expanded.
3760+
37563761 ``protocol-list``
37573762 List of protocol prefixes potentially recognized by the player. They are
37583763 returned without trailing ``://`` suffix (which is still always required).
player/command.c+8−0
@@ -3528,6 +3528,13 @@ static int mp_property_cwd(void *ctx, struct m_property *prop, · 3527 unmodified lines
35283528 return M_PROPERTY_NOT_IMPLEMENTED;
35293529 }
35303530
3531+static int mp_property_current_watch_later_dir(void *ctx, struct m_property *prop,
3532+ int action, void *arg)
3533+{
3534+ MPContext *mpctx = ctx;
3535+ return m_property_strdup_ro(action, arg, mp_get_playback_resume_dir(mpctx));
3536+}
3537+
35313538 static int mp_property_protocols(void *ctx, struct m_property *prop,
35323539 int action, void *arg)
35333540 {
@@ -4388,6 +4395,7 @@ static const struct m_property mp_properties_base[] = { · 854 unmodified lines
43884395 {"ambient-light", mp_property_ambient_light},
43894396
43904397 {"working-directory", mp_property_cwd},
4398+ {"current-watch-later-dir", mp_property_current_watch_later_dir},
43914399
43924400 {"protocol-list", mp_property_protocols},
43934401 {"decoder-list", mp_property_decoders},
player/configfiles.c+1−1
@@ -197,7 +197,7 @@ static bool copy_mtime(const char *f1, const char *f2) · 196 unmodified lines
197197 return true;
198198 }
199199
200−static char *mp_get_playback_resume_dir(struct MPContext *mpctx)
200+char *mp_get_playback_resume_dir(struct MPContext *mpctx)
201201 {
202202 char *wl_dir = mpctx->opts->watch_later_dir;
203203 if (wl_dir && wl_dir[0]) {
player/core.h+1−0
@@ -510,6 +510,7 @@ void audio_start_ao(struct MPContext *mpctx); · 509 unmodified lines
510510 void mp_parse_cfgfiles(struct MPContext *mpctx);
511511 void mp_load_auto_profiles(struct MPContext *mpctx);
512512 bool mp_load_playback_resume(struct MPContext *mpctx, const char *file);
513+char *mp_get_playback_resume_dir(struct MPContext *mpctx);
513514 void mp_write_watch_later_conf(struct MPContext *mpctx);
514515 void mp_delete_watch_later_conf(struct MPContext *mpctx, const char *file);
515516 struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t