diff --git a/MagTag/MagTag_Literature_Clock/code.py b/MagTag/MagTag_Literature_Clock/code.py index f42d3b28b..a61e91cca 100644 --- a/MagTag/MagTag_Literature_Clock/code.py +++ b/MagTag/MagTag_Literature_Clock/code.py @@ -158,7 +158,7 @@ def find_lines_to_show(all_lines, important_passage): hour = f"{now.tm_hour:02d}" # open the data file for the current hour - with open(f"split_data_compressed/{hour}.csv.gz", "rb") as f: + with open(f"quotes_data/{hour}.csv.gz", "rb") as f: # read and unzip the data compressed_data = f.read() rows = zlib.decompress(compressed_data).split(b"\n") @@ -212,9 +212,6 @@ def find_lines_to_show(all_lines, important_passage): # extract the book title title = parts[3] - # set the text in the book info label to show the title and author - book_info_lbl.text = f"{title} - {author}" - # extract the current time reference string time_part = parts[1] @@ -243,7 +240,7 @@ def find_lines_to_show(all_lines, important_passage): # Temporary version of final visible quote joined with spaces instead of newlines, # so we can search for the time_part without worrying about potential newlines. shown_quote_with_spaces = " ".join( - quote_lines[first_line_to_show : first_line_to_show + 7] + quote_lines[first_line_to_show: first_line_to_show + 7] ) # find the current time reference within the quote that will be shown @@ -251,11 +248,23 @@ def find_lines_to_show(all_lines, important_passage): time_end_index = time_start_index + len(time_part) # wrap the quote to be shown to multiple lines and set it on the label - quote_lbl.text = "\n".join(quote_lines[first_line_to_show : first_line_to_show + 7]) + quote_lbl.text = "\n".join(quote_lines[first_line_to_show: first_line_to_show + 7]) # accent the part of the quote that references the current time quote_lbl.add_accent_range(time_start_index, time_end_index, 4, 3, "outline") + # show title and author in the book info label + # allow it to split to two lines if the quote is short enough + if len(quote_lines) <= 6: + book_info = f"{title} - {author}" + book_info_lbl.text = "\n".join(wrap_text_to_pixels( + book_info, + display.width - 4, + terminalio.FONT, + )) + else: + book_info_lbl.text = f"{title} - {author}" + # update the display and wait 60 seconds display.refresh() time.sleep(60) diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/00.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/00.csv.gz new file mode 100644 index 000000000..35640de82 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/00.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/01.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/01.csv.gz new file mode 100644 index 000000000..79f03e54b Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/01.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/02.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/02.csv.gz new file mode 100644 index 000000000..759142625 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/02.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/03.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/03.csv.gz new file mode 100644 index 000000000..59e05df72 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/03.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/04.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/04.csv.gz new file mode 100644 index 000000000..3042a8316 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/04.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/05.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/05.csv.gz new file mode 100644 index 000000000..b82c11410 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/05.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/06.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/06.csv.gz new file mode 100644 index 000000000..9ced1e0b8 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/06.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/07.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/07.csv.gz new file mode 100644 index 000000000..0047537f8 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/07.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/08.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/08.csv.gz new file mode 100644 index 000000000..aabd53635 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/08.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/09.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/09.csv.gz new file mode 100644 index 000000000..877c206b3 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/09.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/10.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/10.csv.gz new file mode 100644 index 000000000..04c9e95d7 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/10.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/11.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/11.csv.gz new file mode 100644 index 000000000..7d29911fe Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/11.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/12.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/12.csv.gz new file mode 100644 index 000000000..f9eb6c29f Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/12.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/13.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/13.csv.gz new file mode 100644 index 000000000..f6b03062a Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/13.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/14.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/14.csv.gz new file mode 100644 index 000000000..a34352a3e Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/14.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/15.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/15.csv.gz new file mode 100644 index 000000000..91ed24773 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/15.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/16.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/16.csv.gz new file mode 100644 index 000000000..dcf46d1a3 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/16.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/17.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/17.csv.gz new file mode 100644 index 000000000..0dc34154e Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/17.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/18.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/18.csv.gz new file mode 100644 index 000000000..b25f11392 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/18.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/19.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/19.csv.gz new file mode 100644 index 000000000..88540c95a Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/19.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/20.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/20.csv.gz new file mode 100644 index 000000000..fcda80c9b Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/20.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/21.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/21.csv.gz new file mode 100644 index 000000000..d7b89d6f6 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/21.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/22.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/22.csv.gz new file mode 100644 index 000000000..0486517e4 Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/22.csv.gz differ diff --git a/MagTag/MagTag_Literature_Clock/quotes_data/23.csv.gz b/MagTag/MagTag_Literature_Clock/quotes_data/23.csv.gz new file mode 100644 index 000000000..484302f3f Binary files /dev/null and b/MagTag/MagTag_Literature_Clock/quotes_data/23.csv.gz differ