import gkeepapi # type: ignore
-import constants
+import kiosk_constants
import file_writer
import renderer
import kiosk_secrets as secrets
}
self.keep = gkeepapi.Keep()
success = self.keep.login(
- secrets.google_keep_username, secrets.google_keep_password
+ secrets.google_keep_username,
+ secrets.google_keep_password,
+ secrets.google_keep_mac,
)
if success:
logger.debug("Connected with gkeep.")
def periodic_render(self, key: str) -> bool:
strikethrough = re.compile("(\u2611[^\n]*)\n", re.UNICODE)
- linkify = re.compile(r".*(https?:\/\/\S+).*")
+ #linkify = re.compile(r".*(https?:\/\/\S+).*")
self.keep.sync()
result_list = self.keep.find(labels=[self.keep.findLabel("kiosk")])
contents = contents.replace(
"\u2610 ", '<LI><INPUT TYPE="checkbox"> '
)
- contents = linkify.sub(r'<a href="\1">\1</a>', contents)
+ #contents = linkify.sub(r'<a href="\1">\1</a>', contents)
individual_lines = contents.split("\n")
num_lines = len(individual_lines)
contents = ""
for x in individual_lines:
- length = len(x)
leading_spaces = len(x) - len(x.lstrip(" "))
leading_spaces //= 2
leading_spaces = int(leading_spaces)
<HR style="border-top:3px solid white;">
"""
)
- if num_lines >= 12:
+ if num_lines >= 10:
logger.debug(
f"{num_lines} lines: two column mode"
)
f.write("</DIV>")
else:
logger.debug(f"Note is empty, deleting {filename}.")
- _ = os.path.join(constants.pages_dir, filename)
+ _ = os.path.join(kiosk_constants.pages_dir, filename)
try:
os.remove(_)
except:
# Test
+#logger.setLevel(logging.DEBUG)
+#ch = logging.StreamHandler()
+#ch.setLevel(logging.DEBUG)
+#formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+#ch.setFormatter(formatter)
+#logger.addHandler(ch)
#x = gkeep_renderer({"Test", 1234})
#x.periodic_render("Test")