From fb57fc4de71a21627dc7a2e8f9f546500a641c79 Mon Sep 17 00:00:00 2001 From: Moe Fwacky Date: Wed, 17 Feb 2021 01:43:25 -0800 Subject: [PATCH] added database scan function --- main-dir/controls.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main-dir/controls.py b/main-dir/controls.py index 57c278f..6a0ecd7 100644 --- a/main-dir/controls.py +++ b/main-dir/controls.py @@ -148,6 +148,17 @@ def generate_daily_schedules(channelsList): print(output.strip()) rc = process.poll() os.chdir('../') + +def global_database_update(): + import Global_DatabaseUpdate + '''process = subprocess.Popen(["python", "-u", "Global_DatabaseUpdate.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) + while True: + output = process.stdout.readline() + if process.poll() is not None: + break + if output: + print(output.strip()) + rc = process.poll()''' parser = argparse.ArgumentParser(description='Pseudo Channel Controls') channelsList = get_channels() @@ -176,6 +187,9 @@ parser.add_argument('-r', '--restart', parser.add_argument('-g', '--generateschedules', action='store_true', help='Generate Daily Schedules for All Channels') +parser.add_argument('-u', '--updatedatabase', + action='store_true', + help='Generate Pseudo Channel Database') args = parser.parse_args() @@ -221,4 +235,6 @@ if args.generateschedules: start_channel(last) except: print("GENERATING DAILY SCHEDULES") - generate_daily_schedules(channelsList) \ No newline at end of file + generate_daily_schedules(channelsList) +if args.updatedatabase: + global_database_update() \ No newline at end of file