Skip to content

Commit

Permalink
Add "require_prior_scripts" option to allow for running only when pri…
Browse files Browse the repository at this point in the history
…or scripts succeed

Fixes issue #6
  • Loading branch information
natemccurdy committed Jan 5, 2023
1 parent 9ba1ee1 commit c985525
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NZBGet script to update Kodi's video library
* [host] => The IP address or resolvable hostname that Kodi is listening on.
* [port] => The port that Kodi is listening on for HTTP requests.
* [force_update] => Whether or not we should always try to his the API.
* [require_prior_scripts] => Whether or not prior scripts must succeed before updating Kodi.

## Limitations

Expand Down
16 changes: 16 additions & 0 deletions update_kodi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
# always try to hit the API, set this to 'yes'.
#force_update=no

# Require previous scripts to succeed before updating Kodi (yes, no).
#
# Setting this to 'yes' will check the exit status of all prior extension
# scripts. If any of them failed, Kodi will not be updated. This is useful when
# used in combination with VideoSort. For example, if VideoSort fails, there's
# no need to update Kodi. When this is set to 'yes', make sure to order this
# extension after VideoSort.
#require_prior_scripts=no
#
### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################

Expand Down Expand Up @@ -71,6 +80,13 @@ if [[ $NZBPP_TOTALSTATUS != SUCCESS ]]; then
exit $SKIP
fi

if [[ $NZBPO_REQUIRE_PRIOR_SCRIPTS == yes ]]; then
if [[ $NZBPP_SCRIPTSTATUS != SUCCESS ]]; then
echo "[WARNING] Prior extension scripts did not succeed; skipping update."
exit $SKIP
fi
fi

if [[ $NZBPO_FORCE_UPDATE == no ]]; then
if kodi_is_local && ! kodi_is_running_locally; then
echo "[DETAIL] Kodi is not running so we can't update it; skipping update."
Expand Down

0 comments on commit c985525

Please sign in to comment.