Adding script logging current tracks in queue

This commit is contained in:
2024-05-18 12:45:18 +02:00
parent 848668b8ed
commit f3b03827e2
+26
View File
@@ -0,0 +1,26 @@
# This Python file uses the following encoding: utf-8
"""This module contains utility scripts used by musi radiostation Conjurer"""
import time
import re
NAME = "/home/pi/Conjurer/persistence.log"
def print_top():
"""
Prints the top 65 lines from a file specified by the NAME variable.
"""
while True:
line = ""
buffer = ""
with open(NAME, "r", encoding="utf-8") as f:
for _ in range (65):
line = f.readline()
if re.match("", line):
buffer += line
print("=====================================")
print(buffer)
print("=====================================")
time.sleep(180)
if __name__ == "__main__":
print_top()