Merge pull request #8 from shahin8r/parse-lines-in-correct-order
Parse lines in correct order
This commit is contained in:
commit
87b4252b24
8
iptv
8
iptv
@ -33,12 +33,12 @@ save_channels() {
|
|||||||
url=""
|
url=""
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" == http* ]]; then
|
if [[ "$line" =~ tvg-name=\"([^\"]+)\" || "$line" =~ tvg-id=\"([^\"]+)\" ]]; then
|
||||||
url="$line"
|
|
||||||
elif [[ "$line" =~ tvg-name=\"([^\"]+)\" || "$line" =~ tvg-id=\"([^\"]+)\" ]]; then
|
|
||||||
name="${BASH_REMATCH[1]}"
|
name="${BASH_REMATCH[1]}"
|
||||||
channels+=("$name [CH:${#channels[@]}] url:$url")
|
|
||||||
url=""
|
url=""
|
||||||
|
elif [[ "$line" == http* ]]; then
|
||||||
|
url="$line"
|
||||||
|
channels+=("$name [CH:${#channels[@]}] url:$url")
|
||||||
fi
|
fi
|
||||||
done < "$tmp_playlist"
|
done < "$tmp_playlist"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user