Add usage explanation
This commit is contained in:
parent
9f28312766
commit
e4c48e49d8
22
iptv
22
iptv
@ -12,10 +12,14 @@ player_pid_file="/tmp/iptvplayerpid"
|
|||||||
|
|
||||||
mkdir -p "$config_path"
|
mkdir -p "$config_path"
|
||||||
|
|
||||||
if [ -z "$m3u" ] && [ ! -s "$channels_file" ]; then
|
usage() {
|
||||||
echo "No M3U playlist has been configured. Run with: iptv http://domain/playlist.m3u"
|
cat <<EOF
|
||||||
exit 1
|
usage: iptv [M3U_URL]
|
||||||
fi
|
|
||||||
|
[M3U_URL] URL to a M3U playlist, required on first run
|
||||||
|
--help Display help
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
save_channels() {
|
save_channels() {
|
||||||
m3u_url=$(cat "$m3u_url_file")
|
m3u_url=$(cat "$m3u_url_file")
|
||||||
@ -51,6 +55,16 @@ save_channels() {
|
|||||||
printf "%s\n" "${channels[@]}" > $channels_file
|
printf "%s\n" "${channels[@]}" > $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
|
if [ ! -z "$m3u" ]; then
|
||||||
echo "$m3u" > $m3u_url_file
|
echo "$m3u" > $m3u_url_file
|
||||||
save_channels
|
save_channels
|
||||||
|
Loading…
Reference in New Issue
Block a user