瀏覽代碼

Mplauer wrapper now static with calssmethod

nico 8 年之前
父節點
當前提交
93a4a94b39
共有 1 個文件被更改,包括 10 次插入8 次删除
  1. 10 8
      core/Players/Mplayer.py

+ 10 - 8
core/Players/Mplayer.py

@@ -12,19 +12,21 @@ MPLAYER_EXEC_PATH = "/usr/bin/mplayer"
 class Mplayer(object):
 
     def __init__(self):
+        pass
+
+    @classmethod
+    def play(cls, filepath):
         mplayer_exec_path = [MPLAYER_EXEC_PATH]
         mplayer_options = ['-slave', '-quiet']
-        self.mplayer_command = list()
-        self.mplayer_command.extend(mplayer_exec_path)
-        self.mplayer_command.extend(mplayer_options)
-
-    def play(self, filepath):
+        mplayer_command = list()
+        mplayer_command.extend(mplayer_exec_path)
+        mplayer_command.extend(mplayer_options)
 
-        self.mplayer_command.append(filepath)
-        logger.debug("Mplayer cmd: %s" % str(self.mplayer_command))
+        mplayer_command.append(filepath)
+        logger.debug("Mplayer cmd: %s" % str(mplayer_command))
 
         FNULL = open(os.devnull, 'w')
 
-        subprocess.call(self.mplayer_command, stdout=FNULL, stderr=FNULL)
+        subprocess.call(mplayer_command, stdout=FNULL, stderr=FNULL)