Skip to content

Commit

Permalink
ctbcap: add depend checks
Browse files Browse the repository at this point in the history
  • Loading branch information
KFERMercer committed Jan 2, 2025
1 parent 17b9cb7 commit cd50293
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ctbcap
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ utils() {
done
echo $(( RSEED % ( BNUM - SNUM ) + SNUM )) # Format Same as $((RANDOM)) in Bash.
;;
check_depend)
command -v "$2" 1>/dev/null 2>&1 || {
echo "(ERROR) Command [$2] not found! Check \$PATH or install it." >&2
return 1
}
return 0
;;
esac

}
Expand Down Expand Up @@ -569,10 +576,14 @@ watchdog() {

[ "${DEBUG_MODE}" = "1" ] && set -x # Debug Mode

utils check_depend curl || { echo >&2; exit 1; }

[ "${LINK_MODE}" = "1" ] && {
fetch_m3u && { echo; exit 0; } || { echo >&2; exit 1; }
}

utils check_depend ffmpeg || { echo >&2; exit 1; }

init_dir "${SAVE_PATH}" "${LOG_PATH}" || { echo >&2; exit 1; }

[ "${EDGING_MODE}" = "1" ] && edging
Expand Down

0 comments on commit cd50293

Please sign in to comment.