标签:english channel please 数据流 频道
线上缓存流经常由于网络问题导致数据同步不完成,需要手动一条条下载,现在通过脚本来完成下载,但需要传入三个参数即:频道名,开始时间,结束时间。
#!/bin/bash
#传入参数
read -p "please input English Channel Name:" channel
read -p "please input startTime:‘1970-01-01 00:00:00‘ " Starttime
read -p "please input endTime:‘1970-01-01 00:00:00‘ " Endtime
#对时间变量进行转换
starttime=`date --date="$Starttime" +%s`
endtime=`date --date="$Endtime" +%s`
echo $channel,$starttime,$endtime
Year=`date --date="$Starttime" +%Y`
Month=`date --date="$Starttime" +%m`
Date=`date --date="$Starttime" +%d`
basicDir=/opt/online01/stream
codetype=2500000
links -dump "http://xxxx.live.tvmining.com/approve/vod?type=ipsd&channel=$channel&starttime=$starttime&endtime=$endtime" | grep http > stream.m3u8
for file in `cat stream.m3u8`
do
localfile=$basicDir/`echo $file | awk -F stream/ ‘{print $2}‘`
if [ -e $localfile ];then
echo $localfile already exists
else
if [ -e $basicDir/$codetype/$channel/$Year/$Month/$Date ];then
wget $file -P $basicDir/$codetype/$channel/$Year/$Month/$Date &> /dev/null && echo "$file down sucessfully"
else
echo $basicDir/$codetype/$channel/$Year/$Month/$Date not exists && exit 12
fi
fi
done仅作为自己学习参数
本文出自 “eagle” 博客,谢绝转载!
标签:english channel please 数据流 频道
原文地址:http://seneagle.blog.51cto.com/1319845/1718051