本帖最后由 pcl_test 于 2016-7-3 19:47 编辑
我有个“频道列表.txt”文件,文件内容如下
{央视频道}
CCTV1综合,218.24.47.44/CCTV1.m3u8
CCTV1综合,vdn.apps.cntv.cn/api/getLiveUrlCommonRedirectApi.do?channel=pa://cctv_p2p_hdcctv1&type=ipad
CCTV1综合,vdn.apps.cntv.cn/api/getLiveUrlCommonRedirectApi.do?channel=pa://cctv_p2p_hdcctv1&type=ipad
CCTV1综合,rtmp.cntv.lxdns.com/live/cctv1/playlist.m3u8
CCTV2财经,218.24.47.44/CCTV2.m3u8
CCTV2财经,vdn.apps.cntv.cn/api/getLiveUrlCommonRedirectApi.do?channel=pa://cctv_p2p_hdcctv2&type=ipad
CCTV2财经,218.24.47.44/CCTV2.m3u8
CCTV2财经,rtmp.cntv.lxdns.com/live/cctv2/playlist.m3u8
CCTV3综艺,stream1.gzcbn.tv:1935/app_2/ls_3.stream/playlsit.m3u8?session=jyb321123
CCTV3综艺,vdn.apps.cntv.cn/api/getLiveUrlCommonRedirectApi.do?channel=pa://cctv_p2p_hdcctv3&type=ipad
CCTV3综艺,116.199.127.68/cctv3
CCTV3综艺,vdn.apps.cntv.cn/api/getLiveUrlCommonRedirectApi.do?channel=pa://cctv_p2p_hdcctv3&type=ipad
{地方卫视}
北京卫视,live.gslb.letv.com/gslb?stream_id=bjws&tag=live&ext=m3u8&sign=live_tv
北京卫视,tvie01.ucatv.com.cn/channels/xjyx/BeiJing-HD-Suma/flv:BJ_HD_Suma
北京卫视,web-play.pptv.com/web-m3u8-300166.m3u8?type=m3u8.web.pad
东方卫视,zb.v.qq.com:1863/?progid=3900155972
东方卫视,live.gslb.letv.com/gslb?stream_id=dongfang&tag=live&ext=m3u8&sign=live_tv
广东卫视,zb.v.qq.com:1863/?progid=857894899
广东卫视,zb.v.qq.com:1863/?progid=857894899
广东卫视,live.gslb.letv.com/gslb?stream_id=guangdong&tag=live&ext=m3u8&sign=live_tv
通过批处理遍历“频道列表.txt”文件,实现如下功能:
1、遇见中括号内的内容如“{央视频道}”,就通过批处理新建“央视频道”的文件夹,并把此类别下的链接生成txt文件,存放到分类文件夹下
2、然后分类的内容如“CCTV1综合,218.24.47.44/CCTV1.m3u8”就生成“CCTV1综合.txt”文件,“CCTV1综合.txt”文件内容为“218.24.47.44/CCTV1.m3u8”
3、由于分类包含的内容有重复,如“CCTV1综合”,遇到第2个重复的即在生成的"CCTV1综合.txt"后面自动累加个数字“_1”变成"CCTV1综合_1.txt",以此类推,第3个就变成"CCTV1综合_2.txt"
请各位朋友们帮忙看看如何写,谢谢! |