OpenGL hacks.
[dcpomatic.git] / hacks / make_dummy_files
index f5272278b7490ba083e86446f46d4912eeb858e4..009ae864acbf705add99a9156e0099075b514128 100755 (executable)
@@ -13,6 +13,11 @@ if len(sys.argv) < 2:
 
 tree = ET.parse(os.path.join(sys.argv[1], 'metadata.xml'))
 
+try:
+    os.makedirs(os.path.join(sys.argv[1], 'dummy'))
+except:
+    pass
+
 for c in tree.getroot().find('Playlist').findall('Content'):
     type = c.find('Type').text
     if type == 'DCP':
@@ -72,5 +77,16 @@ for c in tree.getroot().find('Playlist').findall('Content'):
         path = os.path.join(sys.argv[1], 'dummy', ntpath.basename(c.find('Path').text))
         audio_length = int(c.find('AudioLength').text)
         os.system('sox -n -r %d -c %d %s trim 0.0 %f' % (audio_frame_rate, channels, path, float(audio_length) / audio_frame_rate))
+    elif type == 'FFmpeg':
+        if c.find('VideoFrameRate') is not None:
+            video_frame_rate = int(c.find('VideoFrameRate').text)
+            video_length = int(c.find('VideoLength').text)
+            path = os.path.join(sys.argv[1], 'dummy', ntpath.basename(c.find('Path').text))
+            os.system('ffmpeg -t %d -s qcif -f rawvideo -pix_fmt rgb24 -r %d -i /dev/zero -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -shortest "%s"' % (float(video_length) / video_frame_rate, video_frame_rate, path))
+    elif type == 'Image':
+        width = int(c.find('VideoWidth').text)
+        height = int(c.find('VideoHeight').text)
+        path = os.path.join(sys.argv[1], 'dummy', ntpath.basename(c.find('Path').text))
+        os.system('convert -size %dx%d xc:black "%s"' % (width, height, path))
     else:
         print 'Skipped %s' % type