warn and ignore unsupported files
This commit is contained in:
parent
68426aaa6a
commit
abae6e40ca
1 changed files with 18 additions and 6 deletions
|
@ -311,7 +311,10 @@ class Client(object):
|
||||||
break
|
break
|
||||||
if update:
|
if update:
|
||||||
info = utils.avinfo(path)
|
info = utils.avinfo(path)
|
||||||
if info['size'] > 0:
|
if 'error' in info or info['size'] == 0:
|
||||||
|
print info
|
||||||
|
return False
|
||||||
|
else:
|
||||||
oshash = info['oshash']
|
oshash = info['oshash']
|
||||||
sha1 = None
|
sha1 = None
|
||||||
deleted = -1
|
deleted = -1
|
||||||
|
@ -320,8 +323,7 @@ class Client(object):
|
||||||
c.execute(u'INSERT OR REPLACE INTO file values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
c.execute(u'INSERT OR REPLACE INTO file values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||||
t)
|
t)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
else:
|
return True
|
||||||
print info
|
|
||||||
|
|
||||||
def cmd(self, args):
|
def cmd(self, args):
|
||||||
filename = args[0]
|
filename = args[0]
|
||||||
|
@ -415,6 +417,7 @@ class Client(object):
|
||||||
files = []
|
files = []
|
||||||
unknown = []
|
unknown = []
|
||||||
ignored = []
|
ignored = []
|
||||||
|
unsupported = []
|
||||||
for dirpath, dirnames, filenames in os.walk(path, followlinks=True):
|
for dirpath, dirnames, filenames in os.walk(path, followlinks=True):
|
||||||
if isinstance(dirpath, str):
|
if isinstance(dirpath, str):
|
||||||
dirpath = dirpath.decode('utf-8')
|
dirpath = dirpath.decode('utf-8')
|
||||||
|
@ -432,8 +435,10 @@ class Client(object):
|
||||||
unknown.append(f)
|
unknown.append(f)
|
||||||
|
|
||||||
files = list(set(files) - set(unknown))
|
files = list(set(files) - set(unknown))
|
||||||
|
|
||||||
for f in files:
|
for f in files:
|
||||||
self.scan_file(f)
|
if not self.scan_file(f):
|
||||||
|
unsupported.append(f)
|
||||||
|
|
||||||
if unknown:
|
if unknown:
|
||||||
example = example_path(self)
|
example = example_path(self)
|
||||||
|
@ -443,6 +448,13 @@ class Client(object):
|
||||||
print '\n\t'.join([f[len(path):] for f in unknown])
|
print '\n\t'.join([f[len(path):] for f in unknown])
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
|
if unsupported:
|
||||||
|
files = list(set(files) - set(unsupported))
|
||||||
|
print 'The following files are in an unsupported format and will not be synced:'
|
||||||
|
print '\t',
|
||||||
|
print '\n\t'.join([f[len(path):] for f in unsupported])
|
||||||
|
print ''
|
||||||
|
|
||||||
deleted_files = filter(lambda f: f not in files, known_files)
|
deleted_files = filter(lambda f: f not in files, known_files)
|
||||||
new_files = filter(lambda f: f not in known_files, files)
|
new_files = filter(lambda f: f not in known_files, files)
|
||||||
conn, c = self._conn()
|
conn, c = self._conn()
|
||||||
|
@ -452,8 +464,8 @@ class Client(object):
|
||||||
c.execute('UPDATE file SET deleted=? WHERE path=?', (deleted, f))
|
c.execute('UPDATE file SET deleted=? WHERE path=?', (deleted, f))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
print "scanned volume %s: %s files, %s new, %s deleted, %s ignored" % (
|
print "scanned volume %s: %s files, %s new, %s deleted, %s ignored, %s unsupported" % (
|
||||||
name, len(files), len(new_files), len(deleted_files), len(ignored))
|
name, len(files), len(new_files), len(deleted_files), len(ignored), len(unsupported))
|
||||||
|
|
||||||
|
|
||||||
def extract(self, args):
|
def extract(self, args):
|
||||||
|
|
Loading…
Reference in a new issue