Compare commits

...

4 commits

Author SHA1 Message Date
j
7fbc0f7a76 osx is 3.7 now 2019-01-01 00:26:03 +01:00
j
a73b93b6ec client might have disconnected just now 2019-01-01 00:20:25 +01:00
j
fd6bba5004 load truncated images 2019-01-01 00:19:55 +01:00
j
c27ddd4170 log peer id 2018-12-25 18:24:23 +01:00
4 changed files with 8 additions and 6 deletions

2
ctl
View file

@ -58,7 +58,7 @@ else
fi fi
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
PLATFORM="darwin64" PLATFORM="darwin64"
PLATFORM_PYTHON=3.5 PLATFORM_PYTHON=3.7
fi fi
export PLATFORM_ENV="$BASE/platform_${PLATFORM}" export PLATFORM_ENV="$BASE/platform_${PLATFORM}"
fi fi

View file

@ -217,7 +217,7 @@ class Peer(object):
getpreview = [] getpreview = []
t0 = time.time() t0 = time.time()
if remove: if remove:
logger.debug('remove %s items', len(remove)) logger.debug('remove %s items from %s', len(remove), self.id)
q = item.models.user_items.delete().where(c_user_id.is_(self.id)).where(c_item_id.in_(remove)) q = item.models.user_items.delete().where(c_user_id.is_(self.id)).where(c_item_id.in_(remove))
state.db.session.execute(q) state.db.session.execute(q)
q = user.models.list_items.delete().where(l_list_id.in_(lists)).where(l_item_id.in_(remove)) q = user.models.list_items.delete().where(l_list_id.in_(lists)).where(l_item_id.in_(remove))
@ -231,7 +231,7 @@ class Peer(object):
listitems[row['list_id']].add(row['item_id']) listitems[row['list_id']].add(row['item_id'])
t0 = maybe_commit(t0) t0 = maybe_commit(t0)
if add: if add:
logger.debug('add %s items', len(add)) logger.debug('add %s items from %s', len(add), self.id)
t0 = time.time() t0 = time.time()
q = item.models.user_items.select().where(c_user_id.is_(self.id)) q = item.models.user_items.select().where(c_user_id.is_(self.id))
useritems = {r['item_id'] for r in state.db.session.execute(q)} useritems = {r['item_id'] for r in state.db.session.execute(q)}

View file

@ -155,4 +155,4 @@ class LocalNodes(dict):
def get(self, user_id): def get(self, user_id):
if user_id in self and can_connect(self[user_id]): if user_id in self and can_connect(self[user_id]):
return self[user_id] return self.get(user_id)

View file

@ -4,7 +4,7 @@
from datetime import datetime from datetime import datetime
from io import StringIO, BytesIO from io import StringIO, BytesIO
from PIL import Image from PIL import Image, ImageFile
import base64 import base64
import hashlib import hashlib
import json import json
@ -34,6 +34,7 @@ import logging
logging.getLogger('PIL').setLevel(logging.ERROR) logging.getLogger('PIL').setLevel(logging.ERROR)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
ImageFile.LOAD_TRUNCATED_IMAGES = True
ENCODING = 'base64' ENCODING = 'base64'
def valid_olid(id): def valid_olid(id):
@ -69,7 +70,8 @@ def resize_image(data, width=None, size=None):
data = StringIO(data) data = StringIO(data)
source = Image.open(data) source = Image.open(data)
#if source.mode not in ('1', 'CMYK', 'L', 'RGB', 'RGBA', 'RGBX', 'YCbCr'): #if source.mode not in ('1', 'CMYK', 'L', 'RGB', 'RGBA', 'RGBX', 'YCbCr'):
source = source.convert('RGB') if source.mode != 'RGB':
source = source.convert('RGB')
source_width = source.size[0] source_width = source.size[0]
source_height = source.size[1] source_height = source.size[1]
if size: if size: