py3k compatibility
This commit is contained in:
parent
a1ab5afe68
commit
b3466ffa27
|
@ -57,7 +57,10 @@ else:
|
|||
sys.exit()
|
||||
|
||||
import os
|
||||
from ConfigParser import SafeConfigParser
|
||||
try:
|
||||
from ConfigParser import SafeConfigParser
|
||||
except ImportError:
|
||||
from configparser import ConfigParser as SafeConfigParser
|
||||
|
||||
import logging
|
||||
|
||||
|
|
|
@ -21,11 +21,17 @@
|
|||
|
||||
import os
|
||||
import mimetypes
|
||||
import urlparse
|
||||
import urllib
|
||||
try:
|
||||
import urlparse
|
||||
except ImportError:
|
||||
from urllib import parse as urlparse
|
||||
import logging
|
||||
import shutil
|
||||
import cPickle
|
||||
try:
|
||||
import cPickle
|
||||
except ImportError:
|
||||
import pickle as cPickle
|
||||
from collections import OrderedDict
|
||||
|
||||
import libtorrent as lt
|
||||
|
@ -371,7 +377,7 @@ class Session(lt.session):
|
|||
self.async_add_torrent(tmp_dict)
|
||||
|
||||
def add_torrent_from_hash(self, add_dict, t_uri):
|
||||
add_dict["info_hash"] = lt.info_hash(bytes(t_uri))
|
||||
add_dict["info_hash"] = lt.sha1_hash(bytes(t_uri))
|
||||
self.log.debug("Adding %s", t_uri)
|
||||
self.async_add_torrent(add_dict)
|
||||
|
||||
|
|
Loading…
Reference in New Issue