def main(): """ """ # Switch to file-based logging since docker logs -f is mysteriously failing lfile = './outputs/logs/camLooper.log' cfile = './config/webcams.conf' pfile = './config/passwords.conf' confclass = classes.Webcam # Need to pass getList = False otherwise it'll try to generate a list # of files found in that directory and return it to you. files.checkOutDir('./outputs/logs/', getList=False) # If abort was True, this'll probably blow up...? logs.setup_logging(logName=lfile, nLogs=5) # Read the webcam config file and parse it accordingly. # Will return an OrderedDict of enabled webcams IF enableCheck is True oncams, _ = confparsers.parseConfig(cfile, confclass, passfile=pfile, searchCommon=False, enableCheck=True) # Before we start, check the ALL the image output directories. # Only checking the enabled ones, but could check allcams if desired. for cam in oncams: curcam = oncams[cam] # Test the output location to make sure it exists location = curcam.odir files.checkOutDir(location, getList=False) # Just run it for ever and ever and ever and ever and ever and ever while True: # failimg = None just uses the default one: # resources/images/percy_txt.jpg # Note: Archive locations will be created automatically in here cams.grabSet(oncams, failimg=None, archive=True, makeMini=True) print("Done Grabbing Images!") print("Sleeping for 60 seconds...") time.sleep(60.)
# Since they're good filenames we can just sort and take the last # if there are actually any current ones left of course nstaticfiles = 48 # Move our files to the set of static filenames. This will # check (cpng) to see if there are actually any files that # are new, and if so it'll shuffle the files into the correct # order of static filenames. com.copyStaticFilenames(nstaticfiles, lout, staticname, cpng) else: print("No new files downloaded so skipping all actions.") print("Sleeping for %03d seconds..." % (sleep)) time.sleep(sleep) if __name__ == "__main__": outdir = "./outputs/" awsconf = "./awsCreds.conf" forceDownloads = False forceRegenPlot = False logname = './logs/radarlove.log' # Set up logging (using ligmos' quick 'n easy wrapper) logs.setup_logging(logName=logname, nLogs=30) creds = com.parseConfFile(awsconf) main(outdir, creds, forceDown=forceDownloads, forceRegen=forceRegenPlot) print("Exiting!")