From 577b05a442328401589904a0120d10387c244314 Mon Sep 17 00:00:00 2001 From: Shahin Agha-Ghassem Date: Mon, 3 Apr 2023 19:56:44 +0200 Subject: [PATCH] Parse lines in correct order --- iptv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iptv b/iptv index 5c4cc9d..8a9c813 100755 --- a/iptv +++ b/iptv @@ -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"