jlesage / docker-makemkv

Docker container for MakeMKV
MIT License
439 stars 50 forks source link

Easier update #32

Open camjac251 opened 5 years ago

camjac251 commented 5 years ago

Thank you for making these scripts. Updating broke for me a while back when a gist using lynx stopped working. I've simplified the update script to just one script now thanks to this person's https://github.com/AyrA/MakeMKV site https://cable.ayra.ch/makemkv/. It's very basic right now but could potentially be better.

This is what I use currently

#!/bin/sh

usage() {
    echo "usage: $(basename $0) KEY CONFIG_FILE

This script updates the MakeMKV configuration with the provided key.
"
}

KEY=$(wget -qO- https://cable.ayra.ch/makemkv/api.php?raw)

CONFIG_FILE=/path/to/.MakeMKV/settings.conf

# Get the current  key.
CUR_KEY="$(sed -n 's|^[ \t]*app_Key[ \t]*=[ \t]*"\(.*\)"[ \t]*$|\1|gp' "$CONFIG_FILE")"

# If not the same, update it.
if [ "$CUR_KEY" != "$KEY" ]; then
    echo "Updating registration key..."
    if grep -q '^app_Key ' "$CONFIG_FILE"; then
        sed -i "/^[ \t]*app_Key[ \t]*=/c\app_Key = \"$KEY\"" "$CONFIG_FILE"
    else
        echo "app_Key = \"$KEY\"" >> "$CONFIG_FILE"
    fi
else
    echo "Registration key already up-to-date."
fi

# vim: set ft=sh :

It could work better as a cronjob if it used api.php?json instead and saved a local file with the keydate and just checked to see if the two match, then it would know that the key is the same and doesn't need to be updated. And when they don't match then it could update.

jlesage commented 5 years ago

Sorry did you post your message to the right repository? This repository is for the Docker container of MakeMKV and beta key update is already automatically handled.

camjac251 commented 5 years ago

I found the scripts here https://github.com/jlesage/docker-makemkv/tree/master/rootfs/opt/makemkv/bin

This is the repo that the scripts exist on right? Or is the docker sourced from another repo?

jlesage commented 5 years ago

These scripts are used by the container to update the key. They are not generic scripts that can be used outside the container, or in a different context.

camjac251 commented 5 years ago

I was able to use them and amended an update above that uses the nice website someone made for retrieving the api code. Just thought I'd post it here in case someone came across this like I did.

jlesage commented 5 years ago

I agree that it's easier to use this service than parsing the web page. I was not sure to use it because this service is probably also parsing the web page. So if the web page changes and parsing need to be updated, we rely on a service for which we have no control. However, maybe it could be used as a backup source...