forked from platypush/platypush
parse_magnet_uri can return either a metadata object or a dict depending on the libtorrent version
This commit is contained in:
parent
d086da64f6
commit
a8064d2add
1 changed files with 16 additions and 7 deletions
|
@ -258,6 +258,15 @@ class TorrentPlugin(Plugin):
|
|||
if torrent.startswith('magnet:?'):
|
||||
magnet = torrent
|
||||
magnet_info = lt.parse_magnet_uri(magnet)
|
||||
if isinstance(magnet_info, dict):
|
||||
info = {
|
||||
'name': magnet_info.get('name'),
|
||||
'url': magnet,
|
||||
'magnet': magnet,
|
||||
'trackers': magnet_info.get('trackers', []),
|
||||
'save_path': download_dir,
|
||||
}
|
||||
else:
|
||||
info = {
|
||||
'name': magnet_info.name,
|
||||
'url': magnet,
|
||||
|
|
Loading…
Reference in a new issue