From 170a98607f0217a18edbee2ddc281c9175c8319f Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Sat, 6 Jul 2024 16:47:54 +0800 Subject: Add usage information (#4) * add usages * add usage information * correct text: from the page --- README.md | 21 +++++++++++++++------ iptv.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 85710c7..30a78ba 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,19 @@ Please note that you will need to set up the udpxy service on your router to handle the multicast packets. After you have created the playlist file, you can deploy it on your local server or simply import the playlist into your player. -## Roadmap +## Usage -- [x] Authenticate with IPTV server -- [x] Build playlist file .M3U8 -- [x] Resolve TV channel logos -- [x] Build EPG file -- [x] Find the password for the authinfo payload +```bash +Usage: iptv.sh [COMMAND] [OPTIONS] + +Commands: + make:playlist Make a playlist file + make:epg Make an EPG file + decrypt:authinfo Find a possible IPTV key + +Run 'iptv.sh COMMAND -h' for help on a specific command. +``` + +⚡️ Download the decryptor writtern in Rust for maximum performance to find +a possible key for the `authinfo` from the [release](https://github.com/lizhineng/china-unicom-iptv-foshan/releases) +page. 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 -p -d --mac " + 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 " +} + 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 -- cgit v1.2.3