Skip to content

Commit

Permalink
ctbcap: optimize massages for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
KFERMercer committed Dec 30, 2024
1 parent f9cd72c commit db26e9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This Dockerfile will automatically compile ffmpeg with only necessary components.
# This Dockerfile will build a minimal FFmpeg tailored for ctbcap.
# By doing so, it will significantly reduce the size of final image. ( 140MB -> 18MB )
# Requires 1GB of free space on file system to build.
#
Expand Down
11 changes: 9 additions & 2 deletions ctbcap
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ doc() {
echo "the transmission of knowledge and information cannot"
echo "receive any perceived impediment."
echo
echo "Copyright (C) 2019- , KFERMercer <github.com/KFERMercer>."
echo "Copyright (C) 2019-, KFERMercer <github.com/KFERMercer>"
echo
echo "UA: ${UA}"
echo
Expand Down Expand Up @@ -304,7 +304,7 @@ utils() {
;;
# RE-Implement RANDOM NUM Tool on POSIX Shell (B/E).
random_num)
# Usage: ` utils random_num <SNUM> <BNUM> `
# Usage: `utils random_num <SNUM> <BNUM>`
local SNUM=$2 # INT. Must >= 0. Small-end of Random Num you want.
local BNUM=$3 # INT. Must < (2^32)/2. Big-end of Random Num you want.
local BNUM=$(( BNUM + 1 )) # Add ${BNUM} to the pool, make method become B/E Random.
Expand Down Expand Up @@ -352,6 +352,7 @@ edging() {
echo
}

# Core platform methods.
# Fetch ${STREAM_LINK_GENERIC} & ${STREAM_LINK}, show them & return 0.
# If no ${STREAM_LINK}, return 1.
# If Can't find chatroom at all, return 2.
Expand Down Expand Up @@ -468,6 +469,9 @@ grab_stream() {
echo
} >> ${FFMPEG_LOGFILE}

# Core FFmpeg method.
# After making any changes, must confirm the compatibility of tailored FFmpeg in Dockerfile.
#
# shellcheck disable=SC2046
ffmpeg \
-user_agent "${UA}" \
Expand Down Expand Up @@ -516,14 +520,17 @@ watchdog() {

rm -f "${LOG_PATH}/${MODEL}-${PLATFORM}.online" # Delete online flag file

# Too short time may cause the platform to enable CAPTCHA to you.
echo "[$(date "+%Y%m%d-%H%M%S")] Sleep for around 5 min & try reconnect..."
sleep $(utils random_num 240 360) # Random num B/E 240 - 360
;;
1)
# Too short time may cause the platform to enable CAPTCHA to you.
echo "[$(date "+%Y%m%d-%H%M%S")] Sleep for around 10 min..."
sleep $(utils random_num 480 720) # Random num B/E 480 - 720
;;
2)
# Too short time may cause the platform to enable CAPTCHA to you.
echo "[$(date "+%Y%m%d-%H%M%S")] Sleep for around 1 hr..."
sleep $(utils random_num 3300 3900) # Random num B/E 3300 - 3900
;;
Expand Down
5 changes: 3 additions & 2 deletions fat.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#
# Download ffmpeg from repository instead of compiling it.
# Will significantly increase the size of image.
# Install FFmpeg package from repository instead of compiling it.
# This will significantly increase the size of final image.
#
# Use this Dockerfile with:
# `docker build -t ctbcap . -f fat.dockerfile`
#

Expand Down

0 comments on commit db26e9f

Please sign in to comment.