fix bug and leveldb also support name
This commit is contained in:
@@ -6,8 +6,9 @@ programs:
|
||||
- BGI.gdb # path to a file/folder. All subfolders will include if it is a folder. Must be relative path.
|
||||
- type: path
|
||||
path: folder # path to a file/folder. All subfolders will include if it is a folder. Must be relative path if name not found.
|
||||
name: folder2 # path to the backup files. Shoule be a relative path
|
||||
name: folder2 # optional. path to the backup files. Shoule be a relative path
|
||||
- type: leveldb # module plyvel is needed to support this type. This will store leveldb database to a single file database (sqlite3)
|
||||
path: leveldb # path to leveldb. Must be relative path.
|
||||
name: dest # optional. path to the backup files. Shoule be a relative path
|
||||
domains: # optional. Just backup minor domains in localstorage database. Only chromium is tested.
|
||||
- some domain
|
||||
|
||||
@@ -67,6 +67,9 @@ class Program:
|
||||
else:
|
||||
bp = join(b, i['path'])
|
||||
name = i['path']
|
||||
if 'name' in i and isinstance(i['name'], str):
|
||||
if i['name'] != '':
|
||||
name = i['name']
|
||||
if isfile(bp):
|
||||
r.append(ConfigNormalFile(name, bp))
|
||||
elif isdir(bp):
|
||||
@@ -74,7 +77,17 @@ class Program:
|
||||
for ii in ll:
|
||||
r.append(ConfigNormalFile(join(name, relpath(ii, bp)), ii)) # noqa: E501
|
||||
elif t == 'leveldb':
|
||||
p = join(b, i['path'])
|
||||
if isabs(i['path']):
|
||||
if 'name' not in i or not isinstance(i['name'], str) or i['name'] == '': # noqa: E501
|
||||
raise ValueError('Absolute path must need a name.')
|
||||
p = i['path']
|
||||
n = i['name']
|
||||
else:
|
||||
p = join(b, i['path'])
|
||||
n = i['path']
|
||||
if 'name' in i and isinstance(i['name'], str):
|
||||
if i['name'] != '':
|
||||
n = i['name']
|
||||
dms = None
|
||||
if 'domains' in i and isinstance(i['domains'], list):
|
||||
dms = []
|
||||
@@ -83,7 +96,7 @@ class Program:
|
||||
dms.append(ii.encode())
|
||||
if len(dms) == 0:
|
||||
dms = None
|
||||
r.append(ConfigLeveldb(i['path'], p, dms))
|
||||
r.append(ConfigLeveldb(n, p, dms))
|
||||
return r
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user