{"id":13835373,"url":"https://github.com/pzim-devdata/mpv-scripts","last_synced_at":"2025-03-17T13:31:28.963Z","repository":{"id":177353614,"uuid":"658153947","full_name":"pzim-devdata/mpv-scripts","owner":"pzim-devdata","description":"LUA script to automatically not selecting FORCED subtitle at start","archived":false,"fork":false,"pushed_at":"2024-04-30T18:25:14.000Z","size":46,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T12:07:31.693Z","etag":null,"topics":["lua","mpv","mpv-script","mpv-scripts","subtitles"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pzim-devdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-25T00:09:54.000Z","updated_at":"2025-03-10T22:48:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"fbabeed9-bb9e-49e4-b26e-78fcbb3d2f4d","html_url":"https://github.com/pzim-devdata/mpv-scripts","commit_stats":null,"previous_names":["pzim-devdata/mpv-scripts"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fmpv-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fmpv-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fmpv-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fmpv-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pzim-devdata","download_url":"https://codeload.github.com/pzim-devdata/mpv-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244041526,"owners_count":20388257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","mpv","mpv-script","mpv-scripts","subtitles"],"created_at":"2024-08-04T14:01:00.554Z","updated_at":"2025-03-17T13:31:28.362Z","avatar_url":"https://github.com/pzim-devdata.png","language":"Lua","readme":"# mpv-sub_not_forced_not_sdh\nThis is a LUA script for MPV that automatically prevents the selection of FORCED and SDH subtitles at the start.\n- Forced subtitles are subtitles that are displayed only for sections of the video that contain non-dialogue elements such as signs, captions, or foreign language translations.\n- SDH means Subtitles for the Deaf or Hard of Hearing.\n\n\n[![GitHub license](https://img.shields.io/github/license/pzim-devdata/mpv-scripts?style=plastic)](https://github.com/pzim-devdata/mpv-scripts/blob/main/LICENSE)    ![GitHub issues](https://img.shields.io/github/issues/pzim-devdata/mpv-scripts?style=plastic)    [](https://github.com/pzim-devdata/mpv-scripts/issues)    ![GitHub repo size](https://img.shields.io/github/repo-size/pzim-devdata/mpv-scripts?style=plastic)    [![Visits Badge](https://badges.strrl.dev/visits/pzim-devdata/mpv-scripts)](https://badges.strrl.dev)    ![GitHub release (latest by date)](https://img.shields.io/github/v/release/pzim-devdata/mpv-scripts?style=plastic)    [![GitHub commits](https://img.shields.io/github/commits-since/pzim-devdata/mpv-scripts/v0.0.1.svg?style=plastic)](https://GitHub.com/pzim-devata/mpv-scripts/commit/) \n\n\n## Installation\nTo use this script, follow these steps:\n\n1. Locate the script directory for your operating system:\n\n| **OS** | **Location** |\n| --- | --- |\n| GNU/Linux or macOS | **`~/.config/mpv/scripts/`** |\n| Windows | **`C:/Users/Username/AppData/Roaming/mpv/scripts/`** |\n\n2. Download the `mpv-sub_not_forced_not_sdh.lua` file from this repository.\n\n[Download :inbox_tray:](https://github.com/pzim-devdata/mpv-scripts/releases/latest/download/mpv-scripts.zip)\n\n4. Extract the zip file and place the LUA script in the script directory mentioned in step 1.\n\n5. Make it executable (for Linux users): `chmod +x ~/.config/mpv/scripts/mpv-sub_not_forced_not_sdh.lua`\n\n6. Restart MPV or reload the scripts by pressing Shift + R while the player is running.\n\n7. You can modify the script to automatically play a specific langage:\n\n- For example, if you want the script to automatically play English subtitles but exclude the FORCED and SDH ones, you can make the following modification to line #4:\n\n`if sub.type == \"sub\" and not sub.forced and (sub.title == nil or not sub.title:find(\"SDH\") and not string.lower(sub.title):find(\"force\"))`\n\nReplace it with:\n\n`if sub.type == \"sub\" and sub.lang:find(\"en\") and not sub.forced and (sub.title == nil or not sub.title:find(\"SDH\") and not string.lower(sub.title):find(\"force\"))`\n\nBy adding the additional condition sub.lang:find(\"en\"), you are checking if the subtitle language matches \"en\" (for English). This modification ensures that only English subtitles that are not FORCED and do not contain \"SDH\" in their title will be automatically selected.\n\n8. You can also modify the script to not play any subtitile if a specific audio langage is already selected:\n\n- For example, if you want the LUA script to not play English subtitles when selected audio is set to English :\n\nAdd at the end of the LUA script:\n\n```\nfunction disableSubtitles()\n    mp.set_property(\"sub-visibility\", \"no\")\nend\n\nfunction checkTitleChange(name, value)\n    local audioLanguage = mp.get_property(\"audio-language\")\n    if value ~= nil and (audioLanguage and audioLanguage:lower():find(\"en\")) then\n            mp.register_event(\"playback-restart\", disableSubtitles)\n    end\nend\n\nmp.observe_property(\"media-title\", \"string\", checkTitleChange)\n```\n\nPlease make sure to understand the consequences of this modification and adjust it according to your specific needs.\n\n## Usage\nOnce the script is installed, it will automatically prevent the selection of FORCED and SDH subtitles when you start playing a video with MPV. Forced subtitles are subtitles that are displayed only for sections of the video that contain non-dialogue elements such as signs, captions, or foreign language translations.\nSDH means Subtitles for the Deaf or Hard of Hearing.\n\nWith this script, you no longer have to manually disable forced subtitles every time you start playing a video.\n\n## Contributing\nIf you have any suggestions, bug reports, or would like to contribute to this project, feel free to open an issue or submit a pull request on the GitHub repository.\n\n## License\nThis script is licensed under the [MIT License](https://github.com/pzim-devdata/mpv-scripts/blob/main/LICENSE).\n\n## Acknowledgments\nSpecial thanks to the MPV community for their support and the development of this script.\n\n## Disclaimer\nThis script is provided as-is without any warranty. Use it at your own risk.\n","funding_links":[],"categories":["Subtitle"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzim-devdata%2Fmpv-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpzim-devdata%2Fmpv-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzim-devdata%2Fmpv-scripts/lists"}