aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ricardo Constantino <wiiaboo@gmail.com>2017-03-31 19:48:06 +0100
committerGravatar Ricardo Constantino <wiiaboo@gmail.com>2017-04-01 15:42:42 +0100
commitd2fcca7ad086822dfd06332c67f0bd1555fd4aaf (patch)
tree4e0faa1e1ab236f8369406eafcd0885e18ea449d
parent5f0c7df598602fc779b255a6c29297b4df2b6cf1 (diff)
external_files: enable autoloading with URLs
Closes #3264
-rw-r--r--DOCS/man/options.rst2
-rw-r--r--player/external_files.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index f6f3e98472..4066e606df 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1824,6 +1824,8 @@ Subtitles
Multiple directories can be separated by ":" (";" on Windows).
Paths can be relative or absolute. Relative paths are interpreted relative
to video file directory.
+ If the file is a URL, only absolute paths and ``sub`` configuration
+ subdirectory will be scanned.
.. admonition:: Example
diff --git a/player/external_files.c b/player/external_files.c
index baa59e9c39..20dd8b0ebd 100644
--- a/player/external_files.c
+++ b/player/external_files.c
@@ -96,9 +96,6 @@ static void append_dir_subtitles(struct mpv_global *global,
struct MPOpts *opts = global->opts;
struct mp_log *log = mp_log_new(tmpmem, global->log, "find_files");
- if (mp_is_url(bstr0(fname)))
- goto out;
-
struct bstr f_fbname = bstr0(mp_basename(fname));
struct bstr f_fname = mp_iconv_to_utf8(log, f_fbname,
"UTF-8-MAC", MP_NO_LATIN1_FALLBACK);
@@ -114,6 +111,10 @@ static void append_dir_subtitles(struct mpv_global *global,
// 2 = any sub file containing movie name
// 3 = sub file containing movie name and the lang extension
char *path0 = bstrdup0(tmpmem, path);
+
+ if (mp_is_url(bstr0(path0)))
+ goto out;
+
DIR *d = opendir(path0);
if (!d)
goto out;