From ec94f76c7826ba01218d576fa34d085d0390e6b9 Mon Sep 17 00:00:00 2001 From: liu shiwei Date: Tue, 5 Nov 2024 19:20:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E6=8D=A2txt=E5=88=B0m3u8=E7=9A=84shel?= =?UTF-8?q?l=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- txt2m3u8.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 txt2m3u8.sh diff --git a/txt2m3u8.sh b/txt2m3u8.sh new file mode 100755 index 00000000..5cedd1a6 --- /dev/null +++ b/txt2m3u8.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if ! [ "$1" ] ; then +echo $0 txt文件 ip:port +echo $0 北京电信.txt 192.168.1.1:18022 +exit +fi +name=${1%.txt} +m3u8=$name.m3u8 +if [ "$2" ] ; then +ip=$2 +else +ip=192.168.1.1:18022 +fi +echo "#EXTM3U name=\"$name\"" >$m3u8 +cat $1 |tr ',/:' ' ' |awk -v ip="$ip" '{print "#EXTINF:-1,"$1"\r\nhttp://"ip"/"$2"/"$3":"$4}' >> $m3u8 +ls -l $name.*