Some new stuff
- MIT License - new make-pls.sh - some tools refactoring and documentation
This commit is contained in:
@@ -14,6 +14,10 @@
|
||||
#
|
||||
# Both *.m3u and *.m3u8 are supported.
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://github.com/anthonyaxenov/iptv/blob/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
awk '
|
||||
|
||||
@@ -10,8 +10,13 @@
|
||||
# All playlists from playlists.ini will be
|
||||
# downloaded in ./downloaded directory
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://github.com/anthonyaxenov/iptv/blob/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
mkdir -p downloaded && \
|
||||
cd downloaded && \
|
||||
rm -rf ./downloaded
|
||||
mkdir -p ./downloaded && \
|
||||
cd ./downloaded && \
|
||||
grep -P "pls='(.*)'" ../playlists.ini | sed "s/^pls=//g" | sed "s/'//g" | tr -d '\r' | xargs wget
|
||||
|
||||
@@ -6,10 +6,14 @@
|
||||
#
|
||||
# Usage:
|
||||
# ./download-all.sh
|
||||
# ./find-in-all.sh disney
|
||||
# ./find-in-all.sh "(disney|atv)"
|
||||
#
|
||||
# 1st argument is channel name pattern.
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://github.com/anthonyaxenov/iptv/blob/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# IPTV channel finder (one playlist)
|
||||
#
|
||||
# Usage:
|
||||
# ./find-in-pls.sh disney local/pls.m3u
|
||||
# ./find-in-pls.sh disney https://example.com/pls.m3u
|
||||
# ./find-in-pls.sh "disney" local/pls.m3u
|
||||
# ./find-in-pls.sh "disney" https://example.com/pls.m3u
|
||||
#
|
||||
# 1st argument is channel name pattern.
|
||||
#
|
||||
@@ -16,6 +16,10 @@
|
||||
#
|
||||
# Both *.m3u and *.m3u8 are supported.
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://github.com/anthonyaxenov/iptv/blob/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
awk '
|
||||
@@ -53,14 +57,12 @@ awk '
|
||||
sub("\r$", "", $0) # crlf -> lf
|
||||
if (tolower($0) ~ tolower(regex_ch)) {
|
||||
found_count++
|
||||
#print "\n\033[32m" FNR " FOUND:\033[0m\t" $0
|
||||
print "\n" $0
|
||||
print "\n\033[32m" FNR " FOUND:\033[0m\t" $0
|
||||
found_last = FNR
|
||||
}
|
||||
if (found_last > 0) {
|
||||
if (tolower($0) ~ tolower(regex_url)) {
|
||||
#print "\t\t" $0
|
||||
print $0 "\n"
|
||||
print "\t\t" $0
|
||||
found_last = 0
|
||||
}
|
||||
}
|
||||
|
||||
60
tools/make-pls.sh
Executable file
60
tools/make-pls.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
#################################################
|
||||
#
|
||||
# IPTV channel maker (all playlists)
|
||||
#
|
||||
# Usage:
|
||||
# ./download-all.sh
|
||||
# ./make-pls.sh "disney"
|
||||
#
|
||||
# 1st argument is channel name pattern.
|
||||
#
|
||||
# To save output in file use redirection:
|
||||
# ./make-pls.sh "disney" > disney.m3u8
|
||||
#
|
||||
# Anthony Axenov (c) 2022
|
||||
# The MIT License:
|
||||
# https://github.com/anthonyaxenov/iptv/blob/master/LICENSE
|
||||
#
|
||||
#################################################
|
||||
|
||||
#SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
|
||||
[ ! -d ./downloaded ] && echo "Error: ./downloaded directory does not exist. Run $SCRIPT_DIR/tools/download-all.sh" && exit 1
|
||||
[ ! "$(ls -A ./downloaded)" ] && echo "Error: ./downloaded directory is empty. Run $SCRIPT_DIR/tools/download-all.sh" && exit 2
|
||||
echo "#EXTM3U"
|
||||
echo "# Autogenerated at `date +%d.%m.%Y`"
|
||||
echo "# https://github.com/anthonyaxenov/iptv"
|
||||
echo
|
||||
for file in ./downloaded/*; do
|
||||
awk '
|
||||
BEGIN {
|
||||
IGNORECASE=1
|
||||
"date +%Y-%m-%d" | getline date
|
||||
channel = ARGV[1]
|
||||
playlist = ARGV[2]
|
||||
ARGV[1] = playlist
|
||||
delete ARGV[2]
|
||||
found_count = 0
|
||||
found_last = 0
|
||||
regex_ch = tolower(sprintf("^#EXTINF:.+,\s*(.*%s.*)", channel))
|
||||
regex_url = "^https?:\/\/.*$"
|
||||
}
|
||||
{
|
||||
sub("\r$", "", $0) # crlf -> lf
|
||||
if (tolower($0) ~ tolower(regex_ch)) {
|
||||
print $0
|
||||
found_count++
|
||||
found_last = FNR
|
||||
}
|
||||
if (found_last > 0) {
|
||||
if (tolower($0) ~ tolower(regex_url)) {
|
||||
print $0 "\n"
|
||||
found_last = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
' "$1" "$file"
|
||||
done
|
||||
Reference in New Issue
Block a user