sachac / subed

subed is a subtitle editor for Emacs
179 stars 16 forks source link

subed-guess-video-file: Handle language name in subtitle file name #5

Closed i-blis closed 5 years ago

i-blis commented 5 years ago

Most video player (including mpv) handle language name or code in subtitle filename before the .srt extension. Given a video file myfile.mp4, mpv will load all subtitle files of the form myfile.english.srt or myfile.srt.

Subed could likewise try to strip both the .srt and an eventual language code extension before that, if merely stripping the .str extension is not enough to find a corresponding video file. That is, given a subtitle file named myfile.english.srt, it could try to find both myfile.english.mp4 and myfile.mp4 for instance.

I changed subed-guess-video-file to implement that behaviour. The cost is very low and besides freeing the user from manually loading the video file, it provides an expected behaviour.

Needless to say, I won't be bothered if you decided not to merge it.

rndusr commented 5 years ago

That's useful. Thanks.

I expanded the docstring a bit to explain better what actually happens regarding the language.