From c5e939742887b4e4ec87414c79cb5a01e83c92c6 Mon Sep 17 00:00:00 2001 From: TheDaChicken Date: Sat, 15 Jun 2019 18:59:47 -0700 Subject: [PATCH] Added folder creation for recorded streams. --- SERVER/PYTHON-FILES/Code/__init__.py | 8 ++++++++ SERVER/PYTHON-FILES/__main__.py | 11 +++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/SERVER/PYTHON-FILES/Code/__init__.py b/SERVER/PYTHON-FILES/Code/__init__.py index 3773378..67ff361 100644 --- a/SERVER/PYTHON-FILES/Code/__init__.py +++ b/SERVER/PYTHON-FILES/Code/__init__.py @@ -1,3 +1,4 @@ +import os from threading import Thread from time import sleep @@ -102,3 +103,10 @@ def check_internet(): def enable_debug(): global DebugMode DebugMode = True + + +def setupStreamsFolder(): + # RecordedStreams + recorded_streams_dir = os.path.join(os.getcwd(), "RecordedStreams") + if os.path.exists(recorded_streams_dir) is False: + os.mkdir(recorded_streams_dir) diff --git a/SERVER/PYTHON-FILES/__main__.py b/SERVER/PYTHON-FILES/__main__.py index 09ba547..9b31869 100644 --- a/SERVER/PYTHON-FILES/__main__.py +++ b/SERVER/PYTHON-FILES/__main__.py @@ -1,6 +1,6 @@ import argparse from time import sleep -from Code import run_channel, check_internet, enable_debug +from Code import run_channel, check_internet, enable_debug, setupStreamsFolder from Code.log import stopped, warning, disable_youtube_reply from Code.serverHandler import run_server from Code.dataHandler import createDataFile, loadData, doesDataExist @@ -16,20 +16,15 @@ parser_args = parser.parse_args() - channel_ids = [] + setupStreamsFolder() if not doesDataExist(): createDataFile() - - data = loadData() - channel_ids.extend(data['channel_ids']) - del data + channel_ids = loadData()['channel_ids'] if not check_internet(): stopped("Not able to access the internet!") - sleep(.2) - if parser_args.disable_reply: disable_youtube_reply()