From: Oleg Broytman Date: Wed, 8 Jul 2015 18:59:51 +0000 (+0300) Subject: Torrent VFS: set directories date/time X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=abdc722ded2659badbf693e324eb395acab8869a;p=extfs.d.git Torrent VFS: set directories date/time --- diff --git a/torrent b/torrent index cc9dc3d..7a45d16 100755 --- a/torrent +++ b/torrent @@ -38,7 +38,7 @@ __copyright__ = "Copyright (C) 2010-2015 PhiloSoft Design" __license__ = "GPL" -from os.path import getmtime +from os.path import dirname, getmtime import sys from time import localtime, asctime from eff_bdecode import decode @@ -182,10 +182,19 @@ def mctorrent_list(): if 'piece length' in info: meta.append(('.META/piece length', len(str(info['piece length'])))) + paths += meta + dirs = set() + for name, size in paths: + if '/' in name: + dirs.add(dirname(name)) + if not dt: dt = decode_datetime(getmtime(sys.argv[2])) - for name, size in paths + meta: + for name in sorted(dirs): + print "dr-xr-xr-x 1 user group 0 %s %s" % (dt, name) + + for name, size in sorted(paths): print "-r--r--r-- 1 user group %d %s %s" % (size, dt, name) diff --git a/torrent-ANNOUNCE b/torrent-ANNOUNCE index 2102e91..1a89569 100644 --- a/torrent-ANNOUNCE +++ b/torrent-ANNOUNCE @@ -8,7 +8,7 @@ Midnight Commander. WHAT'S NEW Version 1.2.3 (2015-07-08) - Set files date/time to the content of ".META/creation date" file + Set directories/files date/time to the content of ".META/creation date" file if it exists or to the last modification time of the torrent file itself. Version 1.2.2 (2015-01-10) diff --git a/torrent-ChangeLog b/torrent-ChangeLog index 9bcf476..410bdf0 100644 --- a/torrent-ChangeLog +++ b/torrent-ChangeLog @@ -1,6 +1,6 @@ Version 1.2.3 (2015-07-08) - Set files date/time to the content of ".META/creation date" file + Set directories/files date/time to the content of ".META/creation date" file if it exists or to the last modification time of the torrent file itself. Version 1.2.2 (2015-01-10)