dyphire / dyphire/mpv-scripts

chapter-make-read.lua accepts chapter filenames with 2 or 3 letter language codes

Open
#16 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
126
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Imagine this file structure

video.mp4           # Video file
video.chp           # Chapter file, language neutral
video.mp4.chp       # Chapter file, language neutral, video suffix included
video.chi.chp       # Chinese chapter file, 3-letter code (ISO 639‑3), 
video.en.chp        # English chapter file, 2-letter code (ISO 639‑1)
video.spa.chp       # Spanish chapter file, 3-letter code (ISO 639‑3)
video FR.chp        # French chapter file, 2-letter code (ISO 639‑1) at the end of the file name without a dot

Detection

  • If we have #15 then the .chp file can also be associated to the video file without the video file suffix.
  • The language code can be identified if immediately before the .chp, in lowercase, uppercase, prefixed by a non-alphanumeric character, so dot, space or also hyphen, etc. See mpv option --options-sub-auto

Utilization

  • If there is only one chapter file, then use it right away, no questions asked.
  • If there are chapter files available in different languages then
    • in v1 the script chooses according to the mpv Track Selection preferences:
      • Already offers --alang (audio) , --vlang (video), --slang (subtitles), so you could introduce --clang (chapters)
      • If no --clang is present it uses --slang: If you can read the subtitles in that language, you can also read the chapters in that language.
      • For some obscure reasons you may want the original language chapter names (e.g. for reference) but nevertheless watch in your preferred subtitle language.
    • in v2 the script may allows to switch languages interactively (like subtitles already can)
    • in v3 the script may allows to switch language interactively in tandem with the subtitle files if you have exactly the same set of chapter languages and subtitles languages in total (from the video file stream and/or loaded from sidecar files)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with chapter-make-read.lua and compare its filename detection with mpv's --options-sub-auto behavior. Clarify which version of language selection is in scope, then define completion around recognizing two- and three-letter language codes and selecting among chapter files according to the chosen mpv preferences.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.