+class MPlayer(QObject):
+ play_finished = pyqtSignal()
+ fatal_error = pyqtSignal(str)
+
+ def play(self, video_url):
+ logging.info("Running mplayer: %s", video_url)
+ try:
+ cmd = [
+ MPLAYER_PATH,
+ "-fs",
+ "-lavdopts", "threads=%s" % subprocess.check_output("nproc").strip(),
+ "-volume", "100",
+ video_url,
+ ]
+ subprocess.check_call(cmd)
+ except Exception, e:
+ self.fatal_error.emit(format_exception("MPlayer failed to play the video", e))
+ finally:
+ self.play_finished.emit()
+
+