Fix missing import, pep8

This commit is contained in:
Chase Sterling 2014-02-19 23:46:53 -05:00
parent fff75b51ce
commit c64da3ceb4
1 changed files with 38 additions and 35 deletions

View File

@ -47,6 +47,7 @@ import pkg_resources
import gettext
import locale
import base64
import urllib
try:
import json
@ -505,6 +506,7 @@ def is_magnet(uri):
return True
return False
def get_magnet_info(uri):
"""
Return information about a magnet link.
@ -540,14 +542,15 @@ def get_magnet_info(uri):
else:
break
elif param.startswith(dn_param):
name = unquote_plus(param[len(dn_param):])
name = urllib.unquote_plus(param[len(dn_param):])
if info_hash:
if not name:
name = info_hash
return {"name":name, "info_hash":info_hash, "files_tree":''}
return {"name": name, "info_hash": info_hash, "files_tree": ''}
return False
def create_magnet_uri(infohash, name=None, trackers=[]):
"""
Creates a magnet uri