Add new settings

This commit is contained in:
2024-03-16 08:36:30 +08:00
parent 8a6518f4b6
commit 3e071716a8
3 changed files with 32 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ class Config:
with open(cfg_path, 'r', encoding='UTF-8') as f:
self._data = json.load(f)
else:
self._data['add_images_to_single_page'] = False
self._data['db'] = 'cwm.db'
self._data['save_to_config'] = True
self._data['type'] = 'epub,txt'
@@ -43,6 +44,10 @@ class Config:
self._data[key] = default
return default
@cached_property
def add_images_to_single_page(self):
return self.get_arg('add_images_to_single_page', False)
@cached_property
def book_id(self):
return getattr(self._args, 'bid', None)
@@ -130,7 +135,7 @@ class Config:
@cached_property
def save_to_config(self):
return getattr(self._args, 'save_to_config', True)
return getattr(self._data, 'save_to_config', True)
def save(self):
with open(self._path, 'w', encoding='UTF-8') as f: