Browse Source

Added a config-file

master
Elis Axelsson 6 years ago
parent
commit
b97d6115eb
Signed by: etu GPG Key ID: D57EFA625C9A925F
  1. 38
      README.md
  2. 10
      mkvtrackcleaner

38
README.md

@ -49,6 +49,38 @@ or like this:
./mkvtrackcleaner /path/to/file.mkv
```
# TODO
Make some kind of config-file to avoid having to edit the file to set
languages.
# Configfile
The config is a simple bash-script that the script sources, it allows
you to override some variables.
Put the configfile in `$XDG_CONFIG_DIR/mkvtrackcleaner.conf` which by
default is `$HOME/.config/mkvtrackcleaner.conf`.
So, for example if you want to extend the `WANTED_LANGS` list you could
have a file that looks like this (to add norwegian):
```bash
WANTED_LANGS+=(
"nor"
)
```
Or you can just override the entire list and roll your own:
```bash
WANTED_LANGS=(
"und"
"eng"
)
```
Variables that's possible to alter includes:
- `$WANTED_LANGS` -- Array with wanted languages in three letter codes.
- `$MKVMERGE` -- Path to the `mkvmerge` binary.
- `$PRINTF` -- Path to the `printf` binary.
- `$FIND` -- Path to the `find` binary.
- `$GREP` -- Path to the `grep` binary.
- `$SED` -- Path to the `sed` binary.
- `$CUT` -- Path to the `cut` binary.
- `$WC` -- Path to the `wc` binary.
- `$GREP_MATCH_AUDIO` -- Regex to match audio tracks.
- `$GREP_MATCH_SUBS` -- Regex to match subtitle tracks.
- `$SED_EXTRACT_INFO` -- Regex to extract info about a track.

10
mkvtrackcleaner

@ -33,6 +33,16 @@ GREP_MATCH_SUBS='Track ID (\d*): subtitles .* \[.*language:([^\s]+).*'
SED_EXTRACT_INFO='s/Track ID ([0-9]*): .*language:(...).*/\1\t\2/'
###
# Read config file
##
CONFIG_FILE=$(echo ${XDG_CONFIG_DIR:-$HOME/.config/}mkvtrackcleaner.conf)
if test -f $CONFIG_FILE; then
source $CONFIG_FILE
fi
###
# Wrapper to do cleaning of files
##

Loading…
Cancel
Save