|
|
@ -6,6 +6,24 @@ from datetime import datetime
|
|
|
|
thisyear = datetime.now().strftime("%Y")
|
|
|
|
thisyear = datetime.now().strftime("%Y")
|
|
|
|
home = str(Path.home())
|
|
|
|
home = str(Path.home())
|
|
|
|
stats = []
|
|
|
|
stats = []
|
|
|
|
|
|
|
|
rates = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rating = []
|
|
|
|
|
|
|
|
rated = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def rate(line):
|
|
|
|
|
|
|
|
if "and rated" in line:
|
|
|
|
|
|
|
|
rated.append(1)
|
|
|
|
|
|
|
|
if "★★★★★" in line:
|
|
|
|
|
|
|
|
rating.append(5)
|
|
|
|
|
|
|
|
elif "★★★★" in line:
|
|
|
|
|
|
|
|
rating.append(4)
|
|
|
|
|
|
|
|
elif "★★★" in line:
|
|
|
|
|
|
|
|
rating.append(3)
|
|
|
|
|
|
|
|
elif "★★" in line:
|
|
|
|
|
|
|
|
rating.append(2)
|
|
|
|
|
|
|
|
elif "★" in line:
|
|
|
|
|
|
|
|
rating.append(1)
|
|
|
|
|
|
|
|
|
|
|
|
def iterate(category,action,year=thisyear,date=False):
|
|
|
|
def iterate(category,action,year=thisyear,date=False):
|
|
|
|
basedir = home + "/Documents/drive/org/journal/" + str(year)
|
|
|
|
basedir = home + "/Documents/drive/org/journal/" + str(year)
|
|
|
@ -36,6 +54,7 @@ def iterate(category,action,year=thisyear,date=False):
|
|
|
|
print(lines[num].strip() + " " + lines[0].strip())
|
|
|
|
print(lines[num].strip() + " " + lines[0].strip())
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(lines[num].strip())
|
|
|
|
print(lines[num].strip())
|
|
|
|
|
|
|
|
rate(lines[num])
|
|
|
|
count += 1
|
|
|
|
count += 1
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
break
|
|
|
@ -54,20 +73,28 @@ def iterate(category,action,year=thisyear,date=False):
|
|
|
|
print(lines[num].strip() + " " + lines[0].strip())
|
|
|
|
print(lines[num].strip() + " " + lines[0].strip())
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(lines[num].strip())
|
|
|
|
print(lines[num].strip())
|
|
|
|
count += 1
|
|
|
|
rate(lines[num])
|
|
|
|
|
|
|
|
count += 1
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
month += 1
|
|
|
|
month += 1
|
|
|
|
stats.append(count)
|
|
|
|
stats.append(count)
|
|
|
|
|
|
|
|
if (sum(rated)) != 0:
|
|
|
|
|
|
|
|
avg = round((sum(rating)/sum(rated)),2)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
avg = "n/a"
|
|
|
|
|
|
|
|
rates.append(avg)
|
|
|
|
|
|
|
|
rating.clear()
|
|
|
|
|
|
|
|
rated.clear()
|
|
|
|
|
|
|
|
|
|
|
|
def yeargrab(year=thisyear):
|
|
|
|
def yeargrab(year=thisyear):
|
|
|
|
iterate("books","read",year)
|
|
|
|
iterate("books","read",year)
|
|
|
|
iterate("films","watched",year)
|
|
|
|
iterate("films","watched",year)
|
|
|
|
print("* stats")
|
|
|
|
print("* stats")
|
|
|
|
print("** books read: " + str(stats[0]))
|
|
|
|
print("** books read: " + str(stats[0]) + ", average rating: " + str(rates[0]))
|
|
|
|
print("** films watched: " + str(stats[1]))
|
|
|
|
print("** films watched: " + str(stats[1]) + ", average rating: " + str(rates[1]))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
yeargrab()
|
|
|
|
yeargrab()
|
|
|
|