X-Git-Url: https://git.phdru.name/?p=extfs.d.git;a=blobdiff_plain;f=torrent;fp=torrent;h=7a45d160741a9cf8087366b88dad116aade81edb;hp=cc9dc3dcc2d46691f63591888777f0858123cdc0;hb=abdc722ded2659badbf693e324eb395acab8869a;hpb=f8149878b4b42033610eef9b305e6b71c2e5f549 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)