Remove duplicated legacy code for creating directories
This commit is contained in:
parent
e0ff3171d8
commit
5db5d20f77
4 changed files with 3 additions and 36 deletions
|
@ -64,7 +64,6 @@ class GetStream(object):
|
|||
# fired after the metadata and the first data blob have been downloaded
|
||||
self.data_downloading_deferred = defer.Deferred(None)
|
||||
|
||||
|
||||
@property
|
||||
def download_path(self):
|
||||
return os.path.join(self.download_directory, self.downloader.file_name)
|
||||
|
@ -215,7 +214,6 @@ class GetStream(object):
|
|||
safe_stop(self.checker)
|
||||
raise
|
||||
|
||||
|
||||
try:
|
||||
yield self.data_downloading_deferred
|
||||
except Exception as err:
|
||||
|
@ -224,4 +222,3 @@ class GetStream(object):
|
|||
raise
|
||||
|
||||
defer.returnValue((self.downloader, self.finished_deferred))
|
||||
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
import mimetypes
|
||||
|
||||
from appdirs import user_data_dir
|
||||
from zope.interface import implements
|
||||
from twisted.internet import defer, error, interfaces, abstract, task, reactor
|
||||
|
||||
|
||||
# TODO: omg, this code is essentially duplicated in Daemon
|
||||
if sys.platform != "darwin":
|
||||
data_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
data_dir = user_data_dir("LBRY")
|
||||
if not os.path.isdir(data_dir):
|
||||
os.mkdir(data_dir)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
STATUS_FINISHED = 'finished'
|
||||
|
||||
|
||||
class EncryptedFileStreamer(object):
|
||||
"""
|
||||
Writes LBRY stream to request; will pause to wait for new data if the file
|
||||
|
@ -31,7 +21,6 @@ class EncryptedFileStreamer(object):
|
|||
|
||||
bufferSize = abstract.FileDescriptor.bufferSize
|
||||
|
||||
|
||||
# How long to wait between sending blocks (needed because some
|
||||
# video players freeze up if you try to send data too fast)
|
||||
stream_interval = 0.005
|
||||
|
@ -39,7 +28,6 @@ class EncryptedFileStreamer(object):
|
|||
# How long to wait before checking if new data has been appended to the file
|
||||
new_data_check_interval = 0.25
|
||||
|
||||
|
||||
def __init__(self, request, path, stream, file_manager):
|
||||
def _set_content_length_header(length):
|
||||
self._request.setHeader('content-length', length)
|
||||
|
|
|
@ -2,25 +2,15 @@ import logging
|
|||
import os
|
||||
import shutil
|
||||
import json
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
from appdirs import user_data_dir
|
||||
from twisted.web import server, static, resource
|
||||
from twisted.internet import defer, error
|
||||
|
||||
from lbrynet import conf
|
||||
from lbrynet.lbrynet_daemon.FileStreamer import EncryptedFileStreamer
|
||||
|
||||
# TODO: omg, this code is essentially duplicated in Daemon
|
||||
|
||||
if sys.platform != "darwin":
|
||||
data_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
data_dir = user_data_dir("LBRY")
|
||||
if not os.path.isdir(data_dir):
|
||||
os.mkdir(data_dir)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
import json
|
||||
import logging.handlers
|
||||
import sys
|
||||
import os
|
||||
|
||||
from appdirs import user_data_dir
|
||||
from twisted.internet.task import LoopingCall
|
||||
from twisted.internet import reactor
|
||||
from lbrynet import conf
|
||||
|
||||
|
||||
if sys.platform != "darwin":
|
||||
log_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
log_dir = user_data_dir("LBRY")
|
||||
|
||||
if not os.path.isdir(log_dir):
|
||||
os.mkdir(log_dir)
|
||||
|
||||
log_dir = conf.settings['data_dir']
|
||||
LOG_FILENAME = os.path.join(log_dir, 'lbrynet-daemon.log')
|
||||
|
||||
if os.path.isfile(LOG_FILENAME):
|
||||
|
|
Loading…
Reference in a new issue