Package: eyefiserver
Version: 2.3~rc2+dfsg-1
Severity: wishlist
Tags: patch
--- Please enter the report below this line. ---
File modification times which EyeFi firmware (on Pro X2 at least) puts into the
tarfile are in local time, not UTC as in standard tar files, so images get
wrong
timestamps while extracting. An attempt to correct this proposed with the
patch.
--- System information. ---
Architecture: amd64
Kernel: Linux 3.14.12-custom0-amd64
Debian Release: jessie/sid
990 stable security.debian.org
990 stable kxstudio.sourceforge.net
990 stable ftp.fi.debian.org
990 stable dl.google.com
990 stable deb.torproject.org
500 testing security.debian.org
500 testing ftp.fi.debian.org
500 testing deb.torproject.org
500 lucid ppa.launchpad.net
100 unstable deb.i2p2.no
100 jessie-backports ftp.debian.org
--- Package information. ---
Depends (Version) | Installed
======================-+-===========
python | 2.7.8-1
Package's Recommends field is empty.
Package's Suggests field is empty.
diff -uri a/etc/eyefiserver.conf b/etc/eyefiserver.conf
--- a/etc/eyefiserver.conf 2012-10-17 19:44:55.000000000 +0600
+++ b/etc/eyefiserver.conf 2014-07-27 17:36:47.000000000 +0600
@@ -34,6 +34,11 @@
use_date_from_file=no
+# EyeFi puts local timestamp into its tarfile instead UTC, so extracted files
+# get wrong modification time. This behavior is corrected by default.
+# If it's not what you want, put 'no' here.
+
+#correct_mtime=no
# This parameter executes the specified command on each incoming file passing in
# the full file path as the first argument.
diff -uri a/src/eyefiserver b/src/eyefiserver
--- a/src/eyefiserver 2012-10-17 19:44:55.000000000 +0600
+++ b/src/eyefiserver 2014-07-27 17:37:46.000000000 +0600
@@ -52,6 +52,7 @@
from BaseHTTPServer import BaseHTTPRequestHandler
import BaseHTTPServer
import SocketServer
+import time
# Default is to listen to all addresses on port 59278
# Exemple: SERVER_ADDRESS = '127.0.0.1', 59278
@@ -680,12 +681,18 @@
use_date_from_file = self.server.config.get(macaddress,
'use_date_from_file', False)
+ correct_mtime = self.server.config.getboolean(macaddress,
+ 'correct_mtime', True)
+
# if needed, get reference date from the tar fragment
# This is possible because the tar content is at the begining
if use_date_from_file:
tarinfo = imagetarfile.getmembers()[0]
imageinfo = tarinfo.get_info(encoding=None, errors=None)
- reference_date = datetime.fromtimestamp(imageinfo['mtime'])
+ if correct_mtime:
+ reference_date = datetime.utcfromtimestamp(imageinfo['mtime'])
+ else:
+ reference_date = datetime.fromtimestamp(imageinfo['mtime'])
else:
reference_date = datetime.now()
@@ -704,6 +711,11 @@
imagefilename = imagetarfile.getnames()[0]
imagetarfile.extractall(path=upload_dir)
+ if correct_mtime:
+ corr_mtime = time.mktime(reference_date.timetuple())
+ os.utime(os.path.join(upload_dir, imagefilename),
+ (corr_mtime, corr_mtime))
+
eyeFiLogger.debug("Closing TAR file %s", tarpath)
imagetarfile.close()