From dc85994b493365dbb8bf0fc9c57ab3e295aac23c Mon Sep 17 00:00:00 2001 From: woniuzfb <47843848+woniuzfb@users.noreply.github.com> Date: Sat, 9 Mar 2024 04:00:51 +0800 Subject: [PATCH] fix --- README.md | 17 +- build | 2 +- core | 5 +- debug | 88 +----- docs/iptv.sh | 466 ++++++++++++++++++++++++++------ env | 9 +- iptv.sh | 466 ++++++++++++++++++++++++++------ make | 95 +------ src/arm | 2 - src/ibm_cf/menu_v2ray | 2 - src/iptv/add_channel | 7 +- src/iptv/check_xtream | 11 +- src/iptv/cmd_add | 4 +- src/iptv/cmd_curl | 2 - src/iptv/cmd_ed | 1 - src/iptv/flv_creator | 12 +- src/iptv/hls_creator | 12 +- src/iptv/menu_4gtv | 1 + src/iptv/menu_monitor | 27 +- src/iptv/menu_ts | 4 +- src/iptv/parse_stream | 9 +- src/iptv/start_channel | 7 +- src/iptv/update_self | 1 + src/lhh | 410 ++++++++++++++++++++++++++++ src/nginx/config_mmproxy | 2 +- src/nginx/config_postfix | 1 - src/nginx/menu_mongodb | 2 - src/nx | 5 +- src/or | 3 +- src/pve | 7 - src/tv | 133 +++++++-- src/v2 | 2 - src/v2ray/list_inbound_share | 1 - src/vip/enable | 1 - src/vip/list_channel | 7 +- src/x | 2 - src/xtream_codes/list_channels | 16 +- src/xtream_codes/test_account | 8 +- utils/curl | 2 - utils/dnscrypt | 4 +- utils/ffmpeg | 65 +++-- utils/git | 1 - utils/go | 2 - utils/i18n | 9 +- utils/imagemagick | 1 - utils/imgcat | 1 - utils/inquirer | 475 ++++++++++++++++++++++++++------- utils/jq | 40 ++- utils/mirror | 9 +- utils/openssl | 2 +- utils/pdf2html | 1 - utils/python | 2 - utils/system | 58 ++-- 53 files changed, 1825 insertions(+), 697 deletions(-) create mode 100644 src/lhh diff --git a/README.md b/README.md index 7581b9a..71784eb 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ - [IBM Cloud Foundry](#ibm-cloud-foundry) - [Cloudflare partner,workers](#cloudflare-partnerworkers) - [FFmpeg](#ffmpeg) - - [编译静态 FFmpeg](#编译静态-ffmpeg) - [自动解析直播源](#自动解析直播源) - [快捷键](#快捷键) - [参数详解](#参数详解) - [举例](#举例) - [Alist](#alist) + - [LianHuanHua](#lianhuanhua) - [Dev](#dev) ## V2ray @@ -153,15 +153,6 @@ wget https://woniuzfb.github.io/iptv/iptv.sh && bash iptv.sh - 节目表 - VIP -### 编译静态 FFmpeg - -``` bash -cd scripts -docker build -t ffmpeg-h265-static . -docker run -it ffmpeg-h265-static -./build.sh -``` - ### 自动解析直播源 `cx` 打开 xtream codes 账号/频道 管理面板 @@ -266,6 +257,12 @@ docker run -it ffmpeg-h265-static ./debug ali ``` +## LianHuanHua + +```bash +./debug lhh +``` + ## Dev v2.0.0 broken atm diff --git a/build b/build index 81e159c..68e8fb9 100644 --- a/build +++ b/build @@ -8,7 +8,7 @@ ReplaceInclude() return elif [ "$replace_name" == "src/\$self" ] then - echo "${2:-}if [ \"\$self\" == \"tv\" ]" + echo "${2:-}if [ \"\$self\" == \"tv\" ] || [ \"\$self\" == \"iptv\" ]" echo "${2:-}then" ReplaceInclude src/tv " ${2:-}" bins=(v2 x nx or pve arm ibm cf cx ali) diff --git a/core b/core index b13b283..de621bc 100644 --- a/core +++ b/core @@ -33,7 +33,8 @@ EleInArray() { local ele="$1" shift - local arr=("$@") + local var=("$1"[@]) + local arr=("${!var}") [[ "$ele" == @($(JoinByChar '|' "${arr[@]//|/\\|}")) ]] } @@ -41,8 +42,6 @@ printf() { if [ "${BASH_VERSINFO[0]}" -lt 4 ] then - DistCheck - if [[ "${3:-}" =~ \%\((.+)\)T ]] then if [ "${4:--1}" == "-1" ] diff --git a/debug b/debug index b53e534..f5ff3c4 100755 --- a/debug +++ b/debug @@ -84,90 +84,4 @@ else args=("${@:-}") fi -Include src/$self "${args[@]}" - -if [[ -n ${args[0]+x} ]] -then - case ${args[0]} in - 4g) - Include src/iptv/menu_4gtv "$@" - ;; - s) - Include src/iptv/menu_listings "$@" - ;; - singtel) - Include src/iptv/cmd_singtel "$@" - ;; - astro) - Include src/iptv/cmd_astro "$@" - ;; - m) - Include src/iptv/cmd_monitor "$@" - ;; - e) - Include src/iptv/cmd_e "$@" - ;; - ee) - Include src/iptv/cmd_ee "$@" - ;; - d) - Include src/iptv/cmd_default "$@" - ;; - ffmpeg|FFmpeg) - Include utils/mirror "$@" - ;; - ts) - Include src/iptv/menu_ts "$@" - ;; - f|flv) - [ ! -d "$IPTV_ROOT" ] && Println "$error 尚未安装, 请检查 !\n" && exit 1 - kind="flv" - color="$blue" - shift - ;; - v|vip) - [ ! -d "$IPTV_ROOT" ] && Println "$error 尚未安装, 请检查 !\n" && exit 1 - vip=true - shift - ;; - l|ll) - Include src/iptv/cmd_list "$@" - ;; - debug) - Include src/iptv/cmd_debug "$@" - ;; - ed|editor) - Include src/iptv/cmd_ed "$@" - ;; - a) - Include src/iptv/cmd_a "$@" - ;; - c) - Include src/iptv/cmd_c "$@" - ;; - color) - Include src/iptv/menu_color "$@" - ;; - curl) - Include src/iptv/cmd_curl "$@" - ;; - b) - Include src/iptv/cmd_backup "$@" - ;; - *) - ;; - esac -fi - -if [ -z "$*" ] -then - ShFileCheck - if [ "${vip:-false}" = true ] - then - VipMenu - else - Menu - fi -else - Include src/iptv/cmd_add "$@" -fi +Include src/"$self" "${args[@]}" diff --git a/docs/iptv.sh b/docs/iptv.sh index 4e1e9e0..375bc4e 100755 --- a/docs/iptv.sh +++ b/docs/iptv.sh @@ -682,6 +682,11 @@ inquirer() printf '%b' "$1" } + inquirer:print_input() { + tput el + printf '%s' "$1" + } + inquirer:join() { local var=("$1"[@]) if [[ -z ${!var:-} ]] @@ -706,8 +711,9 @@ inquirer() } inquirer:on_keypress() { - local OLD_IFS=$IFS - local key + local oIFS=$IFS + local key char_read byte_len + local oLC_ALL=${LC_ALL:-} oLANG=${LANG:-} local on_up=${1:-inquirer:on_default} local on_down=${2:-inquirer:on_default} local on_space=${3:-inquirer:on_default} @@ -718,7 +724,8 @@ inquirer() local on_backspace=${8:-inquirer:on_default} local on_not_ascii=${9:-inquirer:on_default} break_keypress=false - while IFS="" read -rsn1 key + + while IFS= read -rsn1 key do case "$key" in $'\x1b') @@ -737,8 +744,31 @@ inquirer() $'\x20') $on_space;; $'\x7f') $on_backspace "$key";; '') $on_enter "$key";; - *[$'\x80'-$'\xFF']*) $on_not_ascii "$key";; + # The space is the first printable character listed on http://www.asciitable.com/, ~ is the last # [^ -~] + *[$'\x80'-$'\xFF']*) + if [[ ${BASH_VERSINFO[0]} -lt 4 ]] && [ "$option" == "text_input" ] + then + char_read="${char_read:-}$key" + LC_ALL= LANG=C + byte_len=${#char_read} + LC_ALL=$oLC_ALL LANG=$oLANG + if [ "$byte_len" -ne "${#char_read}" ] + then + $on_not_ascii "$char_read" + char_read="" + fi + else + $on_not_ascii "$key" + fi + ;; + $'\x09') + local i + for((i=0;i<4;i++)); + do + $on_space + done + ;; *) $on_ascii "$key";; esac if [ "$break_keypress" = true ] @@ -746,7 +776,8 @@ inquirer() break fi done - IFS=$OLD_IFS + + IFS="$oIFS" } inquirer:cleanup() { @@ -767,26 +798,39 @@ inquirer() tput cub "$(tput cols)" tput cuf $((prompt_width+3)) tput el + if [ -n "${checkbox_pages_tip:-}" ] + then + inquirer:print "$checkbox_pages_tip" + fi tput cud $((current_index+1)) first_keystroke=false fi } + inquirer:page_instructions() { + tput cuu $((current_index+1)) + tput cub "$(tput cols)" + tput cuf $((prompt_width+3)) + tput el + inquirer:print "$checkbox_pages_tip" + tput cud $((current_index+1)) + } + inquirer:on_checkbox_input_up() { inquirer:remove_instructions tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print " ${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print " ${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print " ${unchecked} ${checkbox_list[current_index]}" + inquirer:print " ${unchecked} ${checkbox_page_list[current_index]}" fi if [ $current_index = 0 ] then - current_index=$((${#checkbox_list[@]}-1)) - tput cud $((${#checkbox_list[@]}-1)) + current_index=$((checkbox_page_list_count-1)) + tput cud $((checkbox_page_list_count-1)) else current_index=$((current_index-1)) tput cuu1 @@ -794,11 +838,11 @@ inquirer() tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_list[current_index]}" + inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_page_list[current_index]}" fi } @@ -806,17 +850,17 @@ inquirer() inquirer:remove_instructions tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print " ${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print " ${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print " ${unchecked} ${checkbox_list[current_index]}" + inquirer:print " ${unchecked} ${checkbox_page_list[current_index]}" fi - if [ $current_index = $((${#checkbox_list[@]}-1)) ] + if [ $current_index = $((checkbox_page_list_count-1)) ] then current_index=0 - tput cuu $((${#checkbox_list[@]}-1)) + tput cuu $((checkbox_page_list_count-1)) else current_index=$((current_index+1)) tput cud1 @@ -824,12 +868,209 @@ inquirer() tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] + then + inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_page_list[current_index]}" + else + inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_page_list[current_index]}" + fi + } + + inquirer:on_checkbox_input_left() { + if [ -z "${checkbox_pages_tip:-}" ] + then + return + fi + + local i + + if [ "$checkbox_pages_index" -eq 0 ] + then + checkbox_pages_index=$((checkbox_pages_count-1)) + checkbox_page_list_count=$((checkbox_list_count-checkbox_list_perpage*checkbox_pages_index)) + else + ((checkbox_pages_index--)) + checkbox_page_list_count=$checkbox_list_perpage + fi + + checkbox_pages_tip="${dim}$checkbox_pages_arrows $((checkbox_pages_index+1))/$checkbox_pages_count `gettext \"页\"`${normal}" + + inquirer:page_instructions + tput cub "$(tput cols)" + tput cud $((checkbox_list_perpage-current_index+1)) + + for((i=0;i<=checkbox_list_perpage;i++)); + do + tput el + tput cuu1 + done + + tput el + + if [ "$current_index" -gt "$checkbox_page_list_count" ] then - inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_list[current_index]}" + current_index=$checkbox_page_list_count + fi + + checkbox_page_list=() + checkbox_page_selected=() + checkbox_page_select_all=true + + for((i=0;i 选择, 确认)\"`${normal}\n" + if [ "$checkbox_list_perpage" -gt 0 ] && [ "$checkbox_list_count" -gt "$checkbox_list_perpage" ] + then + checkbox_pages_count=$((checkbox_list_count/checkbox_list_perpage)) + if [[ $((checkbox_list_perpage*checkbox_pages_count)) -lt "$checkbox_list_count" ]] + then + ((checkbox_pages_count++)) + fi + checkbox_pages_tip="${dim}$checkbox_pages_arrows $((checkbox_pages_index+1))/$checkbox_pages_count `gettext \"页\"`${normal} " + fi + + inquirer:print "${green}?${normal} ${bold}${bg_black}${white}${prompt} ${checkbox_pages_tip:-}${dim}`gettext \"(按 选择, 确认)\"`${normal}\n" for i in "${!checkbox_list[@]}" do checkbox_selected[i]=false done - if [ -n "${3:-}" ] + var=("$3"[@]) + if [[ -n ${!var:-} ]] then - var=("$3"[@]) - if [[ -n ${!var:-} ]] - then - checkbox_selected_indices=("${!var}") - for i in "${checkbox_selected_indices[@]}" - do - checkbox_selected[i]=true - done - checkbox_selected_indices=() - fi + checkbox_selected_indices=("${!var}") + for i in "${checkbox_selected_indices[@]}" + do + checkbox_selected[i]=true + done + checkbox_selected_indices=() fi for i in "${!checkbox_list[@]}" do - if [ $i = 0 ] + if [ "$i" = 0 ] then if [ "${checkbox_selected[i]}" = true ] then @@ -989,6 +1237,9 @@ inquirer() else inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_list[i]}\n" fi + elif [ "$checkbox_pages_count" -gt 1 ] && [ "$i" = "$checkbox_list_perpage" ] + then + break else if [ "${checkbox_selected[i]}" = true ] then @@ -997,17 +1248,42 @@ inquirer() inquirer:print " ${unchecked} ${checkbox_list[i]}\n" fi fi + ((checkbox_page_list_count++)) + checkbox_page_list+=("${checkbox_list[i]}") + done + + for((i=0;i dnscrypt-proxy.toml echo "$(awk '!x{x=sub(/.* stamp = .*/," stamp = \047sdns://AgAAAAAAAAAAACCY49XlNq8pWM0vfxT3BO9KJ20l4zzWXy5l9eTycnwTMA5kbnMuYWxpZG5zLmNvbQovZG5zLXF1ZXJ5\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml echo "$(awk '!x{x=sub(/.*server_names = \[.*/,"server_names = [\047dnspod-doh\047,\047alidns-doh-fix\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml - echo "$(awk '!x{x=sub(/.*bootstrap_resolvers = .*/,"bootstrap_resolvers = [\047114.114.114.114:53\047, \0478.8.8.8:53\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml - echo "$(awk '!x{x=sub(/.*netprobe_address = .*/,"netprobe_address = \047114.114.114.114:53\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml + echo "$(awk '!x{x=sub(/.*bootstrap_resolvers = .*/,"bootstrap_resolvers = [\047119.29.29.29:53\047, \047180.76.76.76:53\047, \0471.1.1.1:53\047, \047114.114.114.114:53\047, \0478.8.8.8:53\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml + echo "$(awk '!x{x=sub(/.*netprobe_address = .*/,"netprobe_address = \0471.1.1.1:53\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml else echo "$(awk '!x{x=sub(/.*server_names = \[.*/,"server_names = [\047google\047, \047cloudflare\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml fi @@ -51379,6 +51674,7 @@ then Println "$info 频道 [ $chnl_channel_name ] 修改成功 !\n" done else + echo inquirer list_input "是否推流 flv" ny_options add_channel_flv_yn if [ "$add_channel_flv_yn" == "$i18n_yes" ] then @@ -51676,7 +51972,7 @@ then if [ ! -e "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux64" ] || [ ! -e "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux32" ] then Println "$info 下载 jq ..." - rm -f "$FFMPEG_MIRROR_ROOT/jq-"* + rm -rf "$FFMPEG_MIRROR_ROOT/jq-"* mkdir -p "$FFMPEG_MIRROR_ROOT/$jq_ver/" if curl -s -L "https://github.com/stedolan/jq/releases/download/$jq_ver/jq-linux64" -o "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux64_tmp" && curl -s -L "https://github.com/stedolan/jq/releases/download/$jq_ver/jq-linux32" -o "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux32_tmp" then diff --git a/env b/env index 6f287b9..3cdd576 100644 --- a/env +++ b/env @@ -26,7 +26,12 @@ NX_FILE=/usr/local/bin/nx XC_FILE=/usr/local/bin/cx ARM_FILE=/usr/local/bin/arm PVE_FILE=/usr/local/bin/pve -LOG_FILE="$HOME/iptv.log" +LOG_FILE="$HOME"/iptv.log +JQ_FILE=/usr/local/bin/jq +FFMPEG_FILE=/usr/local/bin/ffmpeg +FFPROBE_FILE=/usr/local/bin/ffprobe +FFMPEG_ROOT="$HOME" +CURL_IMPERSONATE_FILE=/usr/local/bin/curl-impersonate # iptv IPTV_ROOT=/usr/local/iptv @@ -34,8 +39,6 @@ FFMPEG_LOG_ROOT="$IPTV_ROOT"/ffmpeg FFMPEG_MIRROR_LINK=http://pngquant.com/ffmpeg FFMPEG_MIRROR_ROOT="$IPTV_ROOT"/ffmpeg LOCK_FILE="$IPTV_ROOT"/lock -JQ_FILE="$IPTV_ROOT"/jq -CURL_IMPERSONATE_FILE=/usr/local/bin/curl-impersonate CHANNELS_FILE="$IPTV_ROOT"/channels.json MONITOR_LOG="$IPTV_ROOT"/monitor.log LOGROTATE_CONFIG="$IPTV_ROOT"/logrotate diff --git a/iptv.sh b/iptv.sh index 4e1e9e0..375bc4e 100755 --- a/iptv.sh +++ b/iptv.sh @@ -682,6 +682,11 @@ inquirer() printf '%b' "$1" } + inquirer:print_input() { + tput el + printf '%s' "$1" + } + inquirer:join() { local var=("$1"[@]) if [[ -z ${!var:-} ]] @@ -706,8 +711,9 @@ inquirer() } inquirer:on_keypress() { - local OLD_IFS=$IFS - local key + local oIFS=$IFS + local key char_read byte_len + local oLC_ALL=${LC_ALL:-} oLANG=${LANG:-} local on_up=${1:-inquirer:on_default} local on_down=${2:-inquirer:on_default} local on_space=${3:-inquirer:on_default} @@ -718,7 +724,8 @@ inquirer() local on_backspace=${8:-inquirer:on_default} local on_not_ascii=${9:-inquirer:on_default} break_keypress=false - while IFS="" read -rsn1 key + + while IFS= read -rsn1 key do case "$key" in $'\x1b') @@ -737,8 +744,31 @@ inquirer() $'\x20') $on_space;; $'\x7f') $on_backspace "$key";; '') $on_enter "$key";; - *[$'\x80'-$'\xFF']*) $on_not_ascii "$key";; + # The space is the first printable character listed on http://www.asciitable.com/, ~ is the last # [^ -~] + *[$'\x80'-$'\xFF']*) + if [[ ${BASH_VERSINFO[0]} -lt 4 ]] && [ "$option" == "text_input" ] + then + char_read="${char_read:-}$key" + LC_ALL= LANG=C + byte_len=${#char_read} + LC_ALL=$oLC_ALL LANG=$oLANG + if [ "$byte_len" -ne "${#char_read}" ] + then + $on_not_ascii "$char_read" + char_read="" + fi + else + $on_not_ascii "$key" + fi + ;; + $'\x09') + local i + for((i=0;i<4;i++)); + do + $on_space + done + ;; *) $on_ascii "$key";; esac if [ "$break_keypress" = true ] @@ -746,7 +776,8 @@ inquirer() break fi done - IFS=$OLD_IFS + + IFS="$oIFS" } inquirer:cleanup() { @@ -767,26 +798,39 @@ inquirer() tput cub "$(tput cols)" tput cuf $((prompt_width+3)) tput el + if [ -n "${checkbox_pages_tip:-}" ] + then + inquirer:print "$checkbox_pages_tip" + fi tput cud $((current_index+1)) first_keystroke=false fi } + inquirer:page_instructions() { + tput cuu $((current_index+1)) + tput cub "$(tput cols)" + tput cuf $((prompt_width+3)) + tput el + inquirer:print "$checkbox_pages_tip" + tput cud $((current_index+1)) + } + inquirer:on_checkbox_input_up() { inquirer:remove_instructions tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print " ${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print " ${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print " ${unchecked} ${checkbox_list[current_index]}" + inquirer:print " ${unchecked} ${checkbox_page_list[current_index]}" fi if [ $current_index = 0 ] then - current_index=$((${#checkbox_list[@]}-1)) - tput cud $((${#checkbox_list[@]}-1)) + current_index=$((checkbox_page_list_count-1)) + tput cud $((checkbox_page_list_count-1)) else current_index=$((current_index-1)) tput cuu1 @@ -794,11 +838,11 @@ inquirer() tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_list[current_index]}" + inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_page_list[current_index]}" fi } @@ -806,17 +850,17 @@ inquirer() inquirer:remove_instructions tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] then - inquirer:print " ${green}${checked}${normal} ${checkbox_list[current_index]}" + inquirer:print " ${green}${checked}${normal} ${checkbox_page_list[current_index]}" else - inquirer:print " ${unchecked} ${checkbox_list[current_index]}" + inquirer:print " ${unchecked} ${checkbox_page_list[current_index]}" fi - if [ $current_index = $((${#checkbox_list[@]}-1)) ] + if [ $current_index = $((checkbox_page_list_count-1)) ] then current_index=0 - tput cuu $((${#checkbox_list[@]}-1)) + tput cuu $((checkbox_page_list_count-1)) else current_index=$((current_index+1)) tput cud1 @@ -824,12 +868,209 @@ inquirer() tput cub "$(tput cols)" - if [ "${checkbox_selected[current_index]}" = true ] + if [ "${checkbox_page_selected[current_index]}" = true ] + then + inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_page_list[current_index]}" + else + inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_page_list[current_index]}" + fi + } + + inquirer:on_checkbox_input_left() { + if [ -z "${checkbox_pages_tip:-}" ] + then + return + fi + + local i + + if [ "$checkbox_pages_index" -eq 0 ] + then + checkbox_pages_index=$((checkbox_pages_count-1)) + checkbox_page_list_count=$((checkbox_list_count-checkbox_list_perpage*checkbox_pages_index)) + else + ((checkbox_pages_index--)) + checkbox_page_list_count=$checkbox_list_perpage + fi + + checkbox_pages_tip="${dim}$checkbox_pages_arrows $((checkbox_pages_index+1))/$checkbox_pages_count `gettext \"页\"`${normal}" + + inquirer:page_instructions + tput cub "$(tput cols)" + tput cud $((checkbox_list_perpage-current_index+1)) + + for((i=0;i<=checkbox_list_perpage;i++)); + do + tput el + tput cuu1 + done + + tput el + + if [ "$current_index" -gt "$checkbox_page_list_count" ] then - inquirer:print "${cyan}${arrow}${green}${checked}${normal} ${checkbox_list[current_index]}" + current_index=$checkbox_page_list_count + fi + + checkbox_page_list=() + checkbox_page_selected=() + checkbox_page_select_all=true + + for((i=0;i 选择, 确认)\"`${normal}\n" + if [ "$checkbox_list_perpage" -gt 0 ] && [ "$checkbox_list_count" -gt "$checkbox_list_perpage" ] + then + checkbox_pages_count=$((checkbox_list_count/checkbox_list_perpage)) + if [[ $((checkbox_list_perpage*checkbox_pages_count)) -lt "$checkbox_list_count" ]] + then + ((checkbox_pages_count++)) + fi + checkbox_pages_tip="${dim}$checkbox_pages_arrows $((checkbox_pages_index+1))/$checkbox_pages_count `gettext \"页\"`${normal} " + fi + + inquirer:print "${green}?${normal} ${bold}${bg_black}${white}${prompt} ${checkbox_pages_tip:-}${dim}`gettext \"(按 选择, 确认)\"`${normal}\n" for i in "${!checkbox_list[@]}" do checkbox_selected[i]=false done - if [ -n "${3:-}" ] + var=("$3"[@]) + if [[ -n ${!var:-} ]] then - var=("$3"[@]) - if [[ -n ${!var:-} ]] - then - checkbox_selected_indices=("${!var}") - for i in "${checkbox_selected_indices[@]}" - do - checkbox_selected[i]=true - done - checkbox_selected_indices=() - fi + checkbox_selected_indices=("${!var}") + for i in "${checkbox_selected_indices[@]}" + do + checkbox_selected[i]=true + done + checkbox_selected_indices=() fi for i in "${!checkbox_list[@]}" do - if [ $i = 0 ] + if [ "$i" = 0 ] then if [ "${checkbox_selected[i]}" = true ] then @@ -989,6 +1237,9 @@ inquirer() else inquirer:print "${cyan}${arrow}${normal}${unchecked} ${checkbox_list[i]}\n" fi + elif [ "$checkbox_pages_count" -gt 1 ] && [ "$i" = "$checkbox_list_perpage" ] + then + break else if [ "${checkbox_selected[i]}" = true ] then @@ -997,17 +1248,42 @@ inquirer() inquirer:print " ${unchecked} ${checkbox_list[i]}\n" fi fi + ((checkbox_page_list_count++)) + checkbox_page_list+=("${checkbox_list[i]}") + done + + for((i=0;i dnscrypt-proxy.toml echo "$(awk '!x{x=sub(/.* stamp = .*/," stamp = \047sdns://AgAAAAAAAAAAACCY49XlNq8pWM0vfxT3BO9KJ20l4zzWXy5l9eTycnwTMA5kbnMuYWxpZG5zLmNvbQovZG5zLXF1ZXJ5\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml echo "$(awk '!x{x=sub(/.*server_names = \[.*/,"server_names = [\047dnspod-doh\047,\047alidns-doh-fix\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml - echo "$(awk '!x{x=sub(/.*bootstrap_resolvers = .*/,"bootstrap_resolvers = [\047114.114.114.114:53\047, \0478.8.8.8:53\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml - echo "$(awk '!x{x=sub(/.*netprobe_address = .*/,"netprobe_address = \047114.114.114.114:53\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml + echo "$(awk '!x{x=sub(/.*bootstrap_resolvers = .*/,"bootstrap_resolvers = [\047119.29.29.29:53\047, \047180.76.76.76:53\047, \0471.1.1.1:53\047, \047114.114.114.114:53\047, \0478.8.8.8:53\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml + echo "$(awk '!x{x=sub(/.*netprobe_address = .*/,"netprobe_address = \0471.1.1.1:53\047")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml else echo "$(awk '!x{x=sub(/.*server_names = \[.*/,"server_names = [\047google\047, \047cloudflare\047]")}1' dnscrypt-proxy.toml)" > dnscrypt-proxy.toml fi @@ -51379,6 +51674,7 @@ then Println "$info 频道 [ $chnl_channel_name ] 修改成功 !\n" done else + echo inquirer list_input "是否推流 flv" ny_options add_channel_flv_yn if [ "$add_channel_flv_yn" == "$i18n_yes" ] then @@ -51676,7 +51972,7 @@ then if [ ! -e "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux64" ] || [ ! -e "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux32" ] then Println "$info 下载 jq ..." - rm -f "$FFMPEG_MIRROR_ROOT/jq-"* + rm -rf "$FFMPEG_MIRROR_ROOT/jq-"* mkdir -p "$FFMPEG_MIRROR_ROOT/$jq_ver/" if curl -s -L "https://github.com/stedolan/jq/releases/download/$jq_ver/jq-linux64" -o "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux64_tmp" && curl -s -L "https://github.com/stedolan/jq/releases/download/$jq_ver/jq-linux32" -o "$FFMPEG_MIRROR_ROOT/$jq_ver/jq-linux32_tmp" then diff --git a/make b/make index 9a74004..25902b4 100755 --- a/make +++ b/make @@ -1,6 +1,6 @@ #!/bin/bash -# Alist / FFmpeg / Nginx / Openresty / V2ray / Xray / Cloudflare / IBM Cloud Foundry / Armbian / Proxmox VE / ... -# Copyright (C) 2019-2023 +# LianHuanHua / Alist / FFmpeg / Nginx / Openresty / V2ray / Xray / Cloudflare / IBM Cloud Foundry / Armbian / Proxmox VE / ... +# Copyright (C) 2019-2024 # Released under GPL Version 3 License set -euo pipefail @@ -50,94 +50,3 @@ fi self=${self%.*} Include src/$self "$@" - -if [ -e "$IPTV_ROOT" ] && [ ! -e "$LOCK_FILE" ] -then - Include src/iptv/update_self -fi - -if [[ -n ${1+x} ]] -then - case $1 in - 4g) - Include src/iptv/menu_4gtv "$@" - ;; - s) - Include src/iptv/menu_listings "$@" - ;; - singtel) - Include src/iptv/cmd_singtel "$@" - ;; - astro) - Include src/iptv/cmd_astro "$@" - ;; - m) - Include src/iptv/cmd_monitor "$@" - ;; - e) - Include src/iptv/cmd_e "$@" - ;; - ee) - Include src/iptv/cmd_ee "$@" - ;; - d) - Include src/iptv/cmd_default "$@" - ;; - ffmpeg|FFmpeg) - Include utils/mirror "$@" - ;; - ts) - Include src/iptv/menu_ts "$@" - ;; - f|flv) - [ ! -d "$IPTV_ROOT" ] && Println "$error 尚未安装, 请检查 !\n" && exit 1 - kind="flv" - color="$blue" - shift - ;; - v|vip) - [ ! -d "$IPTV_ROOT" ] && Println "$error 尚未安装, 请检查 !\n" && exit 1 - vip=true - shift - ;; - l|ll) - Include src/iptv/cmd_list "$@" - ;; - debug) - Include src/iptv/cmd_debug "$@" - ;; - ed|editor) - Include src/iptv/cmd_ed "$@" - ;; - a) - Include src/iptv/cmd_a "$@" - ;; - c) - Include src/iptv/cmd_c "$@" - ;; - color) - Include src/iptv/menu_color "$@" - ;; - curl) - Include src/iptv/cmd_curl "$@" - ;; - b) - Include src/iptv/cmd_backup "$@" - ;; - *) - ;; - esac -fi - -if [ -z "$*" ] -then - ShFileCheck - if [ "${vip:-false}" = true ] - then - VipMenu - else - Menu - fi -else - Include src/iptv/cmd_add "$@" -fi diff --git a/src/arm b/src/arm index 648e056..8f4e9a8 100644 --- a/src/arm +++ b/src/arm @@ -12,8 +12,6 @@ Include utils/dnscrypt "$@" ShFileCheck -JQ_FILE="/usr/local/bin/jq" - Println " Armbian 管理面板 ${normal}${red}[v$sh_ver]${normal} ${green}1.${normal} 更改 apt 源 diff --git a/src/ibm_cf/menu_v2ray b/src/ibm_cf/menu_v2ray index 8e6ac2b..cf0fe91 100644 --- a/src/ibm_cf/menu_v2ray +++ b/src/ibm_cf/menu_v2ray @@ -1,7 +1,5 @@ IbmV2rayMenu() { - [ ! -d "$IPTV_ROOT" ] && JQ_FILE="/usr/local/bin/jq" - Println " IBM $v2ray_package_name APP 面板 ${normal}${red}[v$sh_ver]${normal} ${green}1.${normal} 下载 $v2ray_package_name APP diff --git a/src/iptv/add_channel b/src/iptv/add_channel index ca4ba00..bd249bc 100644 --- a/src/iptv/add_channel +++ b/src/iptv/add_channel @@ -150,12 +150,7 @@ AddChannel() SetSyncPairs fi - if [ -z "${FFMPEG:-}" ] - then - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" - fi + FFmpegInstall if [[ ${input_flags:0:1} == "'" ]] then diff --git a/src/iptv/check_xtream b/src/iptv/check_xtream index fad8af1..a3d3eff 100644 --- a/src/iptv/check_xtream +++ b/src/iptv/check_xtream @@ -2,12 +2,7 @@ CheckIfXtreamCodes() { XtreamCodesGetDomains - if [ -z "${FFPROBE:-}" ] - then - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" - fi + FFmpegInstall to_try=0 @@ -179,7 +174,7 @@ CheckIfXtreamCodes() then video=1 fi - done < <($FFPROBE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 0 ] || [ "$video" -eq 0 ] then @@ -255,7 +250,7 @@ CheckIfXtreamCodes() then video=1 fi - done < <($FFPROBE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 0 ] || [ "$video" -eq 0 ] then diff --git a/src/iptv/cmd_add b/src/iptv/cmd_add index a28278a..83de932 100644 --- a/src/iptv/cmd_add +++ b/src/iptv/cmd_add @@ -42,9 +42,7 @@ then ExitOnList n "`gettext \"尚未安装, 是否现在安装\"`" Install else - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" + FFmpegInstall GetDefault diff --git a/src/iptv/cmd_curl b/src/iptv/cmd_curl index 293ccf4..3858307 100644 --- a/src/iptv/cmd_curl +++ b/src/iptv/cmd_curl @@ -1,5 +1,3 @@ -Include utils/jq "$@" - Include utils/go "$@" Include utils/nodejs "$@" diff --git a/src/iptv/cmd_ed b/src/iptv/cmd_ed index ad6b367..46a31b9 100644 --- a/src/iptv/cmd_ed +++ b/src/iptv/cmd_ed @@ -1,4 +1,3 @@ -DistCheck DepInstall vim if [ "$dist" == "rpm" ] then diff --git a/src/iptv/flv_creator b/src/iptv/flv_creator index 63dfd4d..0a0869b 100644 --- a/src/iptv/flv_creator +++ b/src/iptv/flv_creator @@ -139,7 +139,7 @@ FlvStreamCreator() if [ "$flv_h265" = true ] then - FFMPEG="/usr/local/bin/ffmpeg_c" + FFMPEG="$FFMPEG_FILE_ROOT"/ffmpeg_c fi if [ "${stream_url_qualities_count:-0}" -gt 1 ] || [ "${stream_url_audio_count:-0}" -gt 0 ] || [ "${stream_url_subtitles_count:-0}" -gt 0 ] @@ -303,7 +303,7 @@ FlvStreamCreator() fi PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${variants_input_command[@]+"${variants_input_command[@]}"} \ ${variants_output_command[@]+"${variants_output_command[@]}"} \ ${map_command[@]+"${map_command[@]}"} \ @@ -536,7 +536,7 @@ FlvStreamCreator() fi PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${input_command[@]+"${input_command[@]}"} \ ${variants_output_command[@]+"${variants_output_command[@]}"} \ ${map_command[@]+"${map_command[@]}"} \ @@ -610,7 +610,7 @@ FlvStreamCreator() if [ "$chnl_flv_h265" = true ] then - FFMPEG="/usr/local/bin/ffmpeg_c" + FFMPEG="$FFMPEG_FILE_ROOT"/ffmpeg_c fi if [ "${chnl_stream_url_qualities_count:-0}" -gt 1 ] || [ -n "${chnl_stream_url_audio_indices:-}" ] @@ -773,7 +773,7 @@ FlvStreamCreator() fi PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${chnl_variants_input_command[@]+"${chnl_variants_input_command[@]}"} \ ${chnl_variants_output_command[@]+"${chnl_variants_output_command[@]}"} \ ${chnl_map_command[@]+"${chnl_map_command[@]}"} \ @@ -1006,7 +1006,7 @@ FlvStreamCreator() fi PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${chnl_input_command[@]+"${chnl_input_command[@]}"} \ ${chnl_variants_output_command[@]+"${chnl_variants_output_command[@]}"} \ ${chnl_map_command[@]+"${chnl_map_command[@]}"} \ diff --git a/src/iptv/hls_creator b/src/iptv/hls_creator index 4055ba6..5847b65 100644 --- a/src/iptv/hls_creator +++ b/src/iptv/hls_creator @@ -446,7 +446,7 @@ HlsStreamCreatorPlus() hls_command+=( "$output_dir_root/${playlist_name}_%v.m3u8" ) PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${variants_input_command[@]+"${variants_input_command[@]}"} \ ${variants_output_command[@]+"${variants_output_command[@]}"} \ ${map_command[@]+"${map_command[@]}"} \ @@ -798,7 +798,7 @@ HlsStreamCreatorPlus() fi PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${input_command[@]+"${input_command[@]}"} \ ${variants_output_command[@]+"${variants_output_command[@]}"} \ ${map_command[@]+"${map_command[@]}"} \ @@ -809,7 +809,7 @@ HlsStreamCreatorPlus() # seg # PrepTerm - # $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + # $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ # ${input_command[@]+"${input_command[@]}"} \ # ${variants_output_command[@]+"${variants_output_command[@]}"} \ # ${map_command[@]+"${map_command[@]}"} \ @@ -1203,7 +1203,7 @@ HlsStreamCreatorPlus() chnl_hls_command+=( "$chnl_output_dir_root/${chnl_playlist_name}_%v.m3u8" ) PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${chnl_variants_input_command[@]+"${chnl_variants_input_command[@]}"} \ ${chnl_variants_output_command[@]+"${chnl_variants_output_command[@]}"} \ ${chnl_map_command[@]+"${chnl_map_command[@]}"} \ @@ -1556,7 +1556,7 @@ HlsStreamCreatorPlus() # https://stackoverflow.com/questions/23235651/how-can-i-do-ansi-c-quoting-of-an-existing-bash-variable PrepTerm - $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ ${chnl_input_command[@]+"${chnl_input_command[@]}"} \ ${chnl_variants_output_command[@]+"${chnl_variants_output_command[@]}"} \ ${chnl_map_command[@]+"${chnl_map_command[@]}"} \ @@ -1567,7 +1567,7 @@ HlsStreamCreatorPlus() # seg # PrepTerm - # $FFMPEG ${global_options[@]+"${global_options[@]}"} \ + # $FFMPEG_FILE ${global_options[@]+"${global_options[@]}"} \ # ${chnl_input_command[@]+"${chnl_input_command[@]}"} \ # ${chnl_variants_output_command[@]+"${chnl_variants_output_command[@]}"} \ # ${chnl_map_command[@]+"${chnl_map_command[@]}"} \ diff --git a/src/iptv/menu_4gtv b/src/iptv/menu_4gtv index 0f4aa89..7998ec9 100644 --- a/src/iptv/menu_4gtv +++ b/src/iptv/menu_4gtv @@ -312,6 +312,7 @@ do Println "$info 频道 [ $chnl_channel_name ] 修改成功 !\n" done else + echo inquirer list_input "是否推流 flv" ny_options add_channel_flv_yn if [ "$add_channel_flv_yn" == "$i18n_yes" ] then diff --git a/src/iptv/menu_monitor b/src/iptv/menu_monitor index 89eb71d..2e63b9b 100644 --- a/src/iptv/menu_monitor +++ b/src/iptv/menu_monitor @@ -853,7 +853,7 @@ MonitorHlsRestartChannel() then audio=0 fi - done < <($FFPROBE $encrypt_command -i "$f" -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $encrypt_command -i "$f" -show_streams -loglevel quiet) break done @@ -1325,7 +1325,7 @@ MonitorFlvRestartChannel() then video=1 fi - done < <($FFPROBE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 1 ] && [ "$video" -eq 1 ] then MonitorFlvRestartSuccess @@ -1524,7 +1524,7 @@ MonitorTryAccounts() then video=1 fi - done < <($FFPROBE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $chnl_proxy_command -user_agent "$chnl_user_agent" -headers "$chnl_headers_command" -cookies "$chnl_cookies_command" -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 1 ] && [ "$video" -eq 1 ] then @@ -1605,7 +1605,7 @@ MonitorTryAccounts() then video=1 fi - done < <($FFPROBE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 1 ] && [ "$video" -eq 1 ] then @@ -1672,7 +1672,7 @@ MonitorTryAccounts() then audio=0 fi - done < <($FFPROBE $encrypt_command -i "$f" -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $encrypt_command -i "$f" -show_streams -loglevel quiet) break done @@ -1736,7 +1736,7 @@ MonitorTryAccounts() then video=1 fi - done < <($FFPROBE $chnl_proxy_command -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $chnl_proxy_command -i "$chnl_stream_link" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 1 ] && [ "$video" -eq 1 ] then @@ -1819,7 +1819,7 @@ MonitorTryAccounts() then video=1 fi - done < <($FFPROBE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 1 ] && [ "$video" -eq 1 ] then @@ -1887,7 +1887,7 @@ MonitorTryAccounts() then audio=0 fi - done < <($FFPROBE $encrypt_command -i "$f" -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $encrypt_command -i "$f" -show_streams -loglevel quiet) break done @@ -2185,9 +2185,8 @@ Monitor() mkdir -p "$LIVE_ROOT" MonitorLog "监控启动成功 PID $BASHPID !" - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" + FFmpegInstall + monitor=true XtreamCodesGetDomains @@ -2798,7 +2797,7 @@ Monitor() then video=1 fi - done < <($FFPROBE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) + done < <($FFPROBE_FILE -i "${chnl_flv_pull_link:-$chnl_flv_push_link}" -rw_timeout 10000000 -show_streams -loglevel quiet) if [ "$audio" -eq 0 ] || [ "$video" -eq 0 ] then @@ -3071,7 +3070,7 @@ Monitor() then audio=0 fi - done < <($FFPROBE $encrypt_command -i "$f" -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $encrypt_command -i "$f" -show_streams -loglevel quiet) break done @@ -3113,7 +3112,7 @@ Monitor() then audio=0 fi - done < <($FFPROBE $encrypt_command -i "$f" -show_streams -loglevel quiet) + done < <($FFPROBE_FILE $encrypt_command -i "$f" -show_streams -loglevel quiet) if [ "$audio" -eq 0 ] || [ "$video" -eq 0 ] || [[ $video_bitrate -lt $hls_min_bitrate ]] then diff --git a/src/iptv/menu_ts b/src/iptv/menu_ts index 3775a0c..f613536 100644 --- a/src/iptv/menu_ts +++ b/src/iptv/menu_ts @@ -773,9 +773,7 @@ IFS="${delimiters[1]}" read -ra livetv_url <<< "$m_livetv_url" echo inquirer checkbox_input_indices "选择添加的频道" chnl_name chnl_indices -FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) -FFMPEG="$FFMPEG_ROOT/ffmpeg" -FFPROBE="$FFMPEG_ROOT/ffprobe" +FFmpegInstall headers="" cookies="" diff --git a/src/iptv/parse_stream b/src/iptv/parse_stream index 0495a96..1dcde12 100644 --- a/src/iptv/parse_stream +++ b/src/iptv/parse_stream @@ -352,12 +352,7 @@ ParseStream() then Println "$info 检测中..." - if [ -z "${FFMPEG:-}" ] - then - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" - fi + FFmpegInstall ffprobe_command=() @@ -373,7 +368,7 @@ ParseStream() ffprobe_command+=( -cookies "$cookies_command" ) fi - if probe=$($FFPROBE -v quiet -print_format json -show_programs -show_streams -show_format -user_agent "$user_agent" \ + if probe=$($FFPROBE_FILE -v quiet -print_format json -show_programs -show_streams -show_format -user_agent "$user_agent" \ ${ffprobe_command[@]+"${ffprobe_command[@]}"} -i "$stream_link") then SetDelimiters diff --git a/src/iptv/start_channel b/src/iptv/start_channel index ded21b9..5e8b5a8 100644 --- a/src/iptv/start_channel +++ b/src/iptv/start_channel @@ -1181,12 +1181,7 @@ StartChannel() chnl_const=false fi - if [ -z "${FFMPEG:-}" ] - then - FFMPEG_ROOT=$(dirname "$IPTV_ROOT"/ffmpeg-git-*/ffmpeg) - FFMPEG="$FFMPEG_ROOT/ffmpeg" - FFPROBE="$FFMPEG_ROOT/ffprobe" - fi + FFmpegInstall if [[ ${chnl_input_flags:0:1} == "'" ]] then diff --git a/src/iptv/update_self b/src/iptv/update_self index 2074b0e..d4828f5 100644 --- a/src/iptv/update_self +++ b/src/iptv/update_self @@ -509,4 +509,5 @@ then jq_path='["channels"]' JQ update "$CHANNELS_FILE" new_channels fi + printf '%s' "" > ${LOCK_FILE} diff --git a/src/lhh b/src/lhh new file mode 100644 index 0000000..7ce1a91 --- /dev/null +++ b/src/lhh @@ -0,0 +1,410 @@ +Include utils/ffmpeg "$@" + +LianHuanHuaDownload() +{ + local book_url="$1" ebooks_root="$2" title="$3" i j + local ebook_path="$ebooks_root/$title" + + i=2 + until [ ! -d "$ebook_path" ] + do + if [ "$i" -gt 2 ] + then + ebook_path="${ebook_path%-*}" + fi + ebook_path="${ebook_path}-$i" + ((i++)) + done + + book_html=$(CurlFake -s -L -b "$cookie_file" -H "Referer: $book_url" $book_url) + iframe_path=$(grep -oP '