summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2011-10-10 20:52:45 +0200
committeretobi <git@e-tobi.net>2011-10-10 20:52:45 +0200
commitaad3cec396e544bf3d4c90eecdd1dc1527e69d14 (patch)
tree5268ea4de4c95f44b7182accc181ee5bb5b06ea0
parent153e04c08343cade8fff478829a2845092d9cf98 (diff)
downloadvdrnfofs-aad3cec396e544bf3d4c90eecdd1dc1527e69d14.tar.gz
vdrnfofs-aad3cec396e544bf3d4c90eecdd1dc1527e69d14.tar.bz2
Set mtime of dir nodes to original directories mtime
-rw-r--r--HISTORY1
-rw-r--r--tests/test_gettattr.py3
-rw-r--r--vdrnfofs/filesystemnodes.py1
3 files changed, 5 insertions, 0 deletions
diff --git a/HISTORY b/HISTORY
index 5dd34cc..5acb53c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,7 @@ version 0.8
(Patch provided by Ed Hein)
- Fixed license header in source files - it's the BSD licence now!
- Set mtime of file nodes to recording time (parsed from *.rec)
+ - Set mtime of dir nodes to original directories mtime
- Added homepage http://projects.vdr-developer.org/projects/vdrnfofs
- Some micro optimizations
- Cache the file system nodes user for get_stat() (nodes used for
diff --git a/tests/test_gettattr.py b/tests/test_gettattr.py
index f0af089..9e6cf47 100644
--- a/tests/test_gettattr.py
+++ b/tests/test_gettattr.py
@@ -43,6 +43,8 @@ class TestPathToNodeMapping(unittest.TestCase):
def setUp(self):
self.fs = VdrNfoFs()
self.fs.video = self.video_dir = os.path.abspath(os.path.dirname(__file__) + '/sample_video_dir')
+ time_stamp = time.mktime(datetime.datetime(2011,1,1,11,11).timetuple())
+ os.utime(self.fs.video + '/folder', (time_stamp, time_stamp))
def test_root(self):
attr = self.fs.getattr('/')
@@ -52,6 +54,7 @@ class TestPathToNodeMapping(unittest.TestCase):
def test_dir(self):
attr = self.fs.getattr('/folder')
self.assertEqual(stat.S_IFDIR | 0555, attr.st_mode)
+ self.assertEqual(datetime.datetime(2011,1,1,11,11), datetime.datetime.fromtimestamp(attr.st_mtime))
self.assertEqual(2 + 6, attr.st_nlink)
def test_mpg(self):
diff --git a/vdrnfofs/filesystemnodes.py b/vdrnfofs/filesystemnodes.py
index a25a59c..da785c6 100644
--- a/vdrnfofs/filesystemnodes.py
+++ b/vdrnfofs/filesystemnodes.py
@@ -171,4 +171,5 @@ class DirNode:
attr = NodeAttributes()
attr.st_mode = stat.S_IFDIR | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
attr.st_nlink = 2 + len(self.content())
+ attr.st_mtime = os.path.getmtime(self.path)
return attr