mirror of
https://gitlab.com/peterpt/IPTV-CHECK.git
synced 2025-05-15 09:40:08 -07:00
netspeed check
This commit is contained in:
parent
53fb6d494d
commit
fd9aa57bf7
@ -11,10 +11,11 @@ In case valid urls were found , then the script will create a new iptv (m3u) fil
|
|||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
- wget
|
- wget
|
||||||
|
- speedtest-cli
|
||||||
|
|
||||||
# Install Requirements
|
# Install Requirements
|
||||||
|
|
||||||
- apt-get install wget
|
- apt-get install wget speedtest-cli
|
||||||
|
|
||||||
# Tool Instalation
|
# Tool Instalation
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
## IPTV-Checker (Changelog)
|
## IPTV-Checker (Changelog)
|
||||||
|
|
||||||
|
* v1.1 - Iptv tool will check internet speed and will auto adjust settings for better perfomance
|
||||||
* v1.1 - bug fixes , better cleaning of original m3u8 file before testing the streams
|
* v1.1 - bug fixes , better cleaning of original m3u8 file before testing the streams
|
||||||
* v1.0 - Implemented automatic detection of xml iptv files
|
* v1.0 - Implemented automatic detection of xml iptv files
|
||||||
* v1.0 - Bug fix & implementation , changed how iptv-check filters the m3u file lists and from now will autoremove repeated urls on lists to scan
|
* v1.0 - Bug fix & implementation , changed how iptv-check filters the m3u file lists and from now will autoremove repeated urls on lists to scan
|
||||||
|
88
iptv-check
88
iptv-check
@ -47,22 +47,24 @@ rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
|
|||||||
if [[ "$rpid" == "$pid" ]]
|
if [[ "$rpid" == "$pid" ]]
|
||||||
then
|
then
|
||||||
kill $pid >/dev/null 2>&1
|
kill $pid >/dev/null 2>&1
|
||||||
|
rm -rf $path/temp/* >/dev/null 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
rm -rf $path/temp/* >/dev/null 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
rm -rf $path/temp/* >/dev/null 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logo() {
|
logo() {
|
||||||
echo -e "$green" "IPTV-Check Tool 1.0"
|
echo -e "$green" "IPTV-Check Tool 1.1"
|
||||||
echo -e "$yellow" "-------------------------------------"
|
echo -e "$yellow" "-------------------------------------"
|
||||||
echo -e "$blue" "http://github.com/peterpt"
|
echo -e "$blue" "http://gitlab.com/peterpt"
|
||||||
echo -e "$yellow" "-------------------------------------"
|
echo -e "$yellow" "-------------------------------------"
|
||||||
echo ""
|
|
||||||
|
|
||||||
# checkig for wget if it is installed
|
# checkig for wget if it is installed
|
||||||
which wget > /dev/null 2>&1
|
which wget > /dev/null 2>&1
|
||||||
@ -72,6 +74,69 @@ echo ""
|
|||||||
echo -e "$yellow" "Try : apt-get install wget"
|
echo -e "$yellow" "Try : apt-get install wget"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
which speedtest-cli > /dev/null 2>&1
|
||||||
|
if [ "$?" -eq "1" ]; then
|
||||||
|
echo -e "$red" "speedtest Missing"
|
||||||
|
echo ""
|
||||||
|
echo -e "$yellow" "Try : apt-get install speedtest-cli"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Testing your Internet Download Speed"
|
||||||
|
echo -e "$yellow""This test can take up to 1 minute"
|
||||||
|
speedtest-cli --no-upload | tee $path/temp/speed >/dev/null 2>&1
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Checking Results"
|
||||||
|
if [[ ! -f "$path/temp/speed" ]]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo -e "$red""Unable to find speedtest results"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
nets=$(grep "Download:" < $path/temp/speed | awk '{print$2}' )
|
||||||
|
dec=$(echo "$nets" | grep ".")
|
||||||
|
if [[ -z "$dec" ]]
|
||||||
|
then
|
||||||
|
netspeed="$nets"
|
||||||
|
else
|
||||||
|
netspeed=$(echo "$nets" | sed 's/\..*$//' )
|
||||||
|
fi
|
||||||
|
if [[ -z "$netspeed" ]]
|
||||||
|
then
|
||||||
|
echo -e "$red""No output results were generated by the test"
|
||||||
|
echo -e "$yellow""Make sure you are connected to the web"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$netspeed" -le "10" ]] # 10Mbit/s
|
||||||
|
then
|
||||||
|
bts="120"
|
||||||
|
tout="4"
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Your internet Speed test was $yellow$netspeed$green Mbit/s"
|
||||||
|
echo -e "$green""IPTV tool automatically configured itself to wait $yellow$tout$green Seconds for each stream"
|
||||||
|
elif [[ "$netspeed" -le "30" ]] # 30 Mbit/s
|
||||||
|
then
|
||||||
|
bts="120"
|
||||||
|
tout="3"
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Your internet Speed test was $yellow$netspeed$green Mbit/s"
|
||||||
|
echo -e "$green""IPTV tool automatically configured itself to wait $yellow$tout$green Seconds for each stream"
|
||||||
|
elif [[ "$netspeed" -le "60" ]] # 60 Mbit/s
|
||||||
|
then
|
||||||
|
bts="120"
|
||||||
|
tout="2"
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Your internet Speed test was $yellow$netspeed$green Mbit/s"
|
||||||
|
echo -e "$green""IPTV tool automatically configured itself to wait $yellow$tout$green Seconds for each stream"
|
||||||
|
elif [[ "$netspeed" -ge "100" ]] # 100 Mbit/s
|
||||||
|
then
|
||||||
|
bts="120"
|
||||||
|
tout="1"
|
||||||
|
echo ""
|
||||||
|
echo -e "$green""Your internet Speed test was $yellow$netspeed$green Mbit/s"
|
||||||
|
echo -e "$green""IPTV tool automatically configured itself to wait $yellow$tout$green Seconds for each stream"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# The difference between writefile and writefile2 is that (writefile2) is to process the output from m3u files based in xml codes
|
# The difference between writefile and writefile2 is that (writefile2) is to process the output from m3u files based in xml codes
|
||||||
@ -257,7 +322,7 @@ wget -q "$chkf" -O "$path/temp/stream" & echo $! > "$path/temp/pid.tmp"
|
|||||||
pid=$(sed -n 1p < "$path/temp/pid.tmp")
|
pid=$(sed -n 1p < "$path/temp/pid.tmp")
|
||||||
|
|
||||||
# 4 seconds is the time that wget will download the stream befores gets killed
|
# 4 seconds is the time that wget will download the stream befores gets killed
|
||||||
sleep 4
|
sleep "$tout"
|
||||||
# checks if wget pid is still active
|
# checks if wget pid is still active
|
||||||
rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
|
rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
|
||||||
|
|
||||||
@ -274,13 +339,13 @@ echo -e "$yellow" "Error reading captured file"
|
|||||||
else
|
else
|
||||||
# checks the size of the stream file
|
# checks the size of the stream file
|
||||||
stsz=$(wc -c "$path/temp/stream" | awk '{print$1}')
|
stsz=$(wc -c "$path/temp/stream" | awk '{print$1}')
|
||||||
# In case stream file is less than 100 bytes then it is not valid
|
# In case stream file is less than value in bts (default is 100 bytes) then it is not valid
|
||||||
if [[ "$stsz" -le "100" ]]
|
if [[ "$stsz" -le "$bts" ]]
|
||||||
then
|
then
|
||||||
echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$red OFF"
|
echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$red OFF"
|
||||||
else
|
else
|
||||||
echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$green ON"
|
echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$green ON"
|
||||||
#file have more than 100 bytes , then it is a valid stream , goto write file fuction
|
#file have more than value in bts (default is 100 bytes) , then it is a valid stream , goto write file fuction
|
||||||
writefile
|
writefile
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -296,6 +361,12 @@ if [[ "$exts" == "0" ]]
|
|||||||
then
|
then
|
||||||
if [[ -f "$wfile" ]]
|
if [[ -f "$wfile" ]]
|
||||||
then
|
then
|
||||||
|
echo "Checking output file for errors"
|
||||||
|
echo ""
|
||||||
|
awk '!x[$0]++' < $wfile > $path/outtemp
|
||||||
|
rm -rf $wfile >/dev/null 2>&1
|
||||||
|
awk '{a[++j]=$0; if ($0=="" && PBL==NR-2) j=j-2; if ($0=="") PBL=NR}
|
||||||
|
END{for (k=1;k<=j;k++) print a[k]}' $path/outemp > $wfile
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "$green" "Job Finished"
|
echo -e "$green" "Job Finished"
|
||||||
echo ""
|
echo ""
|
||||||
@ -316,10 +387,11 @@ fi
|
|||||||
# Case user m3u file is remote (http) then run this function
|
# Case user m3u file is remote (http) then run this function
|
||||||
function remotef() {
|
function remotef() {
|
||||||
# wil download the remote m3u file to temp folder and will check its size
|
# wil download the remote m3u file to temp folder and will check its size
|
||||||
wget "{$file}" -O "$path/temp/1" >/dev/null 2>&1
|
wget "${file}" -O "$path/temp/1" >/dev/null 2>&1
|
||||||
flsz=$(wc -c "$path/temp/1" | awk '{print$1}')
|
flsz=$(wc -c "$path/temp/1" | awk '{print$1}')
|
||||||
if [[ "$flsz" -le "10" ]]
|
if [[ "$flsz" -le "10" ]]
|
||||||
then
|
then
|
||||||
|
echo "filesize is $flsz"
|
||||||
echo -e "$yellow" "The remote link is down or the file size of it"
|
echo -e "$yellow" "The remote link is down or the file size of it"
|
||||||
echo -e "$yellow" " is too small to be an m3u iptv list file"
|
echo -e "$yellow" " is too small to be an m3u iptv list file"
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user