mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 13:34:21 +00:00
If the torrent has been added via a magnet link then try and extract the name from the dn key in the url. Fixes #1154.
This commit is contained in:
parent
228d623aef
commit
296d790421
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from urllib import unquote
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
from deluge._libtorrent import lt
|
||||||
@ -626,7 +627,22 @@ class Torrent(object):
|
|||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
elif self.magnet:
|
||||||
|
try:
|
||||||
|
keys = dict([k.split('=') for k in self.magnet.split('?')[-1].split('&')])
|
||||||
|
name = keys.get('dn')
|
||||||
|
if not name:
|
||||||
|
return self.torrent_id
|
||||||
|
name = unquote(name).replace('+', ' ')
|
||||||
|
try:
|
||||||
|
return name.decode("utf8", "ignore")
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return name
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return self.torrent_id
|
return self.torrent_id
|
||||||
|
|
||||||
def ti_priv():
|
def ti_priv():
|
||||||
if self.handle.has_metadata():
|
if self.handle.has_metadata():
|
||||||
return self.torrent_info.priv()
|
return self.torrent_info.priv()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user