samedi 27 décembre 2014

Create torrent with files from different directories from CLI


I have a directory structure that looks like:



dirA
fileA1
fileA2
...
dirB
fileB1
fileB2
...


I would like to create a torrent using CLI utilities that contains:



dirA/fileA1
dirB/fileB1


(Note: this is a simplified example. In reality, there are four directories and thousands of files in each, and I would like to select ~100 files out of each directory. So solutions that involve simply excluding specific files won't work.)


So far I have tried:



  • ctorrent only lets you specify a single file or directory

  • mktorrent only lets you specify a single file or directory

  • transmission-create only lets you specify a single file or directory

  • py3torrentcreator only lets you specify a single file or directory. It does allow you to specify a pattern of files to exclude, but there are way too many other files to exclude them individually.


I also tried using the Python bindings for libtorrent, but their add_files method strips out the directory names:



>>> import libtorrent as lt
>>> fs = lt.file_storage()
>>> lt.add_files(fs, 'dirA/fileA1')
>>> lt.add_files(fs, 'dirB/fileB1')
>>> print fs.at(0).path
fileA1
>>> t = lt.create_torrent(fs)
>>> lt.set_piece_hashes(t, '.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: No such file or directory


Is there any way to accomplish this?



Aucun commentaire:

Enregistrer un commentaire