1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added some log output

This commit is contained in:
Krateng 2020-06-20 18:15:02 +02:00
parent 5f29cea6ad
commit 4d10276cc1
2 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import os
from ...globalconf import datadir from ...globalconf import datadir
from pathlib import PurePath from pathlib import PurePath
from doreah.logging import log
user_files = { user_files = {
"minimal":[ "minimal":[
@ -26,6 +28,8 @@ def backup(folder,level="full"):
for g in selected_files: for g in selected_files:
real_files += glob.glob(datadir(g)) real_files += glob.glob(datadir(g))
log("Creating backup of " + str(len(real_files)) + " files...")
now = datetime.utcnow() now = datetime.utcnow()
timestr = now.strftime("%Y_%m_%d_%H_%M_%S") timestr = now.strftime("%Y_%m_%d_%H_%M_%S")
filename = "maloja_backup_" + timestr + ".tar.gz" filename = "maloja_backup_" + timestr + ".tar.gz"
@ -36,3 +40,4 @@ def backup(folder,level="full"):
p = PurePath(f) p = PurePath(f)
r = p.relative_to(datadir()) r = p.relative_to(datadir())
archive.add(f,arcname=r) archive.add(f,arcname=r)
log("Backup created!")

View File

@ -35,9 +35,10 @@ def fix():
#with open(datadir("logs","dbfix",nowstr + ".log"),"a") as logfile: #with open(datadir("logs","dbfix",nowstr + ".log"),"a") as logfile:
log("Fixing database...")
for filename in os.listdir(datadir("scrobbles")): for filename in os.listdir(datadir("scrobbles")):
if filename.endswith(".tsv"): if filename.endswith(".tsv"):
log("Fix file " + filename)
filename_new = filename + "_new" filename_new = filename + "_new"
with open(datadir("scrobbles",filename_new),"w") as newfile: with open(datadir("scrobbles",filename_new),"w") as newfile:
@ -68,3 +69,5 @@ def fix():
with open(datadir("scrobbles",filename + ".rulestate"),"w") as checkfile: with open(datadir("scrobbles",filename + ".rulestate"),"w") as checkfile:
checkfile.write(wendigo.checksums) checkfile.write(wendigo.checksums)
log("Database fixed!")