From c608750c3a42f19e148e92e4eaa81a09bfd7b145 Mon Sep 17 00:00:00 2001 From: Shahin Agha-Ghassem Date: Sun, 19 Mar 2023 21:51:43 +0100 Subject: [PATCH] Break out saving channels into a function --- iptv | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iptv b/iptv index 8c33a5f..9649e2d 100755 --- a/iptv +++ b/iptv @@ -16,7 +16,7 @@ if [ -z "$m3u" ] && [ ! -s "$channels_file" ]; then exit 1 fi -if [ ! -z "$m3u" ]; then +save_channels() { printf "\nLoading channels... " curl -s $m3u | grep EXTINF: -A 2 > $tmp_playlist printf "Done!\n" @@ -46,6 +46,10 @@ if [ ! -z "$m3u" ]; then printf "Done!\n" printf "%s\n" "${channels[@]}" > $channels_file +} + +if [ ! -z "$m3u" ]; then + save_channels echo "Playlist saved. Now run iptv again without a M3U URL." exit