Skip to content

Commit 19ea069

Browse files
committed
subselect: use robust path for loading subselect.py
1 parent 885b9bd commit 19ea069

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,19 @@ Right now it only lists subtitles from OpenSubtitles, but has the ability to sea
3939
3. Install subliminal: `python -m pip install subliminal` should do the trick
4040

4141
### Installation
42-
Copy the subselect folder containing main.lua and subselect.py into your script folder
42+
Copy the `subselect` folder containing `main.lua` and `subselect.py` into your script folder. If you have previous installations of subselect where it was not inside the subselect sub folder, remove them.
4343

4444
### Configuration
4545
Changing the configuration is optional. Options:
4646
* *down_dir*: set the download path for the subtitles
47-
* *subselect_path*: set the subselect.py path
4847
* *sub_language*: set language for subtitles [default english]; value is a 3-letter ISO-639-3 language code
4948

50-
Per default the script tries to download the subtitles into the folder from where the video is being played. Is that not possible it downloads them into your HOME folder, or in Windows into your Downloads folder. You may have to set the subselect.py path manually if the script guesses the wrong mpv configuration directory. If the script is somehow not working as expected, it is recommended to set both *down_dir* and *subselect_path* and make sure they are absolute paths and do exist.
49+
Per default the script tries to download the subtitles into the folder from where the video is being played. Is that not possible it downloads them into your HOME folder, or in Windows into your Downloads folder. You may have to set the subselect.py path manually if the script guesses the wrong mpv configuration directory. If the script is somehow not working as expected, it is recommended to set *down_dir* and make sure it's an absolute path and does exist.
5150

52-
The option to be changed can be put inside a `subselect.conf` file in the lua-settings folder. Create them if they don't exist.
51+
The option to be changed can be put inside a `subselect.conf` file in the `script-opts` folder. Create them if they don't exist.
5352
Sample `subselect.conf` if you want to change all options:
5453
```
5554
down_dir=C:\Users\<me>\subtitles
56-
subselect_path=C:\Users\<me>\python_scripts\subselect.py
5755
sub_language=deu
5856
```
5957

subselect/main.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ require 'mp.options'
44
options = {}
55
options.down_dir = ""
66
options.sub_language = "eng"
7+
options.subselect_path = utils.join_path(mp.get_script_directory(), "subselect.py")
78

89
if package.config:sub(1,1) == "/" then
9-
options.subselect_path = utils.join_path(os.getenv("HOME"), ".config/mpv/scripts/subselect.py")
1010
ops = "unix"
1111
else
12-
options.subselect_path = utils.join_path(os.getenv("APPDATA"), "mpv\\scripts\\subselect.py")
1312
ops = "win"
1413
end
1514

0 commit comments

Comments
 (0)