y500 / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

Force my torrent name even after metadata will be received for hash-only torrent #135

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Imagine, you have 2 torrents with different files, but both named "data".

If I will add them with torrent_info, I'll call rename_file() on torrent_info 
before adding and will set desired names. Everything ok here.

But If I'll add these torrents just by infohash, I can pass "name" to 
session.add_torrent, but this will work *only* before metadata received. After 
metadata will be received both torrents will be automatically named "data" 
ignoring the "name" I passed.

I cant even change quickly name again in metadata_received alert, because 
colliding names error will be already there :).

Right now I'm deal with this by receiving metadata, removing torrent and adding 
it with new torrent_info again. Ugly!

Original issue reported on code.google.com by mocksoul on 14 Dec 2010 at 6:54

GoogleCodeExporter commented 8 years ago
hm. this is a bit tricky, it has to be done immediately when the metadata is 
received, and it has to be done in the network thread. Maybe some sort of 
plugin support?

just using the name specified when the torrent was added I suppose would work 
for single file torrents and the directory for multi-file torrents. That might 
be a simpler solution for this particular case at least.

Original comment by arvid.no...@gmail.com on 14 Dec 2010 at 6:32

GoogleCodeExporter commented 8 years ago
Allow usage of specified name only for top-level item (either dir or file) is 
perfectly fits my case (one file torrents :)). Rename all other files in 
multi-file torrent is not simple case and, probably, not needed.

Original comment by mocksoul on 14 Dec 2010 at 6:39

GoogleCodeExporter commented 8 years ago
How about this patch? This is against trunk

Original comment by arvid.no...@gmail.com on 19 Dec 2010 at 5:56

Attachments: