From 4bca5327192eb339e0a4c9550d7fc3446be91306 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 21 Apr 2019 20:22:14 +0000 Subject: add makemkv and ccextractor --- makemkv/makemkv-wrapper | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 makemkv/makemkv-wrapper (limited to 'makemkv/makemkv-wrapper') 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}" -- cgit