我正在尝试解析以下字符串(实际上这是一个列表,无论如何......)。
+ title 1:
+ Main Feature
+ vts 1, ttn 1, cells 0->47 (3155896 blocks)
+ duration: 02:06:44
+ size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
+ autocrop: 0/0/2/0
+ chapters:
+ 1: cells 0->0, 107073 blocks, duration 00:04:06
+ 2: cells 1->1, 104931 blocks, duration 00:04:16
+ 3: cells 2->2, 43568 blocks, duration 00:01:39
+ 4: cells 3->3, 56955 blocks, duration 00:02:27
+ 5: cells 4->4, 50952 blocks, duration 00:01:50
+ 6: cells 5->5, 30214 blocks, duration 00:01:10
+ 7: cells 6->6, 35935 blocks, duration 00:01:26
+ 8: cells 7->7, 99999 blocks, duration 00:04:16
+ 9: cells 8->8, 34513 blocks, duration 00:01:23
+ 10: cells 9->9, 51879 blocks, duration 00:02:14
+ 11: cells 10->10, 43780 blocks, duration 00:01:51
+ 12: cells 11->11, 70721 blocks, duration 00:03:06
+ 13: cells 12->12, 28275 blocks, duration 00:01:06
+ 14: cells 13->13, 105788 blocks, duration 00:04:15
+ 15: cells 14->14, 66071 blocks, duration 00:02:29
+ 16: cells 15->15, 45366 blocks, duration 00:01:55
+ 17: cells 16->16, 54022 blocks, duration 00:02:12
+ 18: cells 17->17, 28551 blocks, duration 00:01:10
+ 19: cells 18->18, 72501 blocks, duration 00:02:54
+ 20: cells 19->19, 111458 blocks, duration 00:04:13
+ 21: cells 20->20, 52493 blocks, duration 00:01:58
+ 22: cells 21->21, 76352 blocks, duration 00:03:17
+ 23: cells 22->22, 72562 blocks, duration 00:03:11
+ 24: cells 23->23, 43124 blocks, duration 00:01:48
+ 25: cells 24->24, 134155 blocks, duration 00:05:01
+ 26: cells 25->25, 61777 blocks, duration 00:02:19
+ 27: cells 26->26, 61983 blocks, duration 00:02:26
+ 28: cells 27->27, 112308 blocks, duration 00:04:40
+ 29: cells 28->28, 44673 blocks, duration 00:01:32
+ 30: cells 29->29, 104886 blocks, duration 00:03:55
+ 31: cells 30->30, 53520 blocks, duration 00:02:10
+ 32: cells 31->31, 75386 blocks, duration 00:03:09
+ 33: cells 32->32, 90275 blocks, duration 00:03:36
+ 34: cells 33->33, 64572 blocks, duration 00:02:29
+ 35: cells 34->34, 26363 blocks, duration 00:01:07
+ 36: cells 35->35, 26959 blocks, duration 00:01:06
+ 37: cells 36->36, 45596 blocks, duration 00:01:49
+ 38: cells 37->37, 74188 blocks, duration 00:03:03
+ 39: cells 38->38, 31681 blocks, duration 00:01:20
+ 40: cells 39->39, 136832 blocks, duration 00:05:40
+ 41: cells 40->40, 84664 blocks, duration 00:03:32
+ 42: cells 41->41, 88245 blocks, duration 00:03:33
+ 43: cells 42->42, 79290 blocks, duration 00:03:15
+ 44: cells 43->43, 34200 blocks, duration 00:01:18
+ 45: cells 44->44, 17481 blocks, duration 00:00:43
+ 46: cells 45->45, 96702 blocks, duration 00:03:26
+ 47: cells 46->46, 34126 blocks, duration 00:01:21
+ 48: cells 47->47, 88951 blocks, duration 00:03:56
+ audio tracks:
+ 1, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 384000bps
+ 2, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ 3, Deutsch (AC3) (5.1 ch) (iso639-2: deu), 48000Hz, 384000bps
+ 4, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 2:
+ vts 1, ttn 2, cells 0->0 (4259 blocks)
+ duration: 00:00:12
+ size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
+ autocrop: 8/0/0/2
+ chapters:
+ 1: cells 0->0, 4259 blocks, duration 00:00:12
+ audio tracks:
+ 1, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 384000bps
+ 2, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ 3, Deutsch (AC3) (5.1 ch) (iso639-2: deu), 48000Hz, 384000bps
+ 4, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 3:
+ vts 1, ttn 3, cells 0->0 (37474 blocks)
+ duration: 00:01:51
+ size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
+ autocrop: 0/0/2/2
+ chapters:
+ 1: cells 0->0, 37474 blocks, duration 00:01:51
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 4:
+ vts 2, ttn 1, cells 0->0 (6817 blocks)
+ duration: 00:00:19
+ size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps
+ autocrop: 4/0/12/0
+ chapters:
+ 1: cells 0->0, 6817 blocks, duration 00:00:19
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 5:
+ vts 2, ttn 2, cells 0->0 (12051 blocks)
+ duration: 00:00:34
+ size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps
+ autocrop: 0/0/10/0
+ chapters:
+ 1: cells 0->0, 12051 blocks, duration 00:00:34
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 6:
+ vts 2, ttn 3, cells 0->0 (12246 blocks)
+ duration: 00:00:35
+ size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps
+ autocrop: 78/80/6/4
+ chapters:
+ 1: cells 0->0, 12246 blocks, duration 00:00:35
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 7:
+ vts 2, ttn 4, cells 0->0 (11983 blocks)
+ duration: 00:00:34
+ size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps
+ autocrop: 78/80/8/4
+ chapters:
+ 1: cells 0->0, 11983 blocks, duration 00:00:34
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ title 8:
+ vts 2, ttn 5, cells 0->0 (34523 blocks)
+ duration: 00:01:37
+ size: 720x576, pixel aspect: 16/15, display aspect: 1.33, 25.000 fps
+ autocrop: 0/0/10/8
+ chapters:
+ 1: cells 0->0, 34523 blocks, duration 00:01:37
+ audio tracks:
+ 1, English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Bitmap)(VOBSUB)
+ 2, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
+ 3, Italiano (iso639-2: ita) (Bitmap)(VOBSUB)
+ 4, Francais (iso639-2: fra) (Bitmap)(VOBSUB)
+ 5, Norsk (iso639-2: nor) (Bitmap)(VOBSUB)
+ 6, Dansk (iso639-2: dan) (Bitmap)(VOBSUB)
+ 7, Svenska (iso639-2: swe) (Bitmap)(VOBSUB)
+ 8, Suomi (iso639-2: fin) (Bitmap)(VOBSUB)
+ 9, Polish (iso639-2: pol) (Bitmap)(VOBSUB)
+ 10, Czech (iso639-2: ces) (Bitmap)(VOBSUB)
+ 11, Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)
我想在这里使用 re 但也许有一个简单的解决方案?我的大脑今天看到了太多的代码。
如果所有信息都存储在单个 dict() 中,那将是最好的
{'title1':
{'duration': '02:06:44',
'audio_tracks':
[{'1': 'English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 384000bps' },
{'2': 'English (AC3) (Dolby Surround) (iso639-2: eng), 48000Hz, 192000bps' },
...]},
'subtitle_tracks':
[{'1': 'English (iso639-2: eng) (Bitmap)(VOBSUB)' },
{'2': 'Deutsch (iso639-2: deu) (Bitmap)(VOBSUB)' },
...]},
}
}
像这样的东西。也许有人有一些提示如何解析:
+ something:
+ some: info,
+ something:,
+ 1: indented information
事物?