Exclude work-related books

This commit is contained in:
mez 2025-04-27 16:25:10 +01:00
parent f98fd67f5a
commit 795e72b1db

View file

@ -111,55 +111,58 @@ for file in concernedfiles:
for action in node.children:
if action.heading == "read":
for book in action.children:
bookid = re.sub(" and rated .*","",book.heading)
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
readdate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[readdate],"progressdates":[],"obtaineddate":""}
books.append(thedict)
else:
twodict = {"id":bookid,"readdates":[readdate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["readdates"].extend(twodict["readdates"])
if "work" not in book.tags:
bookid = re.sub(" and rated .*","",book.heading)
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
readdate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[readdate],"progressdates":[],"obtaineddate":""}
books.append(thedict)
else:
twodict = {"id":bookid,"readdates":[readdate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["readdates"].extend(twodict["readdates"])
if action.heading == "progress":
for book in action.children:
bookid = book.heading
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
progressdate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[],"progressdates":[progressdate],"obtaineddate":""}
books.append(thedict)
else:
twodict = {"id":bookid,"progressdates":[progressdate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["progressdates"].extend(twodict["progressdates"])
if "work" not in book.tags:
bookid = book.heading
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
progressdate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[],"progressdates":[progressdate],"obtaineddate":""}
books.append(thedict)
else:
twodict = {"id":bookid,"progressdates":[progressdate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["progressdates"].extend(twodict["progressdates"])
if action.heading == "obtained":
for book in action.children:
bookid = re.sub(" \(.*\)","",book.heading)
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
obtaineddate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[],"progressdates":[],"obtaineddate":obtaineddate}
books.append(thedict)
else:
twodict = {"id":bookid,"obtaineddate":[obtaineddate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["obtaineddate"] = twodict["obtaineddate"]
if "work" not in book.tags:
bookid = re.sub(" \(.*\)","",book.heading)
if bookid not in bookids:
status = "new"
bookids.append(bookid)
else:
status = "existing"
obtaineddate = dateobj
if status == "new":
thedict = {"id":bookid,"readdates":[],"progressdates":[],"obtaineddate":obtaineddate}
books.append(thedict)
else:
twodict = {"id":bookid,"obtaineddate":[obtaineddate]}
for origbook in books:
if twodict["id"] == origbook["id"]:
origbook["obtaineddate"] = twodict["obtaineddate"]
if node.heading == "films":
for action in node.children:
if action.heading == "watched":