我正在尝试使用以下方法从此文件中声明以下数据。
这些是我试图从文档中提取的各种数据 * 下士 文件名 内容种类 包装类型 加密状态 容器 文件大小 持续时间 定时文本/ png 音频通道数 2D / 3D FPS *
for each_line in data:
if 'CPL Id:' in each_line:
cpl=(each_line.split())
elif 'ContentTitleText:' in each_line:
content=(each_line.split())
elif 'Errors' in each_line:
errors=(each_line.split())
elif 'ContentKind' in each_line:
contentkind=(each_line.split())
elif 'Composition summary' in each_line:
if 'fps' in each_line:
summmary=(each_line)
print('found comp sum',summary)
这是我的档案:
Script started on Sat 11 Jan 2014 10:57:36 AM PST
#]0;user1@ubuntu: ~#user1@ubuntu:~$ dcp_inspect /media/
dcp_inspect v1.2013.12.16: ["/media/"]
Image/audio analysis: Setting up temp location at /dev/shm/dcp_inspect_temp
[...] p candidates: 0% [ ] ETA --:--:-- Elapsed --:--:--Elapsed 00:00:00====================] ETA 00:00:00 Elapsed 00:00:00
Found 1 Assetmap candidate: ["Overnighters_01/Interop_20140108/ASSETMAP"]
Found 11 files in total
AM 7599203f-a73f-4c55-b967-93c3061e10ea: Schema check: OK: /media/Overnighters_01/Interop_20140108/ASSETMAP
Found 1 Assetmap
AM 7599203f-a73f-4c55-b967-93c3061e10ea: Overnighters_01/Interop_20140108/ASSETMAP
AM 7599203f-a73f-4c55-b967-93c3061e10ea lists 4 assets:
cef846b8-8f85-4cb4-9cb8-f39e53ebe013: Overnighters_01/Interop_20140108/cef846b8-8f85-4cb4-9cb8-f39e53ebe013_pcm.mxf
c2cb9f04-83bf-4829-b4cf-e9963dbaa0d3: Overnighters_01/Interop_20140108/c2cb9f04-83bf-4829-b4cf-e9963dbaa0d3_j2c.mxf
d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Overnighters_01/Interop_20140108/d28cfbbd-9cc7-4cd9-ac18-66fc031b0118_cpl.xml
edc7e9bc-7397-4922-85e2-4ebf5b2d710a: Overnighters_01/Interop_20140108/edc7e9bc-7397-4922-85e2-4ebf5b2d710a_pkl.xml
Assetmap 7599203f-a73f-4c55-b967-93c3061e10ea lists 1 PKL:
PKL file present: edc7e9bc-7397-4922-85e2-4ebf5b2d710a: /media/Overnighters_01/Interop_20140108/edc7e9bc-7397-4922-85e2-4ebf5b2d710a_pkl.xml
Found 1 Package
PKL file present: edc7e9bc-7397-4922-85e2-4ebf5b2d710a: /media/Overnighters_01/Interop_20140108/edc7e9bc-7397-4922-85e2-4ebf5b2d710a_pkl.xml
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a: /media/Overnighters_01/Interop_20140108/edc7e9bc-7397-4922-85e2-4ebf5b2d710a_pkl.xml
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a: Schema check: OK
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a: No Signature node found
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a: AnnotationText: OVERNIGHTERS_20140108
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a lists 3 assets
cef846b8-8f85-4cb4-9cb8-f39e53ebe013: application/x-smpte-mxf;asdcpKind=Sound: Overnighters_01/Interop_20140108/cef846b8-8f85-4cb4-9cb8-f39e53ebe013_pcm.mxf
[...] g hash value: 0% [ ] ETA --:--:-- Elapsed --:--:--[===== ] ETA 00:03:02 Elapsed 00:00:57:02:55
c2cb9f04-83bf-4829-b4cf-e9963dbaa0d3: application/x-smpte-mxf;asdcpKind=Picture: Overnighters_01/Interop_20140108/c2cb9f04-83bf-4829-b4cf-e9963dbaa0d3_j2c.mxf
[...] g hash value: 0% [ ] ETA --:--:-- Elapsed --:--:-- g hash value: 20% [==== ] ETA 00:57:40 Elapsed 00:14:25 00:21:51 Elapsed 00:51:01
d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: text/xml;asdcpKind=CPL: Overnighters_01/Interop_20140108/d28cfbbd-9cc7-4cd9-ac18-66fc031b0118_cpl.xml
[...] g hash value: 0% [ ] ETA --:--:-- Elapsed --:--:--] g hash value: 16% [==== ] ETA 00:00:00 Elapsed 00:00:00A 00:00:00 Elapsed 00:00:00
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a: Package size: 93.9 GB
PKL edc7e9bc-7397-4922-85e2-4ebf5b2d710a lists 1 composition
CPL file present: d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: /media/Overnighters_01/Interop_20140108/d28cfbbd-9cc7-4cd9-ac18-66fc031b0118_cpl.xml
Found 1 Composition
CPL file present: d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: /media/Overnighters_01/Interop_20140108/d28cfbbd-9cc7-4cd9-ac18-66fc031b0118_cpl.xml
CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Reel 1: Audio analysis ...
CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Reel 1: Audio analysis: Done
CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Schema check: OK
CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: No Signature node found
CPL Id: d28cfbbd-9cc7-4cd9-ac18-66fc031b0118
CPL file: /media/Overnighters_01/Interop_20140108/d28cfbbd-9cc7-4cd9-ac18-66fc031b0118_cpl.xml
CPL type: Interop (http://www.digicine.com/PROTO-ASDCP-CPL-20040511#)
ContentTitleText: OVERNIGHTERS_FTR_F_EN_51_2K_20140108_CLO_OV
AnnotationText: [Empty]
ContentKind: feature
IssueDate: 2014-01-08T17:49:36-08:00 (Wednesday Jan 8 2014 17:49)
Issuer: Colorflow Digital
Creator: Colorflow
Number of Reels: 1
Reel 1:
145729 01:41:12+01 @ 24.0 c2cb9f04 MainPicture (MXF Interop, 01:43:53+18, plaintext, 1920x1080, pictures)
145729 01:41:12+01 @ 24.0 cef846b8 MainSound (MXF Interop, 01:43:53+18, plaintext, 6ch 48kHz 24bps, [FAIL], [FAIL], audio)
Total duration:
145729 01:41:12+01 @ 24.0
CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Composition summary: "OVERNIGHTERS_FTR_F_EN_51_2K_20140108_CLO_OV", Interop, Plaintext, 2D, HD, HD, 01:41:12+01, 24.0 fps
Composition complete
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Reel 1: MainPicture has non-DCI aspect ratio 1.778 (1920x1080, HD): Playback with proper non-standard masking recommended
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Reel 1: MainPicture has non-DCI pixel dimensions (1920x1080, HD)
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Naming convention: ContentTitleText "OVERNIGHTERS_FTR_F_EN_51_2K_20140108_CLO_OV" is missing some parts
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Naming convention: 9 parts matching: facility:"CLO" film_title:"OVERNIGHTERS" content_kind:"FTR" aspect_ratio:"F" audio_type:"51" resolution:"2K" studio:"EN" date:"20140108" package_type:"OV"
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Naming convention: 2 parts missing: language, territory_rating
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Naming convention: Part aspect_ratio claims Flat but composition aspect ratio is HD
Hint: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Naming convention: Part resolution claims 2K but composition resolution is HD
Info: CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118: Composition OVERNIGHTERS_FTR_F_EN_51_2K_20140108_CLO_OV was issued 3 days ago
Info: dcp_inspect v1.2013.12.16 on Saturday Jan 11 2014 10:57 (00:01:18:46)
Info: Inspected: /media
Info: Found 1 Package with total size 93.9 GB
Info: Found 1 Assetmap, 1 Package (0 signed), 1 Composition (0 signed, 1 plaintext/0 KDMs required)
Info: 0 Errors, 7 Hints
#]0;user1@ubuntu: ~#user1@ubuntu:~$ exit
exit
Script done on Sat 11 Jan 2014 12:23:55 PM PST
等等。但我没有那么多运气。 例如,在文件的第118行,它有一堆我需要的信息。 Fps,文本类型,标题,2d,运行时等。但是,当我不总是这样时,我如何获取该信息 知道它会是什么? fps可能具有不同于24.0的值,2d可能在另一个文件中为3d,依此类推。
我觉得这对于经常解析文本的人来说并不是什么大问题。
“CPL d28cfbbd-9cc7-4cd9-ac18-66fc031b0118:作文摘要:”OVERNIGHTERS_FTR_F_EN_51_2K_20140108_CLO_OV“,Interop,Plaintext,2D,HD,HD,01:41:12 + 01,24.0 fps “