diff --git a/application/data.json b/application/data.json index fff3cea..d33ea38 100644 --- a/application/data.json +++ b/application/data.json @@ -1 +1 @@ -{"quotes": [{"q": "A goal is a dream with a deadline.", "a": "Napoleon Hill", "c": "34", "h": "
“A goal is a dream with a deadline.” —
"}, {"q": "The whole of life, from the moment you are born to the moment you die, is a process of learning.", "a": "Jiddu Krishnamurti", "c": "96", "h": "
“The whole of life, from the moment you are born to the moment you die, is a process of learning.” —
"}, {"q": "Anything you may hold firmly in your imagination can be yours.", "a": "William James", "c": "62", "h": "
“Anything you may hold firmly in your imagination can be yours.” —
"}, {"q": "We must embrace pain and burn it as fuel for our journey.", "a": "Kenji Miyazawa", "c": "57", "h": "
“We must embrace pain and burn it as fuel for our journey.” —
"}, {"q": "My guiding principle is this: Guilt is never to be doubted. ", "a": "Franz Kafka", "c": "60", "h": "
“My guiding principle is this: Guilt is never to be doubted. ” —
"}, {"q": "There is a cosmic law which says that every satisfaction must be paid for with a dissatisfaction.", "a": "G.I. Gurdjieff", "c": "97", "h": "
“There is a cosmic law which says that every satisfaction must be paid for with a dissatisfaction.” —
"}, {"q": "If what you're doing is not your passion, you have nothing to lose.", "a": "Celestine Chua", "c": "67", "h": "
“If what you're doing is not your passion, you have nothing to lose.” —
"}, {"q": "Patience is a bitter plant, but its fruit is sweet.", "a": "Chinese Proverb", "c": "51", "h": "
“Patience is a bitter plant, but its fruit is sweet.” —
"}, {"q": "To lose your temper is only useful once a year.", "a": "Colin R. Davis", "c": "47", "h": "
“To lose your temper is only useful once a year.” —
"}, {"q": "Do not follow the ideas of others, but learn to listen to the voice within yourself.", "a": "Dogen", "c": "84", "h": "
“Do not follow the ideas of others, but learn to listen to the voice within yourself.” —
"}, {"q": "No problem can be solved from the same level of consciousness that created it.", "a": "Albert Einstein", "c": "78", "h": "
“No problem can be solved from the same level of consciousness that created it.” —
"}, {"q": "When you stop questioning, you stop learning.", "a": "Lolly Daskal", "c": "45", "h": "
“When you stop questioning, you stop learning.” —
"}, {"q": "The way of success is the way of continuous pursuit of knowledge.", "a": "Napoleon Hill", "c": "65", "h": "
“The way of success is the way of continuous pursuit of knowledge.” —
"}, {"q": "The question is not what you look at, but what you see.", "a": "Henry David Thoreau", "c": "55", "h": "
“The question is not what you look at, but what you see.” —
"}, {"q": "Be kind, for everyone you meet is fighting a harder battle.", "a": "Plato", "c": "59", "h": "
“Be kind, for everyone you meet is fighting a harder battle.” —
"}, {"q": "No matter how qualified or deserving we are, we will never reach a better life until we can imagine it for ourselves and allow ourselves to have it.", "a": "Richard Bach", "c": "148", "h": "
“No matter how qualified or deserving we are, we will never reach a better life until we can imagine it for ourselves and allow ourselves to have it.” —
"}, {"q": "When you are able to employ your will always for constructive purposes, you become the controller of your destiny.", "a": "Paramahansa Yogananda", "c": "114", "h": "
“When you are able to employ your will always for constructive purposes, you become the controller of your destiny.” —
"}, {"q": "You are not stuck where you are unless you decide to be. ", "a": "Wayne Dyer", "c": "58", "h": "
“You are not stuck where you are unless you decide to be. ” —
"}, {"q": "We crave for new sensations but soon become indifferent to them. The wonders of yesterday are today common occurrences ", "a": "Nikola Tesla", "c": "119", "h": "
“We crave for new sensations but soon become indifferent to them. The wonders of yesterday are today common occurrences ” —
"}, {"q": "The day is for honest men, the night for thieves.", "a": "Euripides", "c": "49", "h": "
“The day is for honest men, the night for thieves.” —
"}, {"q": "Life is a traveling to the edge of knowledge, then a leap taken.", "a": "D. H. Lawrence", "c": "64", "h": "
“Life is a traveling to the edge of knowledge, then a leap taken.” —
"}, {"q": "Cherish forever what makes you unique, cuz you're really a yawn if it goes.", "a": "Bette Midler", "c": "75", "h": "
“Cherish forever what makes you unique, cuz you're really a yawn if it goes.” —
"}, {"q": "How much pain they have cost us, the evils which have never happened.", "a": "Thomas Jefferson", "c": "69", "h": "
“How much pain they have cost us, the evils which have never happened.” —
"}, {"q": "All know the way; few actually walk it. ", "a": "Bodhidharma", "c": "40", "h": "
“All know the way; few actually walk it. ” —
"}, {"q": "In spite of everything, I shall rise again.", "a": "Vincent van Gogh", "c": "43", "h": "
“In spite of everything, I shall rise again.” —
"}, {"q": "Continuous effort - not strength or intelligence - is the key to unlocking our potential.", "a": "Winston Churchill", "c": "89", "h": "
“Continuous effort - not strength or intelligence - is the key to unlocking our potential.” —
"}, {"q": "To acquire true self power you have to feel beneath no one, be immune to criticism and be fearless.", "a": "Deepak Chopra", "c": "99", "h": "
“To acquire true self power you have to feel beneath no one, be immune to criticism and be fearless.” —
"}, {"q": "If I love myself I love you. If I love you I love myself.", "a": "Rumi", "c": "57", "h": "
“If I love myself I love you. If I love you I love myself.” —
"}, {"q": "It's easy to wish for health when you're sick. When you're doing well, you need just as much vigilance.", "a": "Kamal Ravikant", "c": "104", "h": "
“It's easy to wish for health when you're sick. When you're doing well, you need just as much vigilance.” —
"}, {"q": "If you can't fly, run. If you can't run, walk. If you can't walk, crawl, but by all means, keep moving.", "a": "Martin Luther King, Jr.", "c": "103", "h": "
“If you can't fly, run. If you can't run, walk. If you can't walk, crawl, but by all means, keep moving.” —
"}, {"q": "The wisest men follow their own direction.", "a": "Euripides", "c": "42", "h": "
“The wisest men follow their own direction.” —
"}, {"q": "Circumstances do not make the man, they reveal him.", "a": "James Allen", "c": "51", "h": "
“Circumstances do not make the man, they reveal him.” —
"}, {"q": "No snowflake ever falls in the wrong place.", "a": "Zen Proverb", "c": "43", "h": "
“No snowflake ever falls in the wrong place.” —
"}, {"q": "We ourselves feel that what we are doing is just a drop in the ocean. But the ocean would be less because of that missing drop.", "a": "Mother Teresa", "c": "127", "h": "
“We ourselves feel that what we are doing is just a drop in the ocean. But the ocean would be less because of that missing drop.” —
"}, {"q": "They who have conquered doubt and fear have conquered failure.", "a": "James Allen", "c": "62", "h": "
“They who have conquered doubt and fear have conquered failure.” —
"}, {"q": "Your home is where your thoughts find peace.", "a": "Zen Proverb", "c": "44", "h": "
“Your home is where your thoughts find peace.” —
"}, {"q": "I would rather die on my feet than live on my knees.", "a": "Euripides", "c": "52", "h": "
“I would rather die on my feet than live on my knees.” —
"}, {"q": "It takes half your life before you discover life is a do-it-yourself project.", "a": "Napoleon Hill", "c": "77", "h": "
“It takes half your life before you discover life is a do-it-yourself project.” —
"}, {"q": "The one who praises you is a thief. The one who criticizes you is your true friend.", "a": "Seungsahn", "c": "83", "h": "
“The one who praises you is a thief. The one who criticizes you is your true friend.” —
"}, {"q": "Life is like riding a bicycle. To keep your balance you must keep moving.", "a": "Albert Einstein", "c": "73", "h": "
“Life is like riding a bicycle. To keep your balance you must keep moving.” —
"}, {"q": "The goal is not to be perfect by the end, the goal is to be better today.", "a": "Simon Sinek", "c": "73", "h": "
“The goal is not to be perfect by the end, the goal is to be better today.” —
"}, {"q": "Fashion fades, only style remains the same.", "a": "Coco Chanel", "c": "43", "h": "
“Fashion fades, only style remains the same.” —
"}, {"q": "Do not bite at the bait of pleasure, till you know there is no hook beneath it.", "a": "Thomas Jefferson", "c": "79", "h": "
“Do not bite at the bait of pleasure, till you know there is no hook beneath it.” —
"}, {"q": "Intelligent men are cruel. Stupid men are monstrously cruel.", "a": "Jack London", "c": "60", "h": "
“Intelligent men are cruel. Stupid men are monstrously cruel.” —
"}, {"q": "Sadness is but a wall between two gardens.", "a": "Kahlil Gibran", "c": "42", "h": "
“Sadness is but a wall between two gardens.” —
"}, {"q": "To the world you may be one person; but to one person you may be the world.", "a": "Dr. Seuss", "c": "75", "h": "
“To the world you may be one person; but to one person you may be the world.” —
"}, {"q": "Fools read fast. Geniuses reread.", "a": "Maxime Lagace", "c": "33", "h": "
“Fools read fast. Geniuses reread.” —
"}, {"q": "Be of good cheer about death, and know this of a truth, that no evil can happen to a good man, either in life or after death.", "a": "Socrates", "c": "125", "h": "
“Be of good cheer about death, and know this of a truth, that no evil can happen to a good man, either in life or after death.” —
"}, {"q": "The greatest of all mistakes is to do nothing because you think you can only do a little. ", "a": "Zig Ziglar", "c": "91", "h": "
“The greatest of all mistakes is to do nothing because you think you can only do a little. ” —
"}, {"q": "Our greatest fears lie in anticipation.", "a": "Honore de Balzac", "c": "39", "h": "
“Our greatest fears lie in anticipation.” —
"}], "quotes_last_updated": 1692738336.831604} \ No newline at end of file +{"quotes": [{"q": "Even if I knew that tomorrow the world would go to pieces, I would still plant my apple tree. ", "a": "Martin Luther", "c": "94", "h": "
“Even if I knew that tomorrow the world would go to pieces, I would still plant my apple tree. ” —
"}, {"q": "Who you are is defined by what you're willing to struggle for.", "a": "Mark Manson", "c": "62", "h": "
“Who you are is defined by what you're willing to struggle for.” —
"}, {"q": "We've got to live, no matter how many skies have fallen.", "a": "D. H. Lawrence", "c": "56", "h": "
“We've got to live, no matter how many skies have fallen.” —
"}, {"q": "The mind that turns ever outward Will have no end to craving. Only the mind turned inward Will find a still-point of peace.", "a": "Ming-Dao Deng", "c": "123", "h": "
“The mind that turns ever outward Will have no end to craving. Only the mind turned inward Will find a still-point of peace.” —
"}, {"q": "Go confidently in the direction of your dreams. Live the life you've imagined.", "a": "Arnold Schwarzenegger", "c": "78", "h": "
“Go confidently in the direction of your dreams. Live the life you've imagined.” —
"}, {"q": "Great acts are made up of small deeds.", "a": "Lao Tzu", "c": "38", "h": "
“Great acts are made up of small deeds.” —
"}, {"q": "Find something you love and do it better than everyone else.", "a": "Gurbaksh Chahal", "c": "60", "h": "
“Find something you love and do it better than everyone else.” —
"}, {"q": "The act of taking the first step is what separates the winners from the losers.", "a": "Brian Tracy", "c": "79", "h": "
“The act of taking the first step is what separates the winners from the losers.” —
"}, {"q": "Have the courage to be ignorant of a great number of things, in order to avoid the calamity of being ignorant of everything.", "a": "Sydney Smith", "c": "124", "h": "
“Have the courage to be ignorant of a great number of things, in order to avoid the calamity of being ignorant of everything.” —
"}, {"q": "There are dark shadows on the earth, but its lights are stronger in the contrast.", "a": "Charles Dickens", "c": "81", "h": "
“There are dark shadows on the earth, but its lights are stronger in the contrast.” —
"}, {"q": "The journey, not the destination matters.", "a": "T.S. Eliot", "c": "41", "h": "
“The journey, not the destination matters.” —
"}, {"q": "Light a candle instead of cursing the darkness.", "a": "Eleanor Roosevelt", "c": "47", "h": "
“Light a candle instead of cursing the darkness.” —
"}, {"q": "Nothing in the world is ever completely wrong. Even a stopped clock is right twice a day.", "a": "Paulo Coelho", "c": "89", "h": "
“Nothing in the world is ever completely wrong. Even a stopped clock is right twice a day.” —
"}, {"q": "You can do two things at once, but you can't focus effectively on two things at once.", "a": "Gary Keller", "c": "85", "h": "
“You can do two things at once, but you can't focus effectively on two things at once.” —
"}, {"q": "The only lost cause is one we give up on before we enter the struggle.", "a": "Vaclav Havel", "c": "70", "h": "
“The only lost cause is one we give up on before we enter the struggle.” —
"}, {"q": "The more you are focused on time - past and future - the more you miss the Now, the most precious thing there is.", "a": "Eckhart Tolle", "c": "113", "h": "
“The more you are focused on time - past and future - the more you miss the Now, the most precious thing there is.” —
"}, {"q": "Where does a thought go when it's forgotten?", "a": "Sigmund Freud", "c": "44", "h": "
“Where does a thought go when it's forgotten?” —
"}, {"q": "Courage is the willingness to engage in a risk-taking behavior regardless of whether the consequences are unknown or possibly adverse.", "a": "Alfred Adler", "c": "134", "h": "
“Courage is the willingness to engage in a risk-taking behavior regardless of whether the consequences are unknown or possibly adverse.” —
"}, {"q": "There are no secrets to success. It is the result of preparation, hard work, learning from failure.", "a": "Colin Powell", "c": "99", "h": "
“There are no secrets to success. It is the result of preparation, hard work, learning from failure.” —
"}, {"q": "If you want to turn a vision into reality, you have to give 100% and never stop believing in your dream.", "a": "Arnold Schwarzenegger", "c": "104", "h": "
“If you want to turn a vision into reality, you have to give 100% and never stop believing in your dream.” —
"}, {"q": "Become the kind of leader that people would follow voluntarily, even if you had no title or position.", "a": "Brian Tracy", "c": "101", "h": "
“Become the kind of leader that people would follow voluntarily, even if you had no title or position.” —
"}, {"q": "Still your waters.", "a": "Josh Waitzkin", "c": "18", "h": "
“Still your waters.” —
"}, {"q": "One is never afraid of the unknown; one is afraid of the known coming to an end.", "a": "Jiddu Krishnamurti", "c": "80", "h": "
“One is never afraid of the unknown; one is afraid of the known coming to an end.” —
"}, {"q": "Youth has no age.", "a": "Pablo Picasso", "c": "17", "h": "
“Youth has no age.” —
"}, {"q": "We forge the chains we wear in life.", "a": "Charles Dickens", "c": "36", "h": "
“We forge the chains we wear in life.” —
"}, {"q": "The key to success is to focus our conscious mind on things we desire not things we fear. ", "a": "Brian Tracy", "c": "90", "h": "
“The key to success is to focus our conscious mind on things we desire not things we fear. ” —
"}, {"q": "Be regular and orderly in your life, so that you may be violent and original in your work.", "a": "Gustave Flaubert", "c": "90", "h": "
“Be regular and orderly in your life, so that you may be violent and original in your work.” —
"}, {"q": "Success is liking yourself, liking what you do, and liking how you do it.", "a": "Maya Angelou", "c": "73", "h": "
“Success is liking yourself, liking what you do, and liking how you do it.” —
"}, {"q": "Quality means doing it right when no one is looking.", "a": "Henry Ford", "c": "52", "h": "
“Quality means doing it right when no one is looking.” —
"}, {"q": "Anxiety is the dizziness of freedom.", "a": "Soren Kierkegaard", "c": "36", "h": "
“Anxiety is the dizziness of freedom.” —
"}, {"q": "Death smiles at us all. All we can do is smile back.", "a": "Marcus Aurelius", "c": "52", "h": "
“Death smiles at us all. All we can do is smile back.” —
"}, {"q": "You have within you right now, everything you need to deal with whatever the world can throw at you.", "a": "Brian Tracy", "c": "100", "h": "
“You have within you right now, everything you need to deal with whatever the world can throw at you.” —
"}, {"q": "Hope and fear come from feeling that we lack something; they come from a sense of poverty.", "a": "Pema Chodron", "c": "90", "h": "
“Hope and fear come from feeling that we lack something; they come from a sense of poverty.” —
"}, {"q": "To live fully is to be always in no-man's-land, to experience each moment as completely new and fresh.", "a": "Pema Chodron", "c": "102", "h": "
“To live fully is to be always in no-man's-land, to experience each moment as completely new and fresh.” —
"}, {"q": "Words are the clothes thoughts wear.", "a": "Samuel Beckett", "c": "36", "h": "
“Words are the clothes thoughts wear.” —
"}, {"q": "Never say never, because limits, like fears, are often just an illusion.", "a": "Michael Jordan", "c": "72", "h": "
“Never say never, because limits, like fears, are often just an illusion.” —
"}, {"q": "If ever you feel like an animal among men, be a lion.", "a": "Criss Jami", "c": "53", "h": "
“If ever you feel like an animal among men, be a lion.” —
"}, {"q": "Sometimes you will never know the value of something, until it becomes a memory.", "a": "Dr. Seuss", "c": "80", "h": "
“Sometimes you will never know the value of something, until it becomes a memory.” —
"}, {"q": "The wise learn many things from their enemies.", "a": "Aristophanes", "c": "46", "h": "
“The wise learn many things from their enemies.” —
"}, {"q": "There's no next time. It's now or never.", "a": "Celestine Chua", "c": "40", "h": "
“There's no next time. It's now or never.” —
"}, {"q": "Everyone has oceans to fly, if they have the heart to do it. Is it reckless? Maybe. But what do dreams know of boundaries.", "a": "Amelia Earhart", "c": "122", "h": "
“Everyone has oceans to fly, if they have the heart to do it. Is it reckless? Maybe. But what do dreams know of boundaries.” —
"}, {"q": "My powers are ordinary. Only my application brings me success.", "a": "Isaac Newton", "c": "62", "h": "
“My powers are ordinary. Only my application brings me success.” —
"}, {"q": "Being wrong opens us up to the possibility of change.", "a": "Mark Manson", "c": "53", "h": "
“Being wrong opens us up to the possibility of change.” —
"}, {"q": "When you've got nothing, you've got nothing to lose.", "a": "Bob Dylan", "c": "52", "h": "
“When you've got nothing, you've got nothing to lose.” —
"}, {"q": "From a certain point onward there is no longer any turning back. That is the point that must be reached.", "a": "Franz Kafka", "c": "104", "h": "
“From a certain point onward there is no longer any turning back. That is the point that must be reached.” —
"}, {"q": "Kind words can be short and easy to speak, but their echoes are truly endless.", "a": "Mother Teresa", "c": "78", "h": "
“Kind words can be short and easy to speak, but their echoes are truly endless.” —
"}, {"q": "When the root is strong, the fruit is sweet.", "a": "Bob Marley", "c": "44", "h": "
“When the root is strong, the fruit is sweet.” —
"}, {"q": "It is very obvious that we are not influenced by 'facts' but by our interpretation of the facts.", "a": "Alfred Adler", "c": "96", "h": "
“It is very obvious that we are not influenced by 'facts' but by our interpretation of the facts.” —
"}, {"q": "When you want to be honored by others, you learn to honor them first.", "a": "Sathya Sai Baba", "c": "69", "h": "
“When you want to be honored by others, you learn to honor them first.” —
"}, {"q": "What have you done today to make someone else happy?", "a": "Deepam Chaterjee", "c": "52", "h": "
“What have you done today to make someone else happy?” —
"}], "quotes_last_updated": 1692758743.967517} \ No newline at end of file diff --git a/application/database.py b/application/database.py index 813c550..73a3d6d 100644 --- a/application/database.py +++ b/application/database.py @@ -52,7 +52,7 @@ class TodoDatabase: def get_random_quote(self): # print(time.time()) - if ("quotes_last_updated" in self.database) or ("quotes" in self.database) or (time.time()-self.database["quotes_last_updated"] > 86400): + if ("quotes_last_updated" not in self.database) or ("quotes" not in self.database) or (time.time()-self.database["quotes_last_updated"] > 86400): self._update_quotes() quote = random.choice(self.database["quotes"]) diff --git a/application/main.py b/application/main.py index 62d6369..78c3750 100644 --- a/application/main.py +++ b/application/main.py @@ -18,6 +18,7 @@ app = FastAPI() auth = VerifyToken() data = TodoDatabase() printer = ThermalPrinter(data) +printer.print_default() #temp debug diff --git a/application/thermal_print.py b/application/thermal_print.py index eac39b5..f28b7c1 100644 --- a/application/thermal_print.py +++ b/application/thermal_print.py @@ -61,6 +61,7 @@ class ThermalPrinter(): self.p.text(datetime.today().strftime('%Y-%m-%d')) self.p.set(align="left") self.p.set(invert=False) + self.p.text("\n") # pass #TODO: add other greetings? def print_todos(self, todos=[{"time": "1:00pm to 2:00pm", "text": "Read a book"}]): @@ -71,6 +72,7 @@ class ThermalPrinter(): self.p.set(align="right") self.p.textln(x[1]) self.p.set(align="left") + self.p.text("\n") def print_sudoku(self): self.p.close() @@ -83,8 +85,11 @@ class ThermalPrinter(): q = self.database.get_random_quote() self.p.set(align="left") self.p.text(q[0]) + self.p.text("\n") self.p.set(align="right") self.p.text(q[1]) + self.p.text("\n") + # pass #TODO: parse https://zenquotes.io/api/quotes (api limit is 5 req per 30 seconds)