even sync unsupported files if requested via plugin

This commit is contained in:
j 2017-06-03 21:10:40 +02:00
parent db05557ae7
commit 9addcd718c

View file

@ -35,6 +35,7 @@ CHUNK_SIZE = 1024*1024
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')
sync_extensions = ()
def get_frames(filename, prefix, info, force=False): def get_frames(filename, prefix, info, force=False):
oshash = info['oshash'] oshash = info['oshash']
@ -222,7 +223,7 @@ class Client(object):
conn.close() conn.close()
def load_plugins(self, base=os.path.join(utils.basedir(), 'client.d')): def load_plugins(self, base=os.path.join(utils.basedir(), 'client.d')):
global parse_path, example_path, ignore_file, encode global parse_path, example_path, ignore_file, sync_extensions, encode
base = os.path.expanduser(base) base = os.path.expanduser(base)
for path in sorted(glob('%s%s*.py' % (base, os.sep))): for path in sorted(glob('%s%s*.py' % (base, os.sep))):
with open(path) as fp: with open(path) as fp:
@ -233,6 +234,8 @@ class Client(object):
example_path = module.example_path example_path = module.example_path
if hasattr(module, 'ignore_file'): if hasattr(module, 'ignore_file'):
ignore_file = module.ignore_file ignore_file = module.ignore_file
if hasattr(module, 'sync_extensions'):
sync_extensions = module.sync_extensions
if hasattr(module, 'encode'): if hasattr(module, 'encode'):
encode = module.encode encode = module.encode
@ -546,7 +549,7 @@ class Client(object):
files = sorted(set(files) - set(unknown)) files = sorted(set(files) - set(unknown))
for f in files: for f in files:
if not self.scan_file(f, rescan): if os.path.splitext(f)[-1] not in sync_extensions and not self.scan_file(f, rescan):
unsupported.append(f) unsupported.append(f)
if unknown: if unknown: