Parse lines in correct order

This commit is contained in:
Shahin Agha-Ghassem 2023-04-03 19:56:44 +02:00
parent a63b43451e
commit 577b05a442

8
iptv
View File

@ -33,12 +33,12 @@ save_channels() {
url=""
while IFS= read -r line; do
if [[ "$line" == http* ]]; then
url="$line"
elif [[ "$line" =~ tvg-name=\"([^\"]+)\" || "$line" =~ tvg-id=\"([^\"]+)\" ]]; then
if [[ "$line" =~ tvg-name=\"([^\"]+)\" || "$line" =~ tvg-id=\"([^\"]+)\" ]]; then
name="${BASH_REMATCH[1]}"
channels+=("$name [CH:${#channels[@]}] url:$url")
url=""
elif [[ "$line" == http* ]]; then
url="$line"
channels+=("$name [CH:${#channels[@]}] url:$url")
fi
done < "$tmp_playlist"