def doAFileOfEventIDs(filename):
    filename = DS.ABSPATH(filename)
    if not DS.PATH.isfile(filename):
        print(f"""
the filename {filename} is invalid
""")
        exit(1)
    with open(filename, "r") as FDIDIn:
        while True:
            thisID = FDIDIn.readline()
            if not thisID:
                quit(0)
            thisID = thisID[1:-2]
            thisURL = C.GEOJSONDETAIL(thisID)
            filename = f"""temp/ID{thisID}.DEETSL.{TDS.nowStr(TDS.DT.now())}.geojson"""
            thisFilename = f"""{C.CACHEDIR(filename)}"""
            thisResult = WEB.getAFile(thisURL, thisFilename, isJson=True)
            if thisResult is True:
                doAFile(thisFilename, thisID)
                usefulKeys.append(prefix)
                FDUseful = open(usefulName, "ta")
                outStr = f"""{C.TABSTR}{C.DQTSTR}{COMBO}{C.DQTSTR},{C.NEWLINE}"""
                FDUseful.write(outStr)
                FDUseful.flush()
                FDUseful.close()
                FDMoreUseful = open(moreUsefulName, "ta")
                outStr = f"""({C.DQTSTR}{prefix}{C.DQTSTR}, {C.DQTSTR}{the_type}{C.DQTSTR}, C.TYPE, """
                outStr += f"""{C.DQTSTR}headerName{C.DQTSTR}, SQLDEFAULT, SCNDEFAULT,),{C.NEWLINE}"""
                FDMoreUseful.write(f"""{str(thisTuple)}{C.NEWLINE}""")
                FDMoreUseful.flush()
                FDMoreUseful.close()
    FDUseful = open(usefulName, "ta")
    outStr = f"""{C.CBSSTR}{C.NEWLINE}"""
    FDUseful.write(outStr)
    FDUseful.flush()
    FDUseful.close()


USEFULPREFIX = C1.USEFULPREFIX
for thisID in eventIDs:
    usefulBit = f"""{TDS.nowStr(TDS.DT.now())}.{thisID}.detail.txt"""
    moreUsefulBit = f"""{TDS.nowStr(TDS.DT.now())}.{thisID}.detailPlus.txt"""
    usefulName = f"""{C.CACHEDIR(usefulBit)}"""
    moreUsefulName = f"""{C.CACHEDIR(moreUsefulBit)}"""
    filenameBits = f"""detail.{thisID}.{TDS.nowStr(TDS.DT.now())}.json"""
    thisFilename = f"""{C.CACHEDIR(filenameBits)}"""
    thisURL = C.GEOJSONDETAIL(thisID)
    if getAFile(thisURL, thisFilename) is True:
        doAFile(thisFilename, thisID)
def __main__():
	ARGV = argv[1:]
	# *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
	# *	"-D": O_DETAILS,
	# *	"-Q": O_QUERYDETAILS,
	# *	"-d": O_ALLDAYSMRY,
	# *	"-f": O_FILE,
	# *	"-h": O_ALLHOURSMRY,
	# *	"-L": O_EVENTIDLIST,
	# *	"-m": O_ALLMONTHSMRY,
	# *	"-q": O_QUERY,
	# *	"-w": O_ALLWEEKSMRY,
	# *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
	OPTS, ARGS = GO.getopt(ARGV, f"""D:Q:d:f:h:L:m:q:w:""")
	# print(f"""
	# opts {OPTS}
	# args {ARGS}
	# """)
	thisEventID = ""
	thisFilename = ""
	thisURL = ""
	thisFilePrefix = ""
	OPTSDICT = C1.OPTSTTDICT(OPTS)
	ARGSDICT = C1.ARGSTTDICT(ARGS)
	if OPTSDICT[C1.O_DETAILS] != "":
		thisEventID = OPTSDICT[C1.O_DETAILS]
		thisFilePrefix = "DEET"
		thisURL = C.GEOJSONDETAIL(thisEventID)
	elif OPTSDICT[C1.O_QUERYDETAILS] != "":
		thisEventID = OPTSDICT[C1.O_QUERYDETAILS]
		thisFilePrefix = "QDEET"
		thisURL = C.GEOJSONDETAILQUERY(thisEventID)
	elif OPTSDICT[C1.O_ALLDAYSMRY] != "":
		thisFilePrefix = "DAY"
		thisURL = C.GEOJSONALLSMRY("day")
	elif OPTSDICT[C1.O_FILE] != "":
		thisFilePrefix = "FILE"
		thisURL = ""
		thisFilename = OPTSDICT[C1.O_FILE]
	elif OPTSDICT[C1.O_ALLHOURSMRY] != "":
		thisFilePrefix = "HOUR"
		thisURL = C.GEOJSONALLSMRY("hour")
	elif OPTSDICT[C1.O_EVENTIDLIST] != "":
		doAFileOfEventIDs(OPTSDICT[C1.O_EVENTIDLIST])
		exit(0)
	elif OPTSDICT[C1.O_ALLMONTHSMRY] != "":
		thisFilePrefix = "MONTH"
		thisURL = C.GEOJSONALLSMRY("month")
	elif OPTSDICT[C1.O_QUERY] != "":
		thisFilePrefix = "QUERY"
		thisURL = C.GEOJSONQUERY(OPTSDICT[C1.O_QUERY])
	elif OPTSDICT[C1.O_ALLWEEKSMRY] != "":
		thisFilePrefix = "WEEK"
		thisURL = C.GEOJSONALLSMRY("week")
	else:
		print(f"""
Invalid opt set
OPTS {str(OPTS)}
ARGS {str(ARGS)}
argv {str(argv)}
""")
		exit(1)
	if thisURL != C.EMPTYSTR:
		thisPARM = f"""{dirPFX}ijsonST.{thisFilePrefix}.{TDS.nowStr(TDS.DT.now())}.json"""
		thisFilename = C.CACHEDIR(thisPARM)
		thisResult = WEB.getAFile(thisURL, thisFilename, isJson=True, dirPFX=dirPFX)
		if thisResult is False:
			print(f"""
failed to get the file {thisFilename}
from the URL {thisURL}

""")
			exit(1)
	if thisFilename != "":
		doAFile(thisFilename, myEventID=thisEventID)
		thisFilename = C.CACHEDIR(thisPARM)
		thisResult = WEB.getAFile(thisURL, thisFilename, isJson=True, dirPFX=dirPFX)
		if thisResult is False:
			print(f"""
failed to get the file {thisFilename}
from the URL {thisURL}

""")
			exit(1)
	if thisFilename != "":
		doAFile(thisFilename, myEventID=thisEventID)


tempURL = C.GEOJSONALLSMRY("day")
tempFileName = C.CACHEDIR(f"""{dirPFX}day{TDS.nowStr(TDS.DT.now())}.geojson""")
WEB.getAFile(tempURL, tempFileName, isJson=True, dirPfx=dirPFX)

tempURL = C.GEOJSONDETAIL("us6000a1p9")
tempFileName = C.CACHEDIR(f"""{dirPFX}deet{TDS.nowStr(TDS.DT.now())}.geojson""")
WEB.getAFile(tempURL, tempFileName, isJson=True, dirPfx=dirPFX)

tempURL = C.GEOJSONDETAILQUERY("us6000a1p9")
tempFileName = C.CACHEDIR(f"""{dirPFX}Qdeet{TDS.nowStr(TDS.DT.now())}.geojson""")
WEB.getAFile(tempURL, tempFileName, isJson=True, dirPfx=dirPFX)


# if __name__ == "__main__":
	# __main__()

#