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:
|
||||
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":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue