Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for libtorrent torrent collecting #40

Merged
merged 1 commit into from
Mar 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tribler/Core/APIImplementation/LaunchManyCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def write_my_pref():

if isinstance(tdef, TorrentDefNoMetainfo):
self.torrent_db.addInfohash(tdef.get_infohash(), commit=commit)
self.torrent_db.updateTorrent(tdef.get_infohash(), name=tdef.get_name().encode('utf_8'), commit=commit)
write_my_pref()
elif self.rtorrent_handler:
self.rtorrent_handler.save_torrent(tdef, write_my_pref)
Expand Down
8 changes: 8 additions & 0 deletions Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ def process_alert(self, alert, alert_type):

def on_metadata_received_alert(self, alert):
self.metadata = {'info': lt.bdecode(self.handle.get_torrent_info().metadata())}

trackers = [tracker['url'] for tracker in self.handle.trackers()]
if trackers:
if len(trackers) > 1:
self.metadata["announce-list"] = [trackers]
else:
self.metadata["announce"] = trackers[0]

self.tdef = TorrentDef.load_from_dict(self.metadata)
self.orig_files = [torrent_file.path for torrent_file in lt.torrent_info(self.metadata).files()]
self.set_files()
Expand Down
11 changes: 6 additions & 5 deletions Tribler/Main/Dialogs/SaveAs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ def __init__(self, parent, tdef, defaultdir, defaultname, configfile, selectedFi
torrentsearch_manager = self.guiutility.torrentsearch_manager
def do_collect(delayedResult):
torrent = delayedResult.get()
def callback():
torrent_filename = torrentsearch_manager.getCollectedFilename(torrent)
tdef = TorrentDef.load(torrent_filename)
wx.CallAfter(self.SetCollected, tdef)
torrentsearch_manager.getTorrent(torrent, callback)
if torrent:
def callback():
torrent_filename = torrentsearch_manager.getCollectedFilename(torrent)
tdef = TorrentDef.load(torrent_filename)
wx.CallAfter(self.SetCollected, tdef)
torrentsearch_manager.getTorrent(torrent, callback)
def do_db():
return torrentsearch_manager.getTorrentByInfohash(tdef.get_infohash())
startWorker(do_collect, do_db, retryOnBusy = True, priority = GUI_PRI_DISPERSY)
Expand Down