Fix the filmsum script up a little.
authorCarl Hetherington <cth@carlh.net>
Mon, 1 Nov 2021 21:39:12 +0000 (22:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 1 Nov 2021 21:39:12 +0000 (22:39 +0100)
hacks/filmsum

index bda8740c3667797f0091ca263bbd816b4284f521..39393729fff7866a451e3e31b5d9e39c8a9fe367 100755 (executable)
@@ -21,7 +21,7 @@ def note(k, v, highlight=None):
         print('%20s: %s' % (k, v))
 
 def bool_note(k, v, highlight=None):
-    v = 'yes' if v == 1 else 'no'
+    v = 'yes' if (v is not None and v.text == "1") else 'no'
     note(k, v, highlight)
 
 def dcp_time(s):
@@ -36,6 +36,7 @@ def dcp_time(s):
     m -= h * 60
     return '%s DCP_%02d:%02d:%02d.%02d' % (str(raw).ljust(8), h, m, s, f)
 
+
 def content_time_from_frames(s, r):
     raw = int(s.text)
     f = raw
@@ -54,8 +55,8 @@ note('J2K bandwidth', soup.Metadata.J2KBandwidth.text, lambda x: int(x) < 200000
 note('Video frame rate', soup.Metadata.VideoFrameRate.text, lambda x: int(x) not in [24, 25, 30])
 dcp_rate = int(soup.Metadata.VideoFrameRate.text)
 note('Audio channels', soup.Metadata.AudioChannels.text)
-bool_note('3D', soup.Metadata.ThreeD.text, lambda x: not x)
-bool_note('Encrypted', soup.Metadata.ThreeD.text, lambda x: not x)
+bool_note('3D', soup.Metadata.ThreeD, lambda x: not x)
+bool_note('Encrypted', soup.Metadata.ThreeD, lambda x: not x)
 reel_types = ['single', 'by-video', 'by-length']
 note('Reel type', reel_types[int(soup.ReelType.text)])
 for c in soup.Metadata.Playlist.children:
@@ -63,6 +64,8 @@ for c in soup.Metadata.Playlist.children:
         print()
         note('  Type', c.Type.text)
         note('  Position', dcp_time(c.Position))
+        note('  Trim start', c.TrimStart.text)
+        note('  Trim end', c.TrimEnd.text)
         if c.VideoFrameRate:
             note('  Video rate', c.VideoFrameRate.text)
             note('  Video length', content_time_from_frames(c.VideoLength, float(c.VideoFrameRate.text)))