diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index c6cddd6..ef5ba78 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -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') diff --git a/pandora_client/server.py b/pandora_client/server.py index 150991e..3b5138c 100644 --- a/pandora_client/server.py +++ b/pandora_client/server.py @@ -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