Implement Add by Url in the addtorrentdialog.

This commit is contained in:
Andrew Resch 2008-04-01 00:47:52 +00:00
parent 187fedbb8a
commit aa5da70030
3 changed files with 13 additions and 3 deletions

2
TODO
View File

@ -10,7 +10,7 @@ For 0.6 release:
* Update checking
* Translations
* Show proper priority levels in Files tab, plus add menu to alter priorities
* Implement add by url and add by hash
* Implement add by hash
After 0.6 release:
* Figure out easy way for user-made plugins to add i18n support.

View File

@ -168,6 +168,10 @@ class AddTorrentDialog:
info = lt.torrent_info(filedump)
if str(info.info_hash()) in self.infos:
log.debug("Torrent already in list!")
return
# Get list of files from torrent info
files = []
for f in info.files():
@ -411,9 +415,16 @@ class AddTorrentDialog:
# This is where we need to fetch the .torrent file from the URL and
# add it to the list.
log.debug("url: %s", url)
if url != None:
gobject.idle_add(self.download_from_url, url)
dialog.hide()
def download_from_url(self, url):
import urllib
filename, headers = urllib.urlretrieve(url)
self.add_to_torrent_list([filename])
def _on_button_hash_clicked(self, widget):
log.debug("_on_button_hash_clicked")

View File

@ -856,7 +856,6 @@
<widget class="GtkLabel" id="summary_tracker_status">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="wrap_mode">PANGO_WRAP_CHAR</property>
<property name="selectable">True</property>
</widget>