larger chunks, queue existing files for upload
This commit is contained in:
parent
bb2aafcb9d
commit
82ae8c2b51
2 changed files with 13 additions and 1 deletions
|
@ -32,7 +32,7 @@ DEBUG = False
|
||||||
__version__ = pkg_resources.require("pandora_client")[0].version
|
__version__ = pkg_resources.require("pandora_client")[0].version
|
||||||
|
|
||||||
socket.setdefaulttimeout(300)
|
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'))
|
default_media_cache = os.environ.get('oxMEDIA', os.path.join(utils.basedir(), 'media'))
|
||||||
|
|
||||||
DOCUMENT_FORMATS = ('jpg', 'pdf', 'png')
|
DOCUMENT_FORMATS = ('jpg', 'pdf', 'png')
|
||||||
|
|
|
@ -83,6 +83,17 @@ class Server(Resource):
|
||||||
available, unavailable = self.queued()
|
available, unavailable = self.queued()
|
||||||
return available
|
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):
|
def update_status(self, oshash, status):
|
||||||
conn, c = self.client._conn()
|
conn, c = self.client._conn()
|
||||||
site = self.client._config['url']
|
site = self.client._config['url']
|
||||||
|
@ -220,6 +231,7 @@ def run(client, args=None):
|
||||||
if local:
|
if local:
|
||||||
print('broadcasting location via mdns (you can just use pandora_client client on the other side)')
|
print('broadcasting location via mdns (you can just use pandora_client client on the other side)')
|
||||||
client.update_encodes()
|
client.update_encodes()
|
||||||
|
root.queue_available_uploads()
|
||||||
reactor.run()
|
reactor.run()
|
||||||
if local:
|
if local:
|
||||||
del local
|
del local
|
||||||
|
|
Loading…
Reference in a new issue