|
@@ -50,7 +50,7 @@ def get_list_from_server_txt(filename):
|
|
|
def init_logging(folder, base_file_name="dbimport-%s.log"):
|
|
|
if not exists(folder):
|
|
|
return False
|
|
|
- filename = folder + "/" + base_file_name
|
|
|
+ filename = "%s/%s" % (folder, base_file_name)
|
|
|
i = 0
|
|
|
while exists(filename % i):
|
|
|
i += 1
|
|
@@ -223,20 +223,20 @@ def check_duplicates(database, data):
|
|
|
if __name__ == "__main__":
|
|
|
ap = argparse.ArgumentParser()
|
|
|
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',
|
|
|
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',
|
|
|
action='store_true',
|
|
|
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,
|
|
|
help="set folder to store log files")
|
|
|
args = ap.parse_args()
|
|
|
- log_dir = args.log or "logs"
|
|
|
+ log_dir = args.log_dir or "logs"
|
|
|
log_file = init_logging(log_dir)
|
|
|
if log_file:
|
|
|
print("writing log to folder '%s'," % log_dir, log_file, file=sys.stderr)
|