summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2020-01-18 22:39:08 +0000
committerwm4 <1387750+wm4@users.noreply.github.com>2020-01-26 14:28:31 +0100
commit1ae17074bd38bb16ff65c5d412241f8fe5f72faa (patch)
treea2ab45b5974dd7c7069226033489fa02c76fa170
parentb316534902fbbd2832cf340935f3e182f8a50af7 (diff)
downloadmpv-1ae17074bd38bb16ff65c5d412241f8fe5f72faa.tar.bz2
mpv-1ae17074bd38bb16ff65c5d412241f8fe5f72faa.tar.xz
player: check if file is URL before attempting to get mtime
I noticed an oversight when using ytdl-hook -- if the path is a URL, we try to `stat()` it, which obviously doesn't work. To mitigate that, don't check or update mtimes for URLs.
-rw-r--r--player/configfiles.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/player/configfiles.c b/player/configfiles.c
index 95fa5938e0..bf27641954 100644
--- a/player/configfiles.c
+++ b/player/configfiles.c
@@ -319,7 +319,8 @@ static void write_redirect(struct MPContext *mpctx, char *path)
fclose(file);
}
- if (mpctx->opts->position_check_mtime && !copy_mtime(path, conffile))
+ if (mpctx->opts->position_check_mtime &&
+ !mp_is_url(bstr0(path)) && !copy_mtime(path, conffile))
MP_WARN(mpctx, "Can't copy mtime from %s to %s\n", path, conffile);
talloc_free(conffile);
@@ -381,6 +382,7 @@ void mp_write_watch_later_conf(struct MPContext *mpctx)
fclose(file);
if (mpctx->opts->position_check_mtime &&
+ !mp_is_url(bstr0(cur->filename)) &&
!copy_mtime(cur->filename, conffile))
{
MP_WARN(mpctx, "Can't copy mtime from %s to %s\n", cur->filename,
@@ -428,7 +430,8 @@ void mp_load_playback_resume(struct MPContext *mpctx, const char *file)
return;
char *fname = mp_get_playback_resume_config_filename(mpctx, file);
if (fname && mp_path_exists(fname)) {
- if (mpctx->opts->position_check_mtime && !check_mtime(file, fname)) {
+ if (mpctx->opts->position_check_mtime &&
+ !mp_is_url(bstr0(file)) && !check_mtime(file, fname)) {
talloc_free(fname);
return;
}