]> OzVa Git service - spaceweather/commitdiff
fixed last transcript detection
authorwill <greenwoodw50@gmail.com>
Mon, 20 May 2024 21:32:12 +0000 (22:32 +0100)
committerwill <greenwoodw50@gmail.com>
Mon, 20 May 2024 21:32:12 +0000 (22:32 +0100)
.gitignore
config/last [changed mode: 0755->0644]
spaceweather.py
testfile [new file with mode: 0644]

index 41833bf0f259b4035224e025d7806ee63a7eb641..8a6f8ddd59c2e63bc7a29982f824d5bd3ff60252 100644 (file)
@@ -1,3 +1,4 @@
+/config/last
 /spaceweather.wav
 /spaceweather.mp3
 /media/graph*
old mode 100755 (executable)
new mode 100644 (file)
index ec5f1aaa0c2b040d73b33bb3ff19acf616c9a2ae..0053de4cdef5f3c84957200b3cee6a582fb3041d 100755 (executable)
@@ -192,15 +192,20 @@ transcript = generate_transcript()
 text = "\n".join(transcript)
 
 # check the last generated transcript
-with open("config/last", "r") as f:
-       last = f.read()
-
-# quit if the transcript is the same as the last
-if last == text:
-       print("no change!")
-       quit()
-else:
-       print("proceeding...")
+try:
+       with open("config/last", "r") as f:
+               last = f.read()
+
+       # quit if the transcript is the same as the last
+       if last == text:
+               print("no change!")
+               quit()
+       else:
+               print("New spaceweather issued!")
+except FileNotFoundError:
+       print("no previous spaceweather detected!")
+
+print("Generating new spaceweather...")
 
 # write the raw transcript to a file
 with open("config/last", "w") as f: f.write(text)
diff --git a/testfile b/testfile
new file mode 100644 (file)
index 0000000..a8d8fd2
--- /dev/null
+++ b/testfile
@@ -0,0 +1 @@
+testing!