Exclude work-related books
This commit is contained in:
parent
f98fd67f5a
commit
795e72b1db
1 changed files with 48 additions and 45 deletions
93
generate.py
93
generate.py
|
@ -111,55 +111,58 @@ for file in concernedfiles:
|
||||||
for action in node.children:
|
for action in node.children:
|
||||||
if action.heading == "read":
|
if action.heading == "read":
|
||||||
for book in action.children:
|
for book in action.children:
|
||||||
bookid = re.sub(" and rated .*","",book.heading)
|
if "work" not in book.tags:
|
||||||
if bookid not in bookids:
|
bookid = re.sub(" and rated .*","",book.heading)
|
||||||
status = "new"
|
if bookid not in bookids:
|
||||||
bookids.append(bookid)
|
status = "new"
|
||||||
else:
|
bookids.append(bookid)
|
||||||
status = "existing"
|
else:
|
||||||
readdate = dateobj
|
status = "existing"
|
||||||
if status == "new":
|
readdate = dateobj
|
||||||
thedict = {"id":bookid,"readdates":[readdate],"progressdates":[],"obtaineddate":""}
|
if status == "new":
|
||||||
books.append(thedict)
|
thedict = {"id":bookid,"readdates":[readdate],"progressdates":[],"obtaineddate":""}
|
||||||
else:
|
books.append(thedict)
|
||||||
twodict = {"id":bookid,"readdates":[readdate]}
|
else:
|
||||||
for origbook in books:
|
twodict = {"id":bookid,"readdates":[readdate]}
|
||||||
if twodict["id"] == origbook["id"]:
|
for origbook in books:
|
||||||
origbook["readdates"].extend(twodict["readdates"])
|
if twodict["id"] == origbook["id"]:
|
||||||
|
origbook["readdates"].extend(twodict["readdates"])
|
||||||
if action.heading == "progress":
|
if action.heading == "progress":
|
||||||
for book in action.children:
|
for book in action.children:
|
||||||
bookid = book.heading
|
if "work" not in book.tags:
|
||||||
if bookid not in bookids:
|
bookid = book.heading
|
||||||
status = "new"
|
if bookid not in bookids:
|
||||||
bookids.append(bookid)
|
status = "new"
|
||||||
else:
|
bookids.append(bookid)
|
||||||
status = "existing"
|
else:
|
||||||
progressdate = dateobj
|
status = "existing"
|
||||||
if status == "new":
|
progressdate = dateobj
|
||||||
thedict = {"id":bookid,"readdates":[],"progressdates":[progressdate],"obtaineddate":""}
|
if status == "new":
|
||||||
books.append(thedict)
|
thedict = {"id":bookid,"readdates":[],"progressdates":[progressdate],"obtaineddate":""}
|
||||||
else:
|
books.append(thedict)
|
||||||
twodict = {"id":bookid,"progressdates":[progressdate]}
|
else:
|
||||||
for origbook in books:
|
twodict = {"id":bookid,"progressdates":[progressdate]}
|
||||||
if twodict["id"] == origbook["id"]:
|
for origbook in books:
|
||||||
origbook["progressdates"].extend(twodict["progressdates"])
|
if twodict["id"] == origbook["id"]:
|
||||||
|
origbook["progressdates"].extend(twodict["progressdates"])
|
||||||
if action.heading == "obtained":
|
if action.heading == "obtained":
|
||||||
for book in action.children:
|
for book in action.children:
|
||||||
bookid = re.sub(" \(.*\)","",book.heading)
|
if "work" not in book.tags:
|
||||||
if bookid not in bookids:
|
bookid = re.sub(" \(.*\)","",book.heading)
|
||||||
status = "new"
|
if bookid not in bookids:
|
||||||
bookids.append(bookid)
|
status = "new"
|
||||||
else:
|
bookids.append(bookid)
|
||||||
status = "existing"
|
else:
|
||||||
obtaineddate = dateobj
|
status = "existing"
|
||||||
if status == "new":
|
obtaineddate = dateobj
|
||||||
thedict = {"id":bookid,"readdates":[],"progressdates":[],"obtaineddate":obtaineddate}
|
if status == "new":
|
||||||
books.append(thedict)
|
thedict = {"id":bookid,"readdates":[],"progressdates":[],"obtaineddate":obtaineddate}
|
||||||
else:
|
books.append(thedict)
|
||||||
twodict = {"id":bookid,"obtaineddate":[obtaineddate]}
|
else:
|
||||||
for origbook in books:
|
twodict = {"id":bookid,"obtaineddate":[obtaineddate]}
|
||||||
if twodict["id"] == origbook["id"]:
|
for origbook in books:
|
||||||
origbook["obtaineddate"] = twodict["obtaineddate"]
|
if twodict["id"] == origbook["id"]:
|
||||||
|
origbook["obtaineddate"] = twodict["obtaineddate"]
|
||||||
if node.heading == "films":
|
if node.heading == "films":
|
||||||
for action in node.children:
|
for action in node.children:
|
||||||
if action.heading == "watched":
|
if action.heading == "watched":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue