Esempio n. 1
0
    def sView_Sysinfo(cls):

        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # ヘッダ表示
        wStr = "--------------------" + '\n'
        wStr = wStr + " システム情報" + '\n'
        wStr = wStr + "--------------------" + '\n'

        #############################
        # 時間の取得
        wRes = CLS_OSIF.sGetTime()
        if wRes['Result'] == True:
            wStr = wStr + wRes['TimeDate'] + '\n'

        #############################
        # 情報組み立て
        wStr = wStr + "Name= " + gVal.STR_SystemInfo['BotName'] + '\n'
        wStr = wStr + "Date= " + gVal.STR_SystemInfo['BotDate'] + '\n'
        wStr = wStr + "Ver = " + gVal.STR_SystemInfo['Version'] + '\n'
        wStr = wStr + "Admin= " + gVal.STR_SystemInfo['Admin'] + '\n'
        wStr = wStr + "github= " + gVal.STR_SystemInfo['github'] + '\n'

        wStr = wStr + "Python= " + str(gVal.STR_SystemInfo['PythonVer']) + '\n'
        wStr = wStr + "HostName= " + gVal.STR_SystemInfo['HostName'] + '\n'

        #############################
        # コンソールに表示
        CLS_OSIF.sPrn(wStr)
        return
Esempio n. 2
0
    def GetList(self, inCommand=None):
        #############################
        # 応答形式の取得
        #   "Result" : False, "Reason" : None, "Responce" : None
        wRes = CLS_OSIF.sGet_Resp()

        #############################
        # カレントパスを取得
        wCHR_Curr = CLS_OSIF.sGetCwd()

        #############################
        # cronが有効か?
        if self.FLG_Cron != True:
            wRes['Reason'] = " GetJoblist: Cron disabled"
            return wRes

        #############################
        # jobの文字列リスト化
        wRes['Responce'] = {}
        wRes['Responce'].update({'isJob': False, 'List': []})
        for wJob in self.OBJ_Cron:
            wJobStr = str(wJob)
            if wJobStr.find(wCHR_Curr) < 0:  #同一カレントか
                continue
            if inCommand != None:  #ダブってるJobがあればTrue
                if wJobStr.find(inCommand) >= 0:
                    wRes['Responce']['isJob'] = True

            wRes['Responce']['List'].append(str(wJob))

        wRes['Result'] = True
        return wRes
Esempio n. 3
0
    def __oneRunQueryMstdn(self, inQuery):
        #############################
        # DB接続
        wOBJ_DB = CLS_PostgreSQL_Use(gVal.DEF_STR_FILE['MstdnInfo_File'])
        wRes = wOBJ_DB.GetIniStatus()
        if wRes['Result'] != True:
            ##失敗
            wStr = "CLS_DBedit: __oneRunQueryMstdn: DB Connect test is failed: " + wRes[
                'Reason']
            CLS_OSIF.sPrn(wStr)
            wOBJ_DB.Close()
            return wRes

        #############################
        # クエリ実行
        wRes = wOBJ_DB.RunQuery(inQuery)
        ##	"Result"	: False
        ##	"Reason"	: None
        ##	"Responce"	: None

        #############################
        # DB切断
        wOBJ_DB.Close()

        wRes = wOBJ_DB.GetQueryStat()
        return wRes
Esempio n. 4
0
    def __getLucibotVer(cls):
        if CLS_File.sExist(gVal.DEF_STR_FILE['Readme']) != True:
            ###readmeファイル消すなwww
            CLS_OSIF.sPrn(
                "CLS_Main_Console: __getLucibotVer: Readme file is not found: "
                + gVal.DEF_STR_FILE['Readme'])
            return False

        for wLine in open(gVal.DEF_STR_FILE['Readme'], 'r'):  #ファイルを開く
            #############################
            # 分解+要素数の確認
            wLine = wLine.strip()
            wGetLine = wLine.split("= ")
            if len(wGetLine) != 2:
                continue

            wGetLine[0] = wGetLine[0].replace("::", "")
            #############################
            # キーがあるか確認
            if wGetLine[0] not in gVal.STR_SystemInfo:
                continue

            #############################
            # キーを設定
            gVal.STR_SystemInfo[wGetLine[0]] = wGetLine[1]

        return
Esempio n. 5
0
	def MasterLog( self, inAccount, inMsg, inView=False, inHard=False ):
		#############################
		# 時間を取得
		wTD = CLS_OSIF.sGetTime()
		if wTD['Result']!=True :
			###時間取得失敗  時計壊れた?
			CLS_OSIF.sPrn( inMsg )
			return
		wDate = wTD['TimeDate'].split(" ")
		
		#############################
		# ファイルパスを作成する
		wDate = self.CHR_TimeDate.split(" ")
		wDate = wDate.split("-")
		
		if inHard==False :
			### Masterログ
			wLogFile = gVal.DEF_STR_FILE['MasterLog_path'] + wDate[0] + wDate[1] + "_" + inAccount + ".log"
		else :
			### ハードログ
			wLogFile = gVal.DEF_STR_FILE['MasterLog_path'] + wDate[0] + wDate[1] + "_hard" + ".log"
		
		#############################
		# ファイルへ書き出す
		wOutLog = self.__write( wLogFile, wDate, inMsg )
		
		#############################
		# コンソールに表示する
		# = システムログに出る
		if inView==True :
			CLS_OSIF.sPrn( wOutLog )
		
		return
Esempio n. 6
0
    def SetRange(self, inKind):
        if inKind not in self.STR_TootRange:
            ###ロジックエラー
            ###			global_val.gCLS_Init.cPrint( "CLS_Toot: SetRange: STR_TootRange not in key: " + inKind )
            CLS_OSIF.sPrn("CLS_Toot: SetRange: STR_TootRange not in key: " +
                          inKind)
            return

        #############################
        # 切替メニュー
        if inKind == "ManualToot":
            wStr = '\n' + "範囲切替= p:public(公開) / u:unlisted(未収載) / l:private(非公開) / d:direct(DM)"
        else:
            ## Multicast
            wStr = '\n' + "範囲切替= p:public(公開) / u:unlisted(未収載)"

        CLS_OSIF.sPrn(wStr)
        wRes = CLS_OSIF.sInp("切替?=> ")

        #############################
        # 範囲切替 設定
        if wRes == "p":
            self.STR_TootRange[inKind] = "public"
        elif wRes == "u":
            self.STR_TootRange[inKind] = "unlisted"
##		elif wRes=="l" :
        elif wRes == "l" and inKind == "ManualToot":
            self.STR_TootRange[inKind] = "private"
        elif wRes == "d" and inKind == "ManualToot":
            self.STR_TootRange[inKind] = "direct"

        return
Esempio n. 7
0
    def __lockWait(cls, inPath):
        #############################
        # ループ回数に達するまでLockを監視する
        wLoop = 0
        while True:
            #############################
            # sleep
            CLS_OSIF.sSleep(gVal.DEF_LOCK_LOOPTIME)

            #############################
            # 排他を確認する
            #   排他が解除されていたらwaitを終わる
            wLockStat = CLS_BotCtrl.__openLock(inPath)
            if wLockStat == "0":
                return

            #############################
            # ループ回数に達したらwaitを終わる
            wLoop += 1
            if wLoop >= gVal.DEF_LOCK_WAITCNT:
                break

        #############################
        # 排他を解除する (waitタイムアウト時)
        CLS_BotCtrl.sUnlock(inPath)
        return
Esempio n. 8
0
    def MasterConfig_Disp(self):
        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # ヘッダ出力
        wStr = "--------------------" + '\n'
        wStr = wStr + " Master環境情報" + '\n'
        wStr = wStr + "--------------------" + '\n'

        wKeylist = self.STR_View_masterConf.keys()
        for iKey in wKeylist:
            wLen = len(iKey)
            if self.__DEF_VIEW_MASTERCONF_LEN > wLen:
                wKeyname = iKey + (" " *
                                   (self.__DEF_VIEW_MASTERCONF_LEN - wLen))
            else:
                wKeyname = iKey

            wNum = str(gVal.STR_MasterConfig[iKey])
            if wNum == "":
                wNum = "(None)"

            wStr = wStr + wKeyname + " : " + wNum + '\n'

        CLS_OSIF.sPrn(wStr)
        return
Esempio n. 9
0
    def __multicastList(self, inSendlist):
        wStr = '\n' + "配信先一覧" + '\n'
        wKeylist = inSendlist.keys()
        for iKey in wKeylist:
            wStr = wStr + iKey + '\n'

        CLS_OSIF.sPrn(wStr)
        wCommand = CLS_OSIF.sInp("同報配信先を出力しました。[RT]")
        return
Esempio n. 10
0
    def __manualToot(self, inFulluser, inDomain, inToot, inMastodon):
        #############################
        # 分かるよう加工
        wTag = '\n' + gVal.STR_MasterConfig['mTootTag'] + " @" + inFulluser
        wToot = inToot + wTag

        wMaxToot = 500 - len(wTag)
        if len(wToot) > 500:
            wRes = CLS_OSIF.sInp(str(wMaxToot) + " 文字以上は送信できません。[RT]")
            return False

        CLS_OSIF.sPrn("mastodonに送信中...")
        #############################
        # IP疎通チェック
        if CLS_OSIF.sPing(inDomain) != True:
            wRes = CLS_OSIF.sInp("mastodonと接続できないため送信できませんでした。[RT]")
            return False

        #############################
        #トゥート
        wRes = inMastodon.Toot(status=wToot,
                               visibility=self.STR_TootRange['ManualToot'])
        if wRes['Result'] != True:
            CLS_OSIF.sPrn("mastodon API Error: " + wRes['Reason'])
            wRes = CLS_OSIF.sInp("継続します。[RT]")
            return False

        wRes = CLS_OSIF.sInp("トゥートの送信を正常におこないました。[RT]")
        return True
Esempio n. 11
0
    def __init__(self, parentObj=None):
        if parentObj == None:
            ###親クラス実体の未設定
            CLS_OSIF.sPrn(
                "CLS_WordCorr: __init__: You have not set the parent class entity for parentObj"
            )
            return

        self.Obj_Parent = parentObj
        self.__selectMeCabDic()
        return
Esempio n. 12
0
    def __init__(self, parentObj=None):
        if parentObj == None:
            ###親クラス実体の未設定
            CLS_OSIF.sPrn(
                "CLS_UserCorr: __init__: You have not set the parent class entity for parentObj"
            )
            return

        self.Obj_Parent = parentObj
        self.ARR_UpdateUser = []  #今回関わったユーザ
        return
Esempio n. 13
0
    def __init__(self, parentObj=None):
        if parentObj == None:
            ###親クラス実体の未設定
            CLS_OSIF.sPrn(
                "CLS_RandToot: __init__: You have not set the parent class entity for parentObj"
            )
            return

        self.Obj_Parent = parentObj
        self.__run()  #処理開始
        return
Esempio n. 14
0
    def __init__(self, parentObj=None):
        if parentObj == None:
            ###親クラス実体の未設定
            CLS_OSIF.sPrn(
                "CLS_LookHard: __init__: You have not set the parent class entity for parentObj"
            )
            return

        self.Obj_Parent = parentObj
        self.__run()  #処理開始

        self.STR_Info = {"Result": False, "Reason": ""}
        return
Esempio n. 15
0
    def __init__(self, parentObj=None):
        if parentObj == None:
            ###親クラス実体の未設定
            CLS_OSIF.sPrn(
                "CLS_Trend: __init__: You have not set the parent class entity for parentObj"
            )
            return

        self.Obj_Parent = parentObj
        self.FLG_Valid = CLS_UserData.sCheckTrafficUser(
            self.Obj_Parent.CHR_Account)
        self.__run()  #処理開始
        return
Esempio n. 16
0
    def __setDomainsFile(self):
        #############################
        # ファイル書き込み (改行つき)
        ##		wFile_path = gVal.DEF_STR_FILE['MstdnDomains_File']
        wFile_path = gVal.DEF_STR_FILE[
            'MasterConfig_path'] + gVal.DEF_STR_FILE['MstdnDomains_File']
        if CLS_File.sWriteFile(wFile_path, self.ARR_Domains,
                               inRT=True) != True:
            ##			wStr = "CLS_DBedit: __setDomainsFile: MstdnDomains_File write is failed: " + gVal.DEF_STR_FILE['MstdnDomains_File']
            wStr = "CLS_DBedit: __setDomainsFile: MstdnDomains_File write is failed: " + wFile_path
            CLS_OSIF.sPrn(wStr)
            return False  #失敗

        return True  #成功
Esempio n. 17
0
    def __run(self):
        #############################
        # 開始ログ
        self.Obj_Parent.OBJ_Mylog.Log('b', self.CHR_LogName + " 開始")

        wTootStat = "off"
        #############################
        # トゥート頻度(乱数発生)
        wVAL_Rand = CLS_OSIF.sGetRand(gVal.DEF_STR_TLNUM['getRandRange'])
        wVAL_Pub = CLS_OSIF.sGetRand(gVal.DEF_STR_TLNUM['getRandPublic'])

        if wVAL_Rand < gVal.DEF_STR_TLNUM['getRandVal']:
            ##		if wVAL_Rand < gVal.DEF_STR_TLNUM['getRandVal'] or gVal.FLG_Test_Mode==True :
            #############################
            # ランダムトゥートを実行する
            ### public頻度
            if wVAL_Pub == 1:
                wCHR_Range = "public"
            else:
                wCHR_Range = "unlisted"

            wCHR_Toot = self.Obj_Parent.OBJ_WordCorr.GetRandToot()
            if wCHR_Toot == "":
                self.Obj_Parent.OBJ_Mylog.Log(
                    'a', "CLS_RandToot: __run: GetRandToot is failed")
                return

##			wRes = self.Obj_Parent.OBJ_MyDon.Toot( status=wCHR_Toot, visibility="public" )
##			wRes = self.Obj_Parent.OBJ_MyDon.Toot( status=wCHR_Toot, visibility=self.DEF_TOOTRANGE )
            wRes = self.Obj_Parent.OBJ_MyDon.Toot(status=wCHR_Toot,
                                                  visibility=wCHR_Range)
            if wRes['Result'] != True:
                self.Obj_Parent.OBJ_Mylog.Log(
                    'a',
                    "CLS_RandToot: __run: Mastodon error: " + wRes['Reason'])
                return

            wTootStat = "on"

        #############################
        # 処理結果ログ
        wStr = self.CHR_LogName + " 結果: Toot=" + wTootStat + " "
        wStr = wStr + "Rand=" + str(wVAL_Rand) + " "

        if gVal.FLG_Test_Mode == False:
            self.Obj_Parent.OBJ_Mylog.Log('b', wStr)
        else:
            self.Obj_Parent.OBJ_Mylog.Log('b', wStr, inView=True)

        return
Esempio n. 18
0
    def sViewDisp(cls, inDisp):
        #############################
        # ディスプレイファイルの確認
        wKeylist = gVal.DEF_STR_DISPFILE.keys()
        if inDisp not in wKeylist:
            ###キーがない(指定ミス)
            CLS_OSIF.sPrn(
                "CLS_Main_Console: __viewDisp: Display key is not found: inDisp= "
                + inDisp)
            return False

        if CLS_File.sExist(gVal.DEF_STR_DISPFILE[inDisp]) != True:
            ###ファイルがない...(消した?)
            CLS_OSIF.sPrn(
                "CLS_Main_Console: __viewDisp: Display file is not found: " +
                gVal.DEF_STR_DISPFILE[inDisp])
            return False

        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # 中身表示
        wStr = ""
        for wLine in open(gVal.DEF_STR_DISPFILE[inDisp], 'r'):  #ファイルを開く
            wStr = wStr + wLine

        CLS_OSIF.sPrn(wStr)
        return True
Esempio n. 19
0
    def ViewUserList(self):
        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # ヘッダ出力
        wStr = "--------------------" + '\n'
        wStr = wStr + " 登録ユーザ一覧" + '\n'
        wStr = wStr + "--------------------"
        CLS_OSIF.sPrn(wStr)

        #############################
        # データフォルダの一覧(トップだけ)取得
        wList = self.sGetUserList()
        if len(wList) == 0:
            CLS_OSIF.sPrn("ユーザ登録がありません")
            return

##		#############################
##		# 同報配信設定ユーザ一覧の取得
##		wRes = self.GetMulticastUserList()
##		if wRes['Result']!=True :
##			CLS_OSIF.sPrn( wRes['Reason'] )
##			return
##
##		wMulticastList = wRes['Responce']

#############################
# 表示
        wStr = ""
        for f in wList:
            #############################
            # MasterUserフラグ
            if gVal.STR_MasterConfig['MasterUser'] == f:
                wStr = wStr + "*"
            else:
                wStr = wStr + " "

##			#############################
##			# PR Userフラグ
##			if gVal.STR_MasterConfig['PRUser']==f :
##				wStr = wStr + "P"
##			else:
##				wStr = wStr + " "

##			#############################
##			# 同報配信ユーザフラグ
##			if f in inMulticastList :
##				wStr = wStr + "M"
##			else:
##				wStr = wStr + " "

#############################
# ユーザ名
            wStr = wStr + " " + f + '\n'

        CLS_OSIF.sPrn(wStr)
        return
Esempio n. 20
0
    def __View_Disp(self):
        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # ヘッダ出力
        wStr = "-----------------------" + '\n'
        wStr = wStr + " データベース エディタ" + '\n'
        wStr = wStr + "-----------------------" + '\n'
        ##		wStr = wStr + "DB Name: " + self.STR_DBdata['database'] + '\n'
        wStr = wStr + "コマンド= [\\q] 終了 / [\\l] 一覧"
        CLS_OSIF.sPrn(wStr)
        wCommand = CLS_OSIF.sInp("コマンド?=> ").strip()
        return wCommand
Esempio n. 21
0
    def __recovery_TBL_TRAFFIC_DATA(self):
        #############################
        # 読み出し先初期化
        wTrafficUser = []

        #############################
        # ファイル読み込み
        wFile_path = gVal.DEF_STR_FILE['TrafficFile']
        if CLS_File.sReadFile(wFile_path, outLine=wTrafficUser) != True:
            wStr = "CLS_Regist : __recovery_TBL_TRAFFIC_DATA: TrafficFile read is failed: " + gVal.DEF_STR_FILE[
                'TrafficFile']
            CLS_OSIF.sPrn(wStr)
            return False

        #############################
        # DBの接続
        wOBJ_DB = CLS_PostgreSQL_Use(gVal.DEF_STR_FILE['DBinfo_File'])
        wRes = wOBJ_DB.GetIniStatus()
        if wRes['Result'] != True:
            ###失敗
            wStr = "CLS_Regist : __recovery_TBL_TRAFFIC_DATA: DB connect error: " + wRes[
                'Reason']
            CLS_OSIF.sPrn(wStr)
            return False

        #############################
        # 修復
        for wLine in wTrafficUser:
            wDomain = wLine.split("@")
            if len(wDomain) != 2:
                wStr = "CLS_Regist : __recovery_TBL_TRAFFIC_DATA: Traffic user is invalid: user="******"insert into TBL_TRAFFIC_DATA values (" + \
               "'" + wDomain + "'," + \
               "0," + \
               "-1," + \
               "-1," + \
               "-1," + \
               "0" + \
               ") ;"
            wDBRes = wOBJ_DB.RunQuery(wQuery)
            wDBRes = wOBJ_DB.GetQueryStat()
            if wDBRes['Result'] != True:
                ##失敗
                wStr = "CLS_Regist : __recovery_TBL_TRAFFIC_DATA: DB insert is failed: " + wDBRes[
                    'Reason']
                CLS_OSIF.sPrn(wStr)
                wOBJ_DB.Close()
                return False

        #############################
        # DBのクローズ
        wOBJ_DB.Close()
        return True
Esempio n. 22
0
	def __registUser( self, inFulluser, inMail, inPass ):
		#############################
		# 応答形式の取得
		#   "Result" : False, "Reason" : None, "Responce" : None
		wRes = CLS_OSIF.sGet_Resp()
		
		#############################
		# ユーザ名の妥当性チェック(いちお再チェック)
		wSTR_user = CLS_UserData.sUserCheck( inFulluser )
		if wSTR_user['Result']!=True :
			wRes['Reason'] = wSTR_user['Reason']
			return wRes
		
		#############################
		# 入力間違いのチェック
		wFlg = True
		if inFulluser==inMail :
			wFlg = False
		elif inFulluser==inPass :
			wFlg = False
		elif inMail==inPass :
			wFlg = False
		
		if wFlg!=True :
			wRes['Reason'] = "ユーザ名、メールアドレス、パスワードの入力が誤ってます。(重複検出)"
			return wRes
		
		wRes['Result'] = True
		return wRes
Esempio n. 23
0
    def __manualToot_Disp(self, inFulluser):
        #############################
        # 画面クリア
        CLS_OSIF.sDispClr()

        #############################
        # ヘッダ出力
        wStr = "--------------------" + '\n'
        wStr = wStr + " 手動トゥートモード" + '\n'
        wStr = wStr + "--------------------" + '\n'
        wStr = wStr + "アカウント: " + inFulluser + '\n'
        wStr = wStr + "公開モード: " + self.STR_TootRange['ManualToot'] + '\n' + '\n'
        wStr = wStr + "コマンド= [\\q] 終了 / [\\c] 範囲切替 / [other] トゥート!!"
        CLS_OSIF.sPrn(wStr)
        wCommand = CLS_OSIF.sInp("コマンド?=> ")
        return wCommand
Esempio n. 24
0
    def GetList(self):
        #############################
        # cronが有効か?
        if self.OBJ_CronCtrl.Check() != True:
            wRes['Reason'] = "Cron disable"
            CLS_OSIF.sPrn("CLS_Botjob: List: Cron disable")
            return wRes

        #############################
        # List取得
        wRes = self.OBJ_CronCtrl.GetList()
        if wRes['Result'] != True:
            CLS_OSIF.sPrn("CLS_Botjob: List: Failed: " + wRes['Reason'])
            return wRes

        return wRes
Esempio n. 25
0
    def JobPut(self, inCommand, inSecond=1):
        #############################
        # 応答形式の取得
        #   "Result" : False, "Reason" : None, "Responce" : None
        wRes = CLS_OSIF.sGet_Resp()

        #############################
        # cronが有効か?
        if self.FLG_Cron != True:
            wRes['Reason'] = " JobPut: Cron disabled"
            return wRes

        #############################
        # ダブってるjobがないか
        wJobList = self.GetList(inCommand)
        if wJobList['Result'] != True:
            ###ここは通らないかも
            wRes['Reason'] = wRes['Reason']  #中継
            return wRes
        if wJobList['Responce']['isJob'] == True:
            wRes['Reason'] = " JobPut: Detect booking job: " + inCommand
            return wRes

        #############################
        # jobをrconに登録 (実行するわけではない)
        job = self.OBJ_Cron.new(command=inCommand)
        job.minute.every(inSecond)

        #############################
        # crontabに書き込み
        self.OBJ_Cron.write()

        wRes['Result'] = True
        return wRes
Esempio n. 26
0
    def JobDel(self, inCommand):
        #############################
        # 応答形式の取得
        #   "Result" : False, "Reason" : None, "Responce" : None
        wRes = CLS_OSIF.sGet_Resp()

        #############################
        # cronが有効か?
        if self.FLG_Cron != True:
            wRes['Reason'] = " JobDel: Cron disabled"
            return wRes

        #############################
        # jobが存在しない
        wJobList = self.GetList(inCommand)
        if wJobList['Result'] != True:
            ###ここは通らないかも
            wRes['Reason'] = wRes['Reason']  #中継
            return wRes
        if wJobList['Responce']['isJob'] == False:
            wRes['Reason'] = " JobDel: Job is not found: " + inCommand
            return wRes

        #############################
        # commandをキーにjobを削除
        self.OBJ_Cron.remove_all(command=inCommand)

        #############################
        # crontabに書き込み
        self.OBJ_Cron.write()

        wRes['Result'] = True
        return wRes
Esempio n. 27
0
    def __checkTwitterPatt(self, inROW):
        wRes = {"result": False, "send_user": "", "tags": ""}

        wKeylist = self.ARR_AnapTL.keys()
        wFlg_Hit = False
        for wKey in wKeylist:
            ##			if self.ARR_AnapTL[wKey]['user']==str(inROW['user']['screen_name']) :
            ##				wFlg_Hit = True
            ##				break		#対象ツイートユーザ
            if self.ARR_AnapTL[wKey]['user'] != str(
                    inROW['user']['screen_name']):
                #対象ツイートユーザではない
                continue

            if self.ARR_AnapTL[wKey]['patt'] == "":
                ##				continue
                #対象ツイートユーザ かつ パターン設定なし:Hitあり
                wFlg_Hit = True
                break

            wRes_Search = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['patt'],
                                              str(inROW['text']))
            if wRes_Search:
                #対象ツイートユーザ かつ パターンヒット:Hitあり
                wFlg_Hit = True
                break

        ### Hitあり
        if wFlg_Hit == True:
            wRes['send_user'] = self.ARR_AnapTL[wKey]['send']
            wRes['tags'] = self.ARR_AnapTL[wKey]['tags']
            wRes['result'] = True

        return wRes
Esempio n. 28
0
    def __backWait(cls, inPath):
        #############################
        # 排他解除されるまでLockを監視する
        while True:
            #############################
            # sleep
            CLS_OSIF.sSleep(gVal.DEF_LOCK_LOOPTIME)

            #############################
            # 排他を確認する
            #   排他が解除されていたらwaitを終わる
            wLockStat = CLS_BotCtrl.__openLock(inPath)
            if wLockStat == "0":
                return

        return
Esempio n. 29
0
    def sChk1HourTime(cls, inPath):
        #############################
        # 記録ファイルをロード
        w1HourTime = []
        wFilePath = inPath + gVal.DEF_STR_FILE['Chk1HourFile']
        if CLS_File.sReadFile(wFilePath, w1HourTime) != True:
            return False  #処理失敗

        try:
            w1HourTime = w1HourTime[0].split(',')
            wHour = w1HourTime[1]
        except:
            return False  #処理失敗

        #############################
        # PC時間を取得
        wGetTime = CLS_OSIF.sGetTime()
        if wGetTime['Result'] != True:
            return False  #処理失敗

        gVal.STR_TimeInfo['Object'] = wGetTime['Object']
        gVal.STR_TimeInfo['TimeDate'] = wGetTime['TimeDate']
        gVal.STR_TimeInfo['Hour'] = wGetTime['Hour']
        gVal.STR_TimeInfo['Week'] = wGetTime['Week']
        gVal.STR_TimeInfo['Result'] = True  #有効

        wGetDate = wGetTime['TimeDate'].split(" ")

        #############################
        # 時間が同じ=少なくとも1時間経ってないか?
        if w1HourTime[0] != "1900-01-01":
            if wHour == wGetTime['Hour']:
                gVal.STR_TimeInfo['OneHour'] = False
                return True
            else:
                gVal.STR_TimeInfo['OneHour'] = True

            if w1HourTime[0] == wGetDate[0]:
                gVal.STR_TimeInfo['OneDay'] = False
##				return True
            else:
                gVal.STR_TimeInfo['OneDay'] = True

        else:
            ##bot起動初回の場合は時間だけ保存する
            gVal.STR_TimeInfo['OneHour'] = False
            gVal.STR_TimeInfo['OneDay'] = False

        #############################
        # 時間をセーブ
        wTime = wGetTime['TimeDate'].split(" ")
        wTime = wTime[0] + ',' + wGetTime['Hour'] + ',' + wGetTime['Week']

        wSaveTime = []
        wSaveTime.append(wTime)
        if CLS_File.sWriteFile(wFilePath, wSaveTime) != True:
            return False  #処理失敗

        return True
Esempio n. 30
0
    def __getDomainsFile(self):
        #############################
        # 読み出し先初期化
        self.ARR_Domains = []

        #############################
        # ファイル読み込み
        ##		wFile_path = gVal.DEF_STR_FILE['MstdnDomains_File']
        wFile_path = gVal.DEF_STR_FILE[
            'MasterConfig_path'] + gVal.DEF_STR_FILE['MstdnDomains_File']
        if CLS_File.sReadFile(wFile_path, outLine=self.ARR_Domains) != True:
            ##			wStr = "CLS_DBedit: __getDomainsFile: MstdnDomains_File read is failed: " + gVal.DEF_STR_FILE['MstdnDomains_File']
            wStr = "CLS_DBedit: __getDomainsFile: MstdnDomains_File read is failed: " + wFile_path
            CLS_OSIF.sPrn(wStr)
            return False  #失敗

        return True  #成功