Re-add makemkv-launch script

* Set ccextractor path if unset. Fixes #11
* Set default save path to `$HOME/movies`. Fixes #10

Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com>
This commit is contained in:
Daniel Llewellyn
2021-02-01 02:19:51 +00:00
parent 27e45bc66c
commit e1fb9449a4
2 changed files with 35 additions and 1 deletions

32
scripts/makemkv-launch Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh -e
if [ ! -f $SNAP_USER_DATA/.MakeMKV/settings.conf ]; then
mkdir -p $SNAP_USER_DATA/.MakeMKV
cat > $SNAP_USER_DATA/.MakeMKV/settings.conf <<SEOF
#
# MakeMKV settings file, written by MakeMKV v1.14.5 linux(x64-release)
#
app_DestinationDir = "$SNAP_REAL_HOME/movies"
app_DestinationType = "2"
app_Java = "/snap/makemkv/current/usr/bin/java"
app_Key = ""
app_PreferredLanguage = ""
app_ccextractor = "/snap/makemkv/current/usr/bin/ccextractor"
dvd_MinimumTitleLength = "300"
sdf_Stop = ""
SEOF
else
if grep -q 'app_DestinationDir = ""' $SNAP_USER_DATA/.MakeMKV/settings.conf; then
sed -i -E 's|(app_DestinationDir = )""|\1"'"$SNAP_REAL_HOME/movies"'"|' $SNAP_USER_DATA/.MakeMKV/settings.conf
fi
if grep -q 'app_Java = ""' $SNAP_USER_DATA/.MakeMKV/settings.conf; then
sed -i -E 's|(app_Java = )""|\1"/snap/makemkv/current/usr/bin/java"|' $SNAP_USER_DATA/.MakeMKV/settings.conf
fi
if grep -q 'app_ccextractor = ""' $SNAP_USER_DATA/.MakeMKV/settings.conf; then
sed -i -E 's|(app_ccextractor = )""|\1"/snap/makemkv/current/usr/bin/ccextractor"|' $SNAP_USER_DATA/.MakeMKV/settings.conf
fi
fi
exec $@

View File

@@ -64,6 +64,7 @@ apps:
command-chain:
- bin/desktop-launch
- bin/check-ld-cache
- bin/makemkv-launch
- bin/snapcraft-preload
desktop: usr/share/applications/makemkv.desktop
environment:
@@ -88,6 +89,7 @@ apps:
command: usr/bin/makemkvcon
command-chain:
- bin/check-ld-cache
- bin/makemkv-launch
- bin/snapcraft-preload
environment:
FINAL_BINARY: $SNAP/usr/bin/makemkvcon.real
@@ -259,7 +261,7 @@ parts:
snapcraftctl build
JDK=$(find /usr/lib/jvm -type d -name "java-11-openjdk-*" | head -n1 | xargs basename)
JDKBIN=../lib/jvm/$JDK/jre/bin
JDKBIN=../lib/jvm/$JDK/bin
for exec in java javaws jexec jjs; do
ln -sf $JDKBIN/$exec $SNAPCRAFT_PART_INSTALL/usr/bin/$exec
done