Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open(sys.argv[1], 'rU') as f:
- reader = csv.DictReader(f)
- for row in reader:
- switch_tag = ElementTree.Element('switch')
- attrs = {'src': ("mp4:soundcheck/{year}/{id}/{file_root_name}_256.mp4".format(**row)),'system-bitrate': '336000',}
- attrs = {'src': ("mp4:soundcheck/{year}/{id}/{file_root_name}_512.mp4".format(**row)),'system-bitrate': '592000',}
- attrs = {'src': ("mp4:soundcheck/{year}/{id}/{file_root_name}_768.mp4".format(**row)),'system-bitrate': '848000',}
- attrs = {'src': ("mp4:soundcheck/{year}/{id}/{file_root_name}_1128.mp4".format(**row)),'system-bitrate': '1208000',}
- ElementTree.SubElement(switch_tag, 'video', attrs)
- print minidom.parseString(ElementTree.tostring(switch_tag)).toprettyxml()
- print minidom.parseString(ElementTree.tostring(switch_tag)).toprettyxml()
- I want to look like:
- <switch>
- <video src="mp4:soundcheck/2006/clay_aiken/02_sc_ca_sorry_256.mp4" system-bitrate="336000"/>
- <video src="mp4:soundcheck/2006/clay_aiken/02_sc_ca_sorry_512.mp4" system-bitrate="592000"/>
- <video src="mp4:soundcheck/2006/clay_aiken/02_sc_ca_sorry_768.mp4" system-bitrate="848000"/>
- <video src="mp4:soundcheck/2006/clay_aiken/02_sc_ca_sorry_1128.mp4" system-bitrate="1208000"/>
- </switch>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement