Jelajahi Sumber

remove unused cmd

David 10 tahun lalu
induk
melakukan
1657b7a0f5
1 mengubah file dengan 6 tambahan dan 21 penghapusan
  1. 6 21
      back/watch.py

+ 6 - 21
back/watch.py

@@ -3,9 +3,6 @@
 # Usage:
 #   ./autocompile.py path ext1
 #
-# Blocks monitoring |path| and its subdirectories for modifications on
-# files ending with suffix |extk|. Run |cmd| each time a modification
-# is detected. |cmd| is optional and defaults to 'make'.
 
 import subprocess
 import sys
@@ -17,10 +14,9 @@ from constants  import RAW_PATH
 from subprocess import Popen,PIPE
 
 class OnWriteHandler(pyinotify.ProcessEvent):
-    def my_init(self, cwd, extension, cmd):
+    def my_init(self, cwd, extension):
         self.cwd = cwd
         self.extension = extension
-        self.cmd = cmd
 
     def _run_cmd(self,path):
         print('==> Modification detected')
@@ -54,27 +50,16 @@ class OnWriteHandler(pyinotify.ProcessEvent):
         print(event.mask, event.maskname, event.pathname)
         self._run_cmd(event.pathname)
 
-def auto_compile(path, extension, cmd):
+def auto_compile(path, extension):
     wm = pyinotify.WatchManager()
-    handler = OnWriteHandler(cwd=path, extension=extension, cmd=cmd)
+    handler = OnWriteHandler(cwd=path, extension=extension)
     notifier = pyinotify.Notifier(wm, default_proc_fun=handler)
     wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True, auto_add=True)
     print('==> Start monitoring %s' % path)
     notifier.loop()
 
 if __name__ == '__main__':
-    if len(sys.argv) < 3:
-        print ("Command line error: missing argument(s).")
-        sys.exit(1)
+    path = '/home/nginx/processed/'
+    extension = 'flv'
 
-    # Required arguments
-    path = sys.argv[1]
-    extension = sys.argv[2]
-
-    # Optional argument
-    cmd = 'ls'
-    if len(sys.argv) == 4:
-        cmd = sys.argv[3]
-
-    # Blocks monitoring
-    auto_compile(path, extension, cmd)
+    auto_compile(path, extension)