diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-17 17:25:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-17 17:25:18 +0100 |
| commit | 1c22ef308a1d62b4c6935ede8233b1fea082b0ca (patch) | |
| tree | c3d8e8321e4b1aa09cce056d5a35da908a0ae3d9 /test/ref/make.py | |
| parent | 0e7591e3bf95d4abe08d854850b6fc4e411586b0 (diff) | |
Various test hackery.
Diffstat (limited to 'test/ref/make.py')
| -rwxr-xr-x | test/ref/make.py | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/test/ref/make.py b/test/ref/make.py index 013a7c24..0b469e24 100755 --- a/test/ref/make.py +++ b/test/ref/make.py @@ -5,17 +5,18 @@ import sys import fileinput from lxml import etree -def replace(l, a, b): - return l.replace(a, b) - assetmap_namespace = 'http://www.smpte-ra.org/schemas/429-9/2007/AM' cpl_namespace = 'http://www.smpte-ra.org/schemas/429-7/2006/CPL' +pkl_namespace = 'http://www.smpte-ra.org/schemas/429-8/2007/PKL' wanted_cpl_id = 'df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb' wanted_pkl_id = '8e293965-f8ad-48c6-971d-261b01f65cdb' wanted_assetmap_id = '18be072e-5a0f-44e1-b2eb-c8a52ae12789' wanted_video_mxf_id = '81fb54df-e1bf-4647-8788-ea7ba154375b' wanted_audio_mxf_id = 'c38bdd62-ce03-4988-8603-195f134207c7' +wanted_reel_id = 'b135d5cf-d180-43d8-b0b3-7373737b73bf' +wanted_asset_hashes = ['E2vhyxdJQhEzSQZdp31w84ZZpfk=', '9OVODrw+zTkSbkGduoQ30k3Kk6Y=', '5E8Q9swcc2bBbFF3IEPNXfIP8gM='] +wanted_issue_date = '2012-07-17T04:45:18+00:00' os.system('rm -rf DCP') os.mkdir('DCP') @@ -27,6 +28,9 @@ os.system('mv *.xml DCP') cpl_id = None pkl_id = None assetmap_id = None +video_mxf_id = None +audio_mxf_id = None +reel_id = None for r, d, f in os.walk('DCP'): for n in f: @@ -61,15 +65,38 @@ audio_mxf_id = xml.getroot().find(cpl_name('ReelList')). \ find(cpl_name('Id')).text audio_mxf_id = audio_mxf_id.replace('urn:uuid:', '') +reel_id = xml.getroot().find(cpl_name('ReelList')). \ + find(cpl_name('Reel')). \ + find(cpl_name('Id')).text +reel_id = reel_id.replace('urn:uuid:', '') + +def pkl_name(s): + return '{%s}%s' % (pkl_namespace, s) + +xml = etree.parse('DCP/%s_pkl.xml' % wanted_pkl_id) + +asset_list = xml.getroot().find(pkl_name('AssetList')) +asset_hashes = [] +print asset_list +for a in asset_list.iter(): + if a.tag == "{%s}Hash" % pkl_namespace: + asset_hashes.append(a.text) + +issue_date = xml.getroot().find(pkl_name('IssueDate')).text + for r, d, f in os.walk('DCP'): for n in f: if n.endswith('.xml'): for line in fileinput.input(os.path.join(r, n), inplace = 1): - line = replace(line, cpl_id, wanted_cpl_id) - line = replace(line, pkl_id, wanted_pkl_id) - line = replace(line, assetmap_id, wanted_assetmap_id) - line = replace(line, video_mxf_id, wanted_video_mxf_id) - line = replace(line, audio_mxf_id, wanted_audio_mxf_id) + line = line.replace(cpl_id, wanted_cpl_id) + line = line.replace(pkl_id, wanted_pkl_id) + line = line.replace(assetmap_id, wanted_assetmap_id) + line = line.replace(video_mxf_id, wanted_video_mxf_id) + line = line.replace(audio_mxf_id, wanted_audio_mxf_id) + line = line.replace(reel_id, wanted_reel_id) + line = line.replace(issue_date, wanted_issue_date) + for i in range(0, len(asset_hashes)): + line = line.replace(asset_hashes[i], wanted_asset_hashes[i]) print line, |
