Исправления
parent
610983e345
commit
f2788dc63c
|
@ -17,7 +17,7 @@ from . import SessionStatus, FileStatus, PeerInfo, MediaType, Encryption
|
||||||
from util import can_bind, find_free_port, ensure_fs_encoding
|
from util import can_bind, find_free_port, ensure_fs_encoding
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
LOGGING = False
|
LOGGING = True
|
||||||
|
|
||||||
class Engine:
|
class Engine:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,6 +4,7 @@ import argparse
|
||||||
import sys, os
|
import sys, os
|
||||||
import json
|
import json
|
||||||
import chardet
|
import chardet
|
||||||
|
STANDALONE = False
|
||||||
try:
|
try:
|
||||||
from python_libtorrent import get_libtorrent
|
from python_libtorrent import get_libtorrent
|
||||||
lt=get_libtorrent()
|
lt=get_libtorrent()
|
||||||
|
@ -673,12 +674,16 @@ class Pyrrent2http(object):
|
||||||
uriPath = uriPath[1:]
|
uriPath = uriPath[1:]
|
||||||
try:
|
try:
|
||||||
absPath = os.path.abspath(urllib.unquote(uriPath))
|
absPath = os.path.abspath(urllib.unquote(uriPath))
|
||||||
logging.info('Opening local file: %s' % (absPath,))
|
logging.info('Opening local torrent file: %s' % (absPath,))
|
||||||
with open(absPath, 'rb') as f:
|
with open(absPath, 'rb') as f:
|
||||||
torrent_info = lt.torrent_info(lt.bdecode(f.read()))
|
btorrent_info = f.read()
|
||||||
|
logging.info(repr(btorrent_info))
|
||||||
|
dtorrent_info = lt.bdecode(btorrent_info)
|
||||||
|
logging.info(repr(dtorrent_info))
|
||||||
|
torrent_info = lt.torrent_info(dtorrent_info)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
strerror = e.args
|
strerror = e.args
|
||||||
logging.error(strerror)
|
logging.error('Build torrent params error is (%s)' % (strerror,))
|
||||||
if STANDALONE:
|
if STANDALONE:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
@ -1095,7 +1100,7 @@ class Pyrrent2http(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
STANDALONE = False
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
STANDALONE = True
|
STANDALONE = True
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue