minor bug fix
This commit is contained in:
@@ -47,6 +47,8 @@ class BackupTask(Thread):
|
|||||||
from game_backuper.leveldb import have_leveldb
|
from game_backuper.leveldb import have_leveldb
|
||||||
if not have_leveldb:
|
if not have_leveldb:
|
||||||
raise ValueError('Leveldb is not supported.')
|
raise ValueError('Leveldb is not supported.')
|
||||||
|
if not exists(f.full_path):
|
||||||
|
continue
|
||||||
from game_backuper.leveldb import (
|
from game_backuper.leveldb import (
|
||||||
list_leveldb_entries,
|
list_leveldb_entries,
|
||||||
leveldb_stats,
|
leveldb_stats,
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class Db:
|
|||||||
self.__write_version()
|
self.__write_version()
|
||||||
if 'files' not in self._exist_table:
|
if 'files' not in self._exist_table:
|
||||||
self.db.execute(FILES_TABLE)
|
self.db.execute(FILES_TABLE)
|
||||||
|
if 'filetype' not in self._exist_table:
|
||||||
|
self.db.execute(FILETYPE_TABLE)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
def __init__(self, loc: str):
|
def __init__(self, loc: str):
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
try:
|
try:
|
||||||
from plyvel import DB
|
from plyvel import DB
|
||||||
have_leveldb = True
|
have_leveldb = True
|
||||||
from typing import List
|
|
||||||
from hashlib import sha512
|
|
||||||
from base64 import b85encode
|
|
||||||
from collections import namedtuple
|
|
||||||
from sqlite3 import connect
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
have_leveldb = False
|
have_leveldb = False
|
||||||
|
|
||||||
|
|
||||||
if have_leveldb:
|
if have_leveldb:
|
||||||
|
from typing import List
|
||||||
|
from hashlib import sha512
|
||||||
|
from base64 import b85encode
|
||||||
|
from collections import namedtuple
|
||||||
|
from sqlite3 import connect
|
||||||
LeveldbStats = namedtuple('LeveldbStats', ['hash', 'size'])
|
LeveldbStats = namedtuple('LeveldbStats', ['hash', 'size'])
|
||||||
MAP_TABLE = '''CREATE TABLE map (
|
MAP_TABLE = '''CREATE TABLE map (
|
||||||
key TEXT,
|
key TEXT,
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ from game_backuper.config import Config
|
|||||||
from game_backuper.cml import Opts
|
from game_backuper.cml import Opts
|
||||||
from game_backuper.db import Db
|
from game_backuper.db import Db
|
||||||
from game_backuper.backuper import Backuper
|
from game_backuper.backuper import Backuper
|
||||||
|
from os import makedirs
|
||||||
|
from os.path import exists
|
||||||
|
|
||||||
|
|
||||||
def main(cm=None):
|
def main(cm=None):
|
||||||
@@ -10,6 +12,8 @@ def main(cm=None):
|
|||||||
cm = sys.argv[1:]
|
cm = sys.argv[1:]
|
||||||
cml = Opts(cm)
|
cml = Opts(cm)
|
||||||
cfg = Config(cml.config_file)
|
cfg = Config(cml.config_file)
|
||||||
|
if not exists(cfg.dest):
|
||||||
|
makedirs(cfg.dest)
|
||||||
db = Db(cfg.dest)
|
db = Db(cfg.dest)
|
||||||
bk = Backuper(db, cfg, cml)
|
bk = Backuper(db, cfg, cml)
|
||||||
return bk.run()
|
return bk.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user