Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

转换txt到m3u8的shell脚本 #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions txt2m3u8.sh
Original file line number Diff line number Diff line change
@@ -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.*