|
@@ -50,7 +50,7 @@ def get_list_from_server_txt(filename):
|
|
def init_logging(folder, base_file_name="dbimport-%s.log"):
|
|
def init_logging(folder, base_file_name="dbimport-%s.log"):
|
|
if not exists(folder):
|
|
if not exists(folder):
|
|
return False
|
|
return False
|
|
- filename = folder + "/" + base_file_name
|
|
|
|
|
|
+ filename = "%s/%s" % (folder, base_file_name)
|
|
i = 0
|
|
i = 0
|
|
while exists(filename % i):
|
|
while exists(filename % i):
|
|
i += 1
|
|
i += 1
|
|
@@ -223,20 +223,20 @@ def check_duplicates(database, data):
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
ap = argparse.ArgumentParser()
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument('dest',
|
|
ap.add_argument('dest',
|
|
- help="destination, either an sqlite3 database or query file")
|
|
|
|
|
|
+ help="destination, a sqlite3 database (or query file, if given -q flag)")
|
|
ap.add_argument('src',
|
|
ap.add_argument('src',
|
|
help="source, should be data generated by a Xonotic server")
|
|
help="source, should be data generated by a Xonotic server")
|
|
- ap.add_argument('-t', '--test',
|
|
|
|
- action='store_true',
|
|
|
|
- help="test database for duplicates")
|
|
|
|
ap.add_argument('-q', '--export-query',
|
|
ap.add_argument('-q', '--export-query',
|
|
action='store_true',
|
|
action='store_true',
|
|
help="write query file (as opposed to executing / inserting rows into database)")
|
|
help="write query file (as opposed to executing / inserting rows into database)")
|
|
- ap.add_argument('-l', '--log',
|
|
|
|
|
|
+ ap.add_argument('-t', '--test',
|
|
|
|
+ action='store_true',
|
|
|
|
+ help="test database for duplicates")
|
|
|
|
+ ap.add_argument('-l', '--log-dir',
|
|
type=str,
|
|
type=str,
|
|
help="set folder to store log files")
|
|
help="set folder to store log files")
|
|
args = ap.parse_args()
|
|
args = ap.parse_args()
|
|
- log_dir = args.log or "logs"
|
|
|
|
|
|
+ log_dir = args.log_dir or "logs"
|
|
log_file = init_logging(log_dir)
|
|
log_file = init_logging(log_dir)
|
|
if log_file:
|
|
if log_file:
|
|
print("writing log to folder '%s'," % log_dir, log_file, file=sys.stderr)
|
|
print("writing log to folder '%s'," % log_dir, log_file, file=sys.stderr)
|