From cc8605b1cdeee9925219f1677a91db9c97fbcfd6 Mon Sep 17 00:00:00 2001 From: Shahin Agha-Ghassem Date: Sun, 19 Mar 2023 21:58:23 +0100 Subject: [PATCH] Save m3u url to file and read from it --- iptv | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iptv b/iptv index 9649e2d..db77d9b 100755 --- a/iptv +++ b/iptv @@ -6,6 +6,7 @@ m3u=$1 config_path="$HOME/.config/iptv/" channels_file="$config_path/channels" +m3u_url_file="$config_path/m3u_url" tmp_playlist="/tmp/iptvplaylist" player_pid_file="/tmp/iptvplayerpid" @@ -17,8 +18,10 @@ if [ -z "$m3u" ] && [ ! -s "$channels_file" ]; then fi save_channels() { + m3u_url=$(cat "$m3u_url_file") + printf "\nLoading channels... " - curl -s $m3u | grep EXTINF: -A 2 > $tmp_playlist + curl -s "$m3u_url" | grep EXTINF: -A 2 > $tmp_playlist printf "Done!\n" printf "Parsing channels... " @@ -49,6 +52,7 @@ save_channels() { } if [ ! -z "$m3u" ]; then + echo "$m3u" > $m3u_url_file save_channels echo "Playlist saved. Now run iptv again without a M3U URL."