aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2021-04-19 21:54:00 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2021-04-19 21:54:00 +0100
commit171daf88a753d5683dda695ff83013ae90a76809 (patch)
tree00fb9c7aafe4cd708b4ad27937663ac4c12620df
parent6f29d39a9727688f7f4b25670614abbe66baa957 (diff)
downloadSmallYTChannelBot-171daf88a753d5683dda695ff83013ae90a76809.tar.gz
SmallYTChannelBot-171daf88a753d5683dda695ff83013ae90a76809.zip
fixed some bugs
-rwxr-xr-xonceaday/graph.py (renamed from graph.py)0
-rwxr-xr-xrunprog.py23
-rwxr-xr-xsubreddit.py7
-rwxr-xr-xytapi.py8
4 files changed, 13 insertions, 25 deletions
diff --git a/graph.py b/onceaday/graph.py
index 723997b..723997b 100755
--- a/graph.py
+++ b/onceaday/graph.py
diff --git a/runprog.py b/runprog.py
deleted file mode 100755
index 2cac32a..0000000
--- a/runprog.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from time import sleep
-import subprocess
-import multiprocessing
-
-def thread_():
- subprocess.run(["python3", "subreddit.py"])
-
-while True:
- thread = multiprocessing.Process(target = thread_, args = ())
- thread.start()
-
- sleep(60*60*2)
-
- print("closing...")
- file = open("pid.txt", "r")
- pid = file.readlines()[0]
- file.close()
-
- # subprocess.run(["kill", pid])
- thread.terminate()
-
- print("killed ", pid)
-
diff --git a/subreddit.py b/subreddit.py
index e8c37bb..f4eb8fe 100755
--- a/subreddit.py
+++ b/subreddit.py
@@ -11,7 +11,12 @@ import json
import re
import os
-with open("config.json", "r") as f:
+if os.path.split(os.getcwd())[-1] == "onceaday":
+ configpath = "../config.json"
+else:
+ configpath = "config.json"
+
+with open(configpath, "r") as f:
CONFIG = json.load(f)
REDDIT = praw.Reddit(**CONFIG["redditapi"])
diff --git a/ytapi.py b/ytapi.py
index f134018..509cb7f 100755
--- a/ytapi.py
+++ b/ytapi.py
@@ -2,8 +2,14 @@ from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
import json
import js2py
+import os
-with open("config.json", "r") as f:
+if os.path.split(os.getcwd())[-1] == "onceaday":
+ configpath = "../config.json"
+else:
+ configpath = "config.json"
+
+with open(configpath, "r") as f:
CONFIG = json.load(f)
ERROR_DICT = {