generate_url.py
#!/usr/bin/env python
import random
import os, sys
channels = [ \
"BTV2", "BTV3", "BTV4", "BTV5", "BTV6", "BTV7", "BTV8", "BTV9", \
"BTVWorld", "CCTV12", "CCTV2", "CCTV3", "CCTV5", "CCTV6", "CCTV6World", "CCTV7", \
"CCTV8", "CCTV9World", "CCTVA", "CCTVChild", "CCTVE", "CCTVEN", "CCTVF", "CCTVFYYY", \
"CCTVHJJC", "CCTVMusic", "CCTVNEWS", "CCTVR", "CETV1", "CETV3", "ChongQingTV", "ChongQingWorld", \
"GZChild", "GZEnglish", "GZFinance", "GZJingSai", "GZMovie", "GanSuTV", "GuangXiTV", "GuiZhouTV", \
]
host = '10.160.1.21'
date = '2014/10/31'
bitrates = ['800000']
ts_path = '/opt/online01/stream'
with open('/opt/urllist', 'wt') as f:
for i in xrange(1, 2**16):
channel = random.choice(channels)
bitrate = random.choice(bitrates)
path = ''.join([ts_path, '/', bitrate, '/', channel, '/', date])
filenames = os.listdir(path)
filename = random.choice(filenames)
ts_url = ''.join(['http://', host, '/', 'online01/stream/', bitrate, '/', channel, '/', date, '/', filename, '\n'])
f.write(ts_url)