Skip to content

EkriirkE/Transmission-Torrent-Touch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

The transmission BitTorrent client has an option to execute a script upon torrent completion. When archiving datasets I like to retain a semblance of the original file modification timetamps. By default transmission does no "touching" so the file modification times reflect when that particular file finished downloading. Torrents generated by libtorrent can optionally contain an mtime entry per-file. Most torrents otherwise have a creation date tag overall.

When launced by transmission various environment variables are set. In paritcular there is TR_TORRENT_HASH, and assuming the work files for transmission are in $HOME/.config/transmission/torrent|resume/$TR_TORRENT_HASH we can parse these to "touch" the downloaded files to match the torrent date(s).

First we parse the main .torrent file to get any date metadata. Then we iterate the .resume file which will reflect any file/folder renaming performed by the user. I assume there is a 1:1 relationship in the order of entries betwixt the .torrent and .resume file to properly touch each file (this is only relevant if there are mtime entries).

Additionally I try to handle BEP 47's "pad", "link", and "executable" attributes when available.

About

As a final script started by transmission, touch the mtime of the files downloaded to match that of the torrent date(s)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages