- playlists вызывается в download-all - download-all теперь вызывается в начале find-in-all и make-pls - мелочи по скриптам в целом
52 lines
1.2 KiB
Bash
Executable File
52 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#################################################
|
|
#
|
|
# IPTV playlist maker (all playlists)
|
|
#
|
|
# Usage:
|
|
# ./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://git.axenov.dev/IPTV/tools/src/branch/master/LICENSE
|
|
#
|
|
#################################################
|
|
# shellcheck disable=SC2086
|
|
|
|
TOOLS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
|
$TOOLS_DIR/download-all.sh
|
|
|
|
channel="$1"
|
|
|
|
regex_ch="^#extinf:\s*-?[01]\s*.*,(.*${channel,,}.*)"
|
|
regex_url="^https?:\/\/.*$"
|
|
|
|
found_count=0
|
|
found_last=0
|
|
|
|
echo "#EXTM3U"
|
|
echo "# Autogenerated at $(date '+%d.%m.%Y')"
|
|
echo "# https://git.axenov.dev/IPTV/tools"
|
|
echo
|
|
|
|
for file in ./downloaded/*; do
|
|
while read -r line; do
|
|
if [[ "${line,,}" =~ $regex_ch ]]; then
|
|
echo -e "$line"
|
|
((found_count += 1))
|
|
found_last=$found_count
|
|
fi
|
|
if [ $found_last -gt 0 ]; then
|
|
if [[ "${line,,}" =~ $regex_url ]]; then
|
|
echo -e "$line\n"
|
|
found_last=0
|
|
fi
|
|
fi
|
|
done < "$file"
|
|
done
|