소스 검색

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)