parse_magnet_uri can return either a metadata object or a dict depending on the libtorrent version

This commit is contained in:
Fabio Manganiello 2021-08-05 20:23:54 +02:00
parent d086da64f6
commit a8064d2add

View file

@ -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,