Commits

boralyl committed e8e5319

Allow the ability to pass in a callback to do progress updates, otherwise use the terminal progessbar.

  • Participants
  • Parent commits 01dd3c7

Comments (0)

Files changed (1)

File mkiso/mkiso.py

         self.progress_bar = None
         os.putenv("VIDEO_FORMAT", "NTSC")
 
-    def convert_video(self, video):
+    def convert_video(self, video, callback=None):
         """
         Converts videos into DVD MPEG2 formats
         """
             video_file = Mp4File(video)
 
         if convert:
-            label = "Converting %s to MPEG2: " % (video, )
-            self.setup_progress_bar(label, duration)
-            self.progress_bar.start()
-            video_file.convert(self.update_progress_bar)
-            self.progress_bar.finish()
+            if not callback:
+                label = "Converting %s to MPEG2: " % (video, )
+                self.setup_progress_bar(label, duration)
+                self.progress_bar.start()
+                video_file.convert(self.update_progress_bar)
+                self.progress_bar.finish()
+            else:
+                video_file.convert(callback)
             self.converted_videos.append(mpg_file)
 
     def dvdauthor(self):