Use Jellyfin API to get current version

This commit is contained in:
Jeremy Gardais 2021-07-02 17:24:50 +02:00
parent 91b9699b69
commit 017963912e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@
### cf. https://git.101010.fr/gardouille-dotfiles/scripts/github/releasetags
# wget https://git.101010.fr/gardouille-dotfiles/scripts/raw/branch/master/github/releasetags
### 2. Create a cron job with Jellyfin URL as first argument, eg.
#00 20 * * * root /opt/repos/ipr.scripts/github/check_jellyfin_update https://jellyfin.domain.tld:port/web/index.html
#00 20 * * * root /opt/repos/ipr.scripts/github/check_jellyfin_update http://jellyfin.domain.tld:port/System/Info/Public
### 3. Monitor the temp file: /tmp/.github.jellyfin.upgrade
# Or enable MAILTO in cronjob and edit the script to print a message.
# Or send a mail.
@ -39,8 +39,8 @@ usage: $PROGNAME [-d|-f|-h|-u|]
Compare current version of an installed Jellyfin site and the last available.
EXAMPLE:
- Compare the current version installed on http://jellyfin.domain.tld:port/web/index.html
check.jellyfin.update http://jellyfin.domain.tld:port/web/index.html
- Compare the current version installed on http://jellyfin.domain.tld:port
check.jellyfin.update http://jellyfin.domain.tld:port/System/Info/Public
OPTIONS:
-f,--file
@ -98,7 +98,9 @@ define_vars() { # {{{
fi
## }}}
jellyfin_current_version=$(curl --silent "${jellyfin_url:=/dev/null}" | \grep -oP "(?<=Version=')[[:alnum:].]*")
## TODO: Use --no-progress-meter instead of --silent
## when curl 7.74.x will be available on Debian Stable
jellyfin_current_version=$(curl --silent "${jellyfin_url:=/dev/null}" | \grep -oP '(?<=Version":")[[:alnum:].]*')
jellyfin_new_version=$("${script_wd}"/releasetags "${jellyfin_repo_url}" | grep -vE -- '(dev|rc)' | head -n1 | sed 's/v//')
@ -123,7 +125,7 @@ Create ${jellyfin_new_version_file} temp file to monitore."
else
debug_message "Test Jellyfin version \
The current version is up-to-date."
The current version (${jellyfin_current_version}) is up-to-date."
rm -f -- "${jellyfin_new_version_file}"
fi
## }}}