qtfaststart
qtfaststart copied to clipboard
Preserve timestamp of modified file
I have a patch for preserving timestamp of modified file. You can include it into next version.
--- qtfaststart.ori 2012-02-22 03:45:51.290130562 +0100
+++ qtfaststart 2012-02-22 03:36:45.574130608 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""
Command line script for convenience. If this is in your path, you should
@@ -12,6 +12,7 @@
import shutil
import sys
import tempfile
+from stat import *
# Add parent directory to sys.path so that running from dev environment works
sys.path.append(os.path.dirname(os.path.dirname((os.path.abspath(__file__)))))
@@ -72,7 +73,9 @@
if options.sample:
# Create a small sample (4 MiB)
limit = 4 * (1024 ** 2)
-
+
+ stats = os.stat(args[0])
+ mtime, atime = (stats[ST_MTIME], stats[ST_ATIME])
try:
processor.process(args[0], outfile, limit = limit)
except FastStartException:
@@ -82,4 +85,7 @@
if len(args) == 1:
# Move temp file to replace original
shutil.move(outfile, args[0])
+ os.utime(args[0], (atime, mtime))
+ else:
+ os.utime(outfile, (atime, mtime))
Here is a patch for the current version:
--- /usr/local/lib/python2.6/dist-packages/qtfaststart/command.py 2014-01-28 21:47:31.000000000 +0100
+++ /root/command.py 2014-01-28 22:12:28.000000000 +0100
@@ -6,6 +6,7 @@
import shutil
import sys
import tempfile
+from stat import *
from optparse import OptionParser
from qtfaststart import VERSION
@@ -71,6 +72,9 @@
if options.sample:
# Create a small sample (4 MiB)
limit = 4 * (1024 ** 2)
+
+ stats = os.stat(args[0])
+ mtime, atime = (stats[ST_MTIME], stats[ST_ATIME])
try:
processor.process(args[0], outfile, limit = limit, to_end = options.to_end)
@@ -81,3 +85,6 @@
if len(args) == 1:
# Move temp file to replace original
shutil.move(outfile, args[0])
+ os.utime(args[0], (atime, mtime))
+ else:
+ os.utime(outfile, (atime, mtime))