larger chunks, queue existing files for upload

This commit is contained in:
j 2018-03-01 10:58:14 +05:30
parent bb2aafcb9d
commit 82ae8c2b51
2 changed files with 13 additions and 1 deletions

View File

@ -32,7 +32,7 @@ DEBUG = False
__version__ = pkg_resources.require("pandora_client")[0].version
socket.setdefaulttimeout(300)
CHUNK_SIZE = 1024*1024
CHUNK_SIZE = 1024*1024*5
default_media_cache = os.environ.get('oxMEDIA', os.path.join(utils.basedir(), 'media'))
DOCUMENT_FORMATS = ('jpg', 'pdf', 'png')

View File

@ -83,6 +83,17 @@ class Server(Resource):
available, unavailable = self.queued()
return available
def queue_available_uploads(self):
files = self.queued_encodes()
for oshash in files:
info = self.client.info(oshash)
if not info or 'error' in info:
continue
path = self.media_path(oshash)
if os.path.exists(path) and os.stat(path).st_size > 0:
self.update_status(oshash, 'done')
self.upload.put(oshash)
def update_status(self, oshash, status):
conn, c = self.client._conn()
site = self.client._config['url']
@ -220,6 +231,7 @@ def run(client, args=None):
if local:
print('broadcasting location via mdns (you can just use pandora_client client on the other side)')
client.update_encodes()
root.queue_available_uploads()
reactor.run()
if local:
del local