Browse Source

Get rid of fragile recursive rm, move cleanup to mpegize. This way
"mpegize stop" does not have to wait for "mpegize start".

Pavel Machek 10 months ago
parent
commit
48a4b8db2a
2 changed files with 10 additions and 4 deletions
  1. 2 2
      movie.sh.in
  2. 8 2
      mpegize.py

+ 2 - 2
movie.sh.in

@@ -19,10 +19,10 @@ if [ "-$1" == "-start" ]; then
 	echo $! > $GIGA_DIR/audio.pid
 	@LIBEXECDIR@/mpegize.py start $GIGA_DIR/ $DEST_NAME $FPS $MODE
 elif [ "-$1" == "-stop" ]; then
-	kill `cat $2/audio.pid`
+	kill `cat $GIGA_DIR/audio.pid`
+	rm $GIGA_DIR/audio.pid
 	cd $GIGA_DIR
 	@LIBEXECDIR@/mpegize.py stop $GIGA_DIR/ $DEST_NAME $FPS $MODE
-	rm -r $GIGA_DIR
 	echo Message: Rec
 else
 	echo "Unrecognized command"

+ 8 - 2
mpegize.py

@@ -417,6 +417,12 @@ class Mpegize:
     def help(m):
         print("mpegize command base-dir destination-movie fps dng|grw")
 
+    def cleanup(m):
+        os.system("rmdir %s/sm/" % m.base)
+        os.system("rmdir %s/" % m.base)
+        print("Message: Rec")
+        sys.stdout.flush()
+
     def run(m, argv):
         if len(argv) > 2:
             m.base = argv[2]
@@ -440,11 +446,10 @@ class Mpegize:
                 print("Message: proc")
                 sys.stdout.flush()
                 gst_convert(m.base, argv[3], argv[4]=="dng")
+                m.cleanup()
                 return
             if mode == "convert" or mode == "stop":
                 if ext=="grw":
-                    # FIXME: need to wait for other mpegize!
-                    time.sleep(200)
                     return
                 print("Phase 1: jpegize", file=sys.stderr)
                 print("Message: 0%%")
@@ -455,6 +460,7 @@ class Mpegize:
                 print("Message: enc")
                 sys.stdout.flush()
                 gst_convert(m.base, argv[3], argv[4]=="dng")
+                m.cleanup()
                 return
             if mode == "gaps":
                 print("Video gaps")