This repository has been archived on 2025-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
tools/make-pls.sh
Антон Аксенов c3163d683d
Новый скрипт playlists, который выкачивает ini
- playlists вызывается в download-all
- download-all теперь вызывается в начале find-in-all и make-pls
- мелочи по скриптам в целом
2025-03-18 17:05:07 +08:00

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