global begin_message begin_message = False """ ############################################# GLOBAL DEFINITIONS ###################################################### """ # GLOBAL VARIABLEs RECV_BUFFER = 8192 ipc_file = "/var/www/Team16Website/garden_net/gn_util/ipc_file.txt" user_info_file = "/var/www/Team16Website/garden_net/gn_util/user_info.txt" alerts_file = "/var/www/Team16Website/garden_net/gn_util/alerts.txt" file_data = "" db = Database(False) json_conversion = JSON_Interface() SOCKET_LIST = [] EVENT_LIST = [] forecast = Forecast() sending_todays_schedule = False # Parse the command line for the options on ways to run the script parser = argparse.ArgumentParser(description="A prattle server") # -v allows the user to view all of the output of the server parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", help="turn verbose output on") args = parser.parse_args() """******************* START THE SOCKETS ***********************""" # @server_socket: Socket that listens for new connections server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
import socket from weather_forecast import Forecast from database import Database from JSON import JSON_Interface forecast = Forecast() #db = Database(False) ipc_file = "ipc_file.txt" rain_threshold = .8 temp_threshold = 10 json_convert = JSON_Interface() soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = socket.gethostname() port = 5538 #########TESTING db = Database(True) from event import Event from zone import Zone z = Zone(1) z2 = Zone(2) z3 = Zone(3) db.add_zone(z) db.add_zone(z2) test_event0 = Event(3.0, 4.0, 'Sunday', 1, 1) test_event1 = Event(1.0, 2.0, 'Sunday', 1, 1)