summaryrefslogtreecommitdiff
path: root/iptv.sh
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2024-07-06 16:47:54 +0800
committerGitHub <[email protected]>2024-07-06 16:47:54 +0800
commit170a98607f0217a18edbee2ddc281c9175c8319f (patch)
treead73bf4db3f7036f00370a2b60da870911b22e27 /iptv.sh
parent8b92ae20b5ca4fc72bc1ed7d240da115c8856473 (diff)
downloadchina-unicom-iptv-gd-170a98607f0217a18edbee2ddc281c9175c8319f.tar.gz
china-unicom-iptv-gd-170a98607f0217a18edbee2ddc281c9175c8319f.zip
Add usage information (#4)
* add usages * add usage information * correct text: from the page
Diffstat (limited to 'iptv.sh')
-rwxr-xr-xiptv.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/iptv.sh b/iptv.sh
index f562a13..8d1c807 100755
--- a/iptv.sh
+++ b/iptv.sh
@@ -1,5 +1,43 @@
#!/usr/bin/env bash
+show_usage () {
+ echo "Usage: $0 [COMMAND] [OPTIONS]"
+ echo ""
+ echo "Commands:"
+ echo " make:playlist Make a playlist file"
+ echo " make:epg Make an EPG file"
+ echo " decrypt:authinfo Find a possible IPTV key"
+ echo ""
+ echo "Run '$0 COMMAND -h' for help on a specific command."
+}
+
+show_make_playlist_usage () {
+ echo "Usage: $0 make:playlist -u <user-id> -p <password> -d <device-id> --mac <mac-address>"
+ echo ""
+ echo "Options:"
+ echo " -u | --user User ID"
+ echo " -p | --password Password"
+ echo " -d | --device Device ID"
+ echo " --ip Device IP address (default: 127.0.0.1)"
+ echo " --mac Device MAC address"
+ echo " --udpxy Udpxy endpoint (default: http://127.0.0.1:4022)"
+ echo " -o | --output Playlist file name (default: playlist.M3U8)"
+ echo " --curl Specify the additional cURL arguments"
+}
+
+show_make_epg_usage () {
+ echo "Usage: $0 make:epg"
+ echo ""
+ echo "Options:"
+ echo " --endpoint EPG index endpoint (default: http://120.87.12.38:8083/epg/api/page/biz_59417088.json)"
+ echo " -o | --output EPG file name (default: epg.xml)"
+ echo " --curl Specify the additional cURL arguments"
+}
+
+show_decrypt_authinfo_usage () {
+ echo "Usage: $0 decrypt:authinfo <authinfo>"
+}
+
step () { echo -e "\033[32m[-]\033[0m $1"; }
fatal () { echo -e "\033[31m[!]\033[0m $1"; exit 1; }
@@ -48,6 +86,7 @@ make_epg () {
-o | --output ) output_file="$2"; shift 2;;
--endpoint ) endpoint="$2"; shift 2;;
--curl ) curl_args="$2"; shift 2;;
+ -h | --help ) show_make_epg_usage; exit 0;;
*) echo "Unknown option: $1"; exit 1;;
esac
done
@@ -120,6 +159,7 @@ make_playlist () {
--udpxy) udpxy_endpoint="$2"; shift 2;;
-o | --output) output_file="$2"; shift 2;;
--curl) curl_args="$2"; shift 2;;
+ -h | --help ) show_make_playlist_usage; exit 0;;
*) echo "Unknown option: $1"; exit 1;;
esac
done
@@ -227,6 +267,11 @@ make_playlist () {
}
decrypt_authinfo () {
+ if [[ "$1" == '-h' || "$1" == "--help" ]]; then
+ show_decrypt_authinfo_usage
+ exit 0
+ fi
+
local authinfo="$1"
if [[ -z "$authinfo" ]]; then
@@ -283,6 +328,7 @@ while [ $# -gt 0 ]; do
make:playlist) shift 1; make_playlist "$@";;
make:epg) shift 1; make_epg "$@";;
decrypt:authinfo) shift 1; decrypt_authinfo "$@";;
+ -h | --help) show_usage; exit 0;;
*) echo "Unknown command: $1"; exit 1;;
esac
done