Move format and same book condition functions
This commit is contained in:
parent
bc520497f8
commit
d301a61e92
1 changed files with 21 additions and 22 deletions
43
papis-marvin
43
papis-marvin
|
@ -13,28 +13,6 @@ import re
|
|||
import subprocess
|
||||
|
||||
|
||||
def format_entry(row) -> str:
|
||||
text = f"> {row['HighlightText']}"
|
||||
if row["EntryText"]:
|
||||
if text:
|
||||
text += "\n"
|
||||
else:
|
||||
text = "> "
|
||||
text += f"{row['EntryText']}"
|
||||
return text
|
||||
|
||||
|
||||
_old_title = ""
|
||||
def is_same_book(title):
|
||||
global _old_title
|
||||
|
||||
same = _old_title == title
|
||||
_old_title = title
|
||||
if same:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main(fpath, db):
|
||||
notes = {}
|
||||
with open(fpath) as f:
|
||||
|
@ -82,6 +60,27 @@ def main(fpath, db):
|
|||
|
||||
write_to_files(notes)
|
||||
|
||||
def format_entry(row) -> str:
|
||||
text = f"> {row['HighlightText']}"
|
||||
if row["EntryText"]:
|
||||
if text:
|
||||
text += "\n"
|
||||
else:
|
||||
text = "> "
|
||||
text += f"{row['EntryText']}"
|
||||
return text
|
||||
|
||||
|
||||
_old_title = ""
|
||||
def is_same_book(title):
|
||||
global _old_title
|
||||
|
||||
same = _old_title == title
|
||||
_old_title = title
|
||||
if same:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def write_to_files(notes):
|
||||
# write to notes
|
||||
|
|
Loading…
Reference in a new issue