From e4c48e49d87eb707767ce8b3f9a9183c2d815552 Mon Sep 17 00:00:00 2001 From: Shahin Agha-Ghassem Date: Sun, 19 Mar 2023 22:45:29 +0100 Subject: [PATCH] Add usage explanation --- iptv | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/iptv b/iptv index 49c5357..3f20f15 100755 --- a/iptv +++ b/iptv @@ -12,10 +12,14 @@ player_pid_file="/tmp/iptvplayerpid" mkdir -p "$config_path" -if [ -z "$m3u" ] && [ ! -s "$channels_file" ]; then - echo "No M3U playlist has been configured. Run with: iptv http://domain/playlist.m3u" - exit 1 -fi +usage() { + cat < $channels_file } +if [ -z "$m3u" ] && [ ! -s "$channels_file" ]; then + usage + exit 1 +fi + +if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then + usage + exit 0 +fi + if [ ! -z "$m3u" ]; then echo "$m3u" > $m3u_url_file save_channels