rasker
2007-07-12
Hi
Although many/most torrent applications can create torrent files they don't do them in exactly the way I wnat them to. I am hoping to use cfv for this as it just might do what I want.
I have my files organised in a tree by subject. I share these files with my friends and they want to use the same tree. Right now, if I use other torrent applications to create a torrent I can select the directory containing the files I want to transfer and build the torrent. The problem is the path field is relative to the directory I select. What I want to do is have the the parent directories included but only the files in the directory I have selected.
So for example :
If the tree looks like this:
dir0
--dir1
--dir2
--dir3
--dir4
<files>
--dir5
<files>
--dir6
and I want to transfer the files in dir4 only I want the .torrent file to have a path of dir0/dir3/dir4/<files> for each file. Right now torrent creation utilities will only allow me to create torrents with a path of <files>. I don't want the files in dir0 or dir3 but I wnat the directory structure to remain the same.
This will save much time in having to move files once a download is complete and I don't have to have multiple copies of the files around (1 copy in my organised tree and one in my torrent folder). I can also keep the torrent shared longer before having to reclaim the disk space from the torrent folder (the only reason I stop sharing after some time).
Ideally cfv will do this for me (for example an --appendpath option could add the path to the torrent in each file field and then calculate the SHA1 of the .torrent file (not the actual files in the torrent, which have already been calculated.).
So for now I envisage the following:
1) Create torrent (using any torrrent creator incl cfv)
2) strip the sha1 from the .torrent file (custom script?)
(I believe the .torrent file itself has a sha1 checksum)
3) append the path I desire to each file entry in the torrent file (custom script?)
4) recalculate the sha1 and write out a new .torrent file (use cfv)
So now I have a torrent file which will create the correct path or if it already exists just put the files in the right place and my friends will have the files I want to share with them placed in the same directory structure I have on my machine.
I don't know much about the torrent file structure but if cfv can help me with this then I can investigate further. I hope the description of what I want to acheive is understandable, it confuses me a little! :)
I just want to know if cfv is the tool that can help me achieve this. I would appreciate any help you can give me.
Cheers
R
rasker
2007-07-12
Hmmmm... sourceforge has stripped leading spaces! 'Dir4' and 'dir5' are subdirectories of 'dir3' and the <files> are in 'dir4' and 'dir3' respectively. It was supposed to emulate an explorer view with dirs at the top and files below. So although there are files in dir3, I don't want them included but I want dir3 in the path.
I'm even more confused now! Hope you can point me in the right direction.
Cheers
Rehan
rasker
2007-07-15
After looking at this some more I see that cfv is not the best tool for me. I think I can use the libtorrent functions to do what I wnat. Thanks.
R
Matthew Mueller
2007-07-15
Hi,
You don't actually have to go through all that work, just cd to the top directory (or use -p), and specify the relative parts on the command line. The relative paths will get included already.
Example:
$ ls -R
.:
dir0 testfile
./dir0:
dir1 dir2 dir3 dir6 file
./dir0/dir1:
file1
./dir0/dir2:
file2
./dir0/dir3:
dir4 dir5 file3
./dir0/dir3/dir4:
file4
./dir0/dir3/dir5:
file5
./dir0/dir6:
file6
$ cfv -v --announceurl=foo -rr -C -f foo.torrent dir0/dir3/dir4
dir0/dir3/dir4/file4 : OK (3,pieces 0..0)
foo.torrent: 1 files, 1 OK. 0.004 seconds, 0.8K/s
$ btshowmetainfo foo.torrent
btshowmetainfo 20021207 - decode BitTorrent metainfo files
metainfo file.: foo.torrent
info hash.....: 77cc0f296bd77d43d538fe1caabff489da0b2f31
directory name: dir0
files.........:
dir3/dir4/file4 (3)
archive size..: 3 (0 * 262144 + 3)
announce url..: foo