From d1687eec38de37dfa1363b878ced4a8c73ad3071 Mon Sep 17 00:00:00 2001 From: televex Date: Wed, 24 Feb 2021 17:09:46 +0000 Subject: [PATCH] updating gitignore + add a PYTHON variable in the televex.py --- .gitignore | 3 ++- Makefile | 9 ++++++--- requirements.txt | 1 + screen/televex.py | 9 +++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 784ffa0..a72b04f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv* venv* -print/__pycache__* +*__pycache__* +*.pyc diff --git a/Makefile b/Makefile index db4809b..2847239 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,14 @@ +# Force these recipes to run at every make request +.PHONY: screen print + setup: @python3 -m venv .venv && \ .venv/bin/pip install -r requirements.txt screen: @cd screen && \ - .venv/bin/python televex.py + ../.venv/bin/python televex.py print: - $cd print && \ - .venv/bin/python start.py + @cd print && \ + ../.venv/bin/python start.py diff --git a/requirements.txt b/requirements.txt index b8890db..2e8be02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ icalendar requests pypandoc python-escpos +flask diff --git a/screen/televex.py b/screen/televex.py index fcf8599..e3f9da3 100644 --- a/screen/televex.py +++ b/screen/televex.py @@ -8,6 +8,11 @@ import json import pypandoc import time +# Use local python in the .venv (if it exists) +PYTHON = '../.venv/bin/python' +if not os.path.exists(PYTHON): + PYTHON = 'python3' + ics = get("https://varia.zone/events.ics").text gcal = Calendar.from_ical(ics) now = datetime.datetime.now() @@ -15,11 +20,11 @@ now = datetime.datetime.now() while True: #os.system("toilet --gay -w 125 -W --filter border:gay \ \ \ \ \ VARIA\ \ \ \ \ ") - os.system("./venv/bin/python3 tools/ascii-art-but-with-unicode/repeated_sinus_amplitude_variation.py | lolcat -a -d 1") + os.system(f"{ PYTHON } tools/ascii-art-but-with-unicode/repeated_sinus_amplitude_variation.py | lolcat -a -d 1") print("") time.sleep(1) - os.system("./venv/bin/python3 tools/ascii-art-but-with-unicode/multi_column_page.py | lolcat -a -d 1") + os.system(f"{ PYTHON } tools/ascii-art-but-with-unicode/multi_column_page.py | lolcat -a -d 1") print("") time.sleep(10)