forked from LBRYCommunity/lbry-sdk
Using simplejson and fixed some encodes and decodes
This commit is contained in:
parent
0fbf131df3
commit
c01716a6c0
26 changed files with 29 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
||||||
import glob
|
import glob
|
||||||
import json
|
import simplejson as json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import base58
|
import base58
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import binascii
|
import binascii
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from twisted.internet import threads, defer
|
from twisted.internet import threads, defer
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from twisted.internet import error, defer
|
from twisted.internet import error, defer
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import json
|
import simplejson as json
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import datetime
|
||||||
import random
|
import random
|
||||||
import socket
|
import socket
|
||||||
import string
|
import string
|
||||||
import json
|
import simplejson as json
|
||||||
import traceback
|
import traceback
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
|
|
@ -3,7 +3,7 @@ import mimetypes
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import urllib
|
import urllib
|
||||||
import json
|
import simplejson as json
|
||||||
import textwrap
|
import textwrap
|
||||||
import signal
|
import signal
|
||||||
from binascii import hexlify, unhexlify, b2a_hex
|
from binascii import hexlify, unhexlify, b2a_hex
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import simplejson as json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import colorama
|
import colorama
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import json
|
import simplejson as json
|
||||||
|
|
||||||
import treq
|
import treq
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import simplejson as json
|
||||||
import urlparse
|
import urlparse
|
||||||
import requests
|
import requests
|
||||||
from requests.cookies import RequestsCookieJar
|
from requests.cookies import RequestsCookieJar
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
import json
|
import simplejson as json
|
||||||
import inspect
|
import inspect
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import hmac
|
||||||
import hashlib
|
import hashlib
|
||||||
import yaml
|
import yaml
|
||||||
import os
|
import os
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
from lbryschema.decode import smart_decode
|
from lbryschema.decode import smart_decode
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
|
|
@ -268,7 +268,7 @@ class SQLiteStorage(WalletDatabase):
|
||||||
blob_hashes = yield self.run_and_return_list(
|
blob_hashes = yield self.run_and_return_list(
|
||||||
"select blob_hash from blob where status='finished'"
|
"select blob_hash from blob where status='finished'"
|
||||||
)
|
)
|
||||||
defer.returnValue([blob_hash.decode('hex') for blob_hash in blob_hashes])
|
defer.returnValue([bytes.fromhex(blob_hash).decode('latin-1') for blob_hash in blob_hashes])
|
||||||
|
|
||||||
def count_finished_blobs(self):
|
def count_finished_blobs(self):
|
||||||
return self.run_and_return_one_or_none(
|
return self.run_and_return_one_or_none(
|
||||||
|
@ -492,7 +492,8 @@ class SQLiteStorage(WalletDatabase):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def save_downloaded_file(self, stream_hash, file_name, download_directory, data_payment_rate):
|
def save_downloaded_file(self, stream_hash, file_name, download_directory, data_payment_rate):
|
||||||
# touch the closest available file to the file name
|
# touch the closest available file to the file name
|
||||||
file_name = yield open_file_for_writing(download_directory.decode('hex'), file_name.decode('hex'))
|
file_name = yield open_file_for_writing(bytes.fromhex(download_directory).decode(),
|
||||||
|
bytes.fromhex(file_name).decode())
|
||||||
result = yield self.save_published_file(
|
result = yield self.save_published_file(
|
||||||
stream_hash, file_name.encode('hex'), download_directory, data_payment_rate
|
stream_hash, file_name.encode('hex'), download_directory, data_payment_rate
|
||||||
)
|
)
|
||||||
|
|
|
@ -181,7 +181,7 @@ class EncryptedFileSaver(EncryptedFileDownloader):
|
||||||
class EncryptedFileSaverFactory(EncryptedFileDownloaderFactory):
|
class EncryptedFileSaverFactory(EncryptedFileDownloaderFactory):
|
||||||
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet, download_directory):
|
def __init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet, download_directory):
|
||||||
EncryptedFileDownloaderFactory.__init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet)
|
EncryptedFileDownloaderFactory.__init__(self, peer_finder, rate_limiter, blob_manager, storage, wallet)
|
||||||
self.download_directory = binascii.hexlify(download_directory)
|
self.download_directory = binascii.hexlify(download_directory.encode())
|
||||||
|
|
||||||
def _make_downloader(self, stream_hash, payment_rate_manager, stream_info):
|
def _make_downloader(self, stream_hash, payment_rate_manager, stream_info):
|
||||||
stream_name = stream_info.raw_info['stream_name']
|
stream_name = stream_info.raw_info['stream_name']
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from twisted.protocols.basic import FileSender
|
from twisted.protocols.basic import FileSender
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from twisted.internet.error import ConnectionRefusedError
|
from twisted.internet.error import ConnectionRefusedError
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import json
|
import simplejson as json
|
||||||
from twisted.python import failure
|
from twisted.python import failure
|
||||||
from twisted.internet import error, defer
|
from twisted.internet import error, defer
|
||||||
from twisted.internet.protocol import Protocol, ServerFactory
|
from twisted.internet.protocol import Protocol, ServerFactory
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""A test script that downloads blobs from a reflector server"""
|
"""A test script that downloads blobs from a reflector server"""
|
||||||
import argparse
|
import argparse
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
import simplejson as json
|
||||||
import random
|
import random
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import simplejson as json
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ the new blobs to the manager.
|
||||||
import argparse
|
import argparse
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
import json
|
import simplejson as json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import struct
|
import struct
|
||||||
import json
|
import simplejson as json
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -35,7 +35,8 @@ requires = [
|
||||||
'colorama==0.3.7',
|
'colorama==0.3.7',
|
||||||
'six',
|
'six',
|
||||||
'pyopenssl',
|
'pyopenssl',
|
||||||
'service-identity'
|
'service-identity',
|
||||||
|
'simplejson'
|
||||||
]
|
]
|
||||||
|
|
||||||
console_scripts = [
|
console_scripts = [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mock
|
import mock
|
||||||
import json
|
import simplejson as json
|
||||||
import random
|
import random
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import simplejson as json
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from unittest import skipIf
|
from unittest import skipIf
|
||||||
|
|
Loading…
Add table
Reference in a new issue