summaryrefslogtreecommitdiff
path: root/makemkv/makemkv-wrapper
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-04-21 20:22:14 +0000
committerB Stack <bgstack15@gmail.com>2019-04-21 20:22:14 +0000
commit4bca5327192eb339e0a4c9550d7fc3446be91306 (patch)
treeec8ae93b24275719a32502c54b5839bc97a3dc7b /makemkv/makemkv-wrapper
parentMerge branch 'waterfox-rpm' into 'master' (diff)
downloadstackrpms-4bca5327192eb339e0a4c9550d7fc3446be91306.tar.gz
stackrpms-4bca5327192eb339e0a4c9550d7fc3446be91306.tar.bz2
stackrpms-4bca5327192eb339e0a4c9550d7fc3446be91306.zip
add makemkv and ccextractor
Diffstat (limited to 'makemkv/makemkv-wrapper')
-rwxr-xr-xmakemkv/makemkv-wrapper45
1 files changed, 45 insertions, 0 deletions
diff --git a/makemkv/makemkv-wrapper b/makemkv/makemkv-wrapper
new file mode 100755
index 0000000..66e8050
--- /dev/null
+++ b/makemkv/makemkv-wrapper
@@ -0,0 +1,45 @@
+#!/bin/sh
+# File: /usr/bin/makemkv-wrapper
+# Author: bgstack15
+# Startdate: 2019-02
+# Title: Wrapper for MakeMKV
+# Purpose: To adjust time so MakeMKV will work with a specific keycode
+# Package: makemkv from stackrpms
+# History:
+# Usage:
+# Reference:
+# Improve:
+# Detect if chronyc or ntpdate and use which one is available. Prefer ntpdate.
+# Documentation:
+# Dependencies:
+# systemctl, ntpdate, ntpd | chronyd, makemkv, bup (bgscripts-core), date, cp
+
+# verify dependencies
+test ! -e "$( sudo which ntpdate )" && { echo "need ntpdate. Aborted." ; exit 1 ; }
+
+# vars
+MW_GOODDATE="2019-02-27 13:38:55"
+MW_NTPSERVICE="$( sudo systemctl list-units | awk '/ntp|chrony/{print $1}' | head -n1 )"
+MW_GOOD_KEYFILE="$( find /usr/share/doc -ipath '*/makemkv/*' -name 'settings.conf.example' )"
+MW_KEYFILE=~/.MakeMKV/settings.conf
+
+# change date to known good date
+MW_currentdate="$( date '+%F %T' )"
+sudo systemctl stop "${MW_NTPSERVICE}"
+sudo date -s "${MW_GOODDATE}"
+
+# copy in valid key for the date in question
+# ensure directory exists, just in case this is first run
+mkdir -p "$( dirname "${MW_KEYFILE}" )"
+diff -q "${MW_KEYFILE}" "${MW_GOOD_KEYFILE}" 1>/dev/null 2>&1 || bup "${MW_KEYFILE}"
+/bin/cp -pf "${MW_GOOD_KEYFILE}" "${MW_KEYFILE}"
+
+# run application and wait for it to observe the time
+makemkv &
+echo "Press enter in this terminal to set clock back to correct time. Do this when you have already started the dvd export."
+read foo
+
+# restore original date
+sudo date -s "${MW_currentdate}"
+sudo ntpdate dns1
+sudo systemctl start "${MW_NTPSERVICE}"
bgstack15