Commit Graph

21 Commits

Author SHA1 Message Date
wm4 caf228b218 player: make external subtitle auto-loading stricter
By default --sub-auto uses "exact". This was far from an "exact" match,
because it added anything that started with the video filename (without
extension), and seemed to end in something that looked like a language
code.

Make this stricter. "exact" still tolerate a language code, but the
video's filename must come before it without any unknown extra
characters. This may not load subtitles in some situations where it
previously did, and where the user might think that the naming
convention is such that it should be considered an exact match.

The subtitle priority sorting seems a bit worthless. I suppose it may
have some value in higher "fuzz" modes (like --sub-auto=fuzzy).

Also remove the mysterious "prio += prio;" line. I probably shouldn't
have checked, but it goes back to commit f16fa9d31 (2003), where someone
wanted to "refine" the priority without changing the rest of the code or
something.

Mostly untested, so have fun.

Fixes: #7702
2020-05-09 23:31:33 +02:00
Guido Cella 6d90517275 external_files: add .lrc subtitle extension 2019-09-02 01:25:43 +03:00
wm4 f8ab59eacd player: get rid of mpv_global.opts
This was always a legacy thing. Remove it by applying an orgy of
mp_get_config_group() calls, and sometimes m_config_cache_alloc() or
mp_read_option_raw().

win32 changes untested.
2018-05-24 19:56:35 +02:00
wm4 a721dac601 player: make track language matching case insensitive
There is no reason not to do this, and probably saves the user some
trouble.

Mostly untested.

Closes #5272.
2017-12-23 15:14:13 -07:00
wm4 d5dae869c6 player: match subtitles with language tags with --sub-auto=exact
Apparently a relatively widespread convention, and almost as strict as
the old "exact" semantics. (So it's not going to auto load radically
unrelated files.)
2017-11-27 19:45:13 +01:00
wm4 fd135cf73e player: readd smi subtitle extension
Fixes #4626. Previously removed because the original smi entry was added
by someone who did not agree to LGPL relicensing. I'm not sure if the
original change was copyrightable, but this commit for sure does not
fall under that author's copyright.
2017-08-08 11:37:04 +02:00
wm4 5bfbe6dfde external_files: change license to LGPL
While we could easily ifdef-out this file for a LGPL core, it's still
annoying, and also the only GPL file remaining in player/ that is not
based on mplayer.c.

This file originates from subreader.c. It's not clear whether the
original author of it gave us permission to relicense to LGPL (he
probably did, but without further clarification it's sort of ambiguous),
but the subtitle file search code was written by other authors anyway
(see 7eef93819f).

One contribution (574eb892ea) is a bit of a corner case, as
test_ext_list() now does a bstrcasecmp(). But I don't think the
copyright remains here. (I asked the author anyway, just in case. But
I didn't wait for the answer.)

In some other cases, contributors who could not be reached added some
subtitle extensions. I don't think those are copyrightable on their own,
but I dropped them anyway just to be sure.
2017-06-20 14:22:10 +02:00
rr- 1a25f8c9fb
external_files: parse ~ in --{sub,audio}-paths 2017-05-31 13:10:34 +01:00
wm4 a5f54209c0 external_files.c: add GPL header
It's been missing since mplayer2 times, not sure why. It originates from
subreader.c. No analysis on whether it can be relicensed to LGPL was
done yet.
2017-04-21 13:33:51 +02:00
Ricardo Constantino d2fcca7ad0
external_files: enable autoloading with URLs
Closes #3264
2017-04-01 15:42:42 +01:00
Ricardo Constantino 5f0c7df598
external_files: actually try to autoload from fallback paths
The 'sub' and 'audio' configuration subdirectories are supposed to
be fallbacks for sub-paths and audio-file-paths respectively, but
they weren't being scanned even if they existed.
2017-04-01 15:42:39 +01:00
wm4 50991fac81 sub: remove .txt as text subtitle extension
If used with fuzzy matching, the player tends to pick up random text
files, sometimes with interesting results.

The most interesting interaction is when the user uses
--log-file=something.txt, and mpv tries to open its own log file. It
essentially "freezes" during probing, because every time it reads from
it, it will write some more data, which in turn will cause more data to
be read - until the 2MB max. probing size is slowly reached. This is not
even an obscure corner case, but happened to multiple users.

The .txt extension has been considered a subtitle extension ever since
the code was added to MPlayer's subreader.c, but I'm not seeing many
actual subtitle files with this extension, so just get rid of it.
2017-02-03 11:32:16 +01:00
Akemi 8bbdecea83 osx: consistent normalisation when searching for external files
several unicode characters can be encoded in two different ways, either
in a precomposed (NFC) or decomposed (NFD) representation. everywhere
besides on macOS, specifically HFS+, precomposed strings are being used.
furthermore on macOS we can get either precomposed or decomposed
strings, for example when not HFS+ formatted volumes are used. that can
be the case for network mounted devices (SMB, NFS) or optical/removable
devices (UDF). this can lead to an inequality of actual equal strings,
which can happen when comparing strings from different sources, like the
command line or filesystem. this makes it mainly a problem on macOS
systems.

one case that can potential break is the sub-auto option. to prevent
that we convert the search string as well as the string we search in to
the same normalised representation, specifically we use the decomposed
form which is used anywhere else.

this could potentially be a problem on other platforms too, though the
potential of occurring is very minor. for those platforms we don't
convert anything and just fallback to the input.

Fixes #4016
2017-02-02 16:21:04 +01:00
wm4 ccf2b302cf player: add .scc subtitle extension
Requested. Supposedly "scenarist closed captions".

(The list of getting quite full. But it's probably still better than
trying to probe the files by contents, because the external subtitle
loader code will initially look at _all_ files in the same directory as
the main file.)
2017-01-31 14:50:58 +01:00
wm4 b18a598444 ta: remove old and redundant macro 2016-05-17 10:53:14 +02:00
Martin Herkt a4168d85ab
player: add wv to list of external audio file extensions 2016-03-26 18:24:07 +01:00
wm4 7dff6a2842 player: fix previous commit
OK, this made the --sub-paths and --audio-file-paths synonyms, which is
not what we wanted. Actually restrict the type of file loaded as well.

Really fixes #2632.
2015-12-25 13:40:06 +01:00
wm4 0710ced079 options: add --audio-file-paths
Requested. It works like --sub-paths. This will also load audio files
from a "audio" sub directory in the config file (because the same code
as for subtitles is used, and it also had such a feature).

Fixes #2632.
2015-12-25 13:17:11 +01:00
Kevin Mitchell 434512827f external_files: deduplicate bstr functions 2015-11-09 22:41:19 -08:00
wm4 c855ab5624 player: add wav to list of external audio file extensions
Fixes #2378.
2015-10-04 19:48:58 +02:00
wm4 8782354e6d player: rename and move find_subfiles.c
This was in sub/, because the code used to be specific to subtitles. It
was extended to automatically load external audio files too, and moving
the file and renaming it was long overdue.
2015-09-20 18:05:06 +02:00