示例#1
0
文件: lookhtl.py 项目: h3zjp/lucibot
    def __cope(self, inROW):
        #############################
        # ユーザ名の変換
        wFulluser = CLS_UserData.sGetFulluser(inROW['account']['username'],
                                              inROW['account']['url'])
        if wFulluser['Result'] != True:
            ###今のところ通らないルート
            return False

        #############################
        # トゥートからHTMLタグを除去
        wCont = CLS_OSIF.sDel_HTML(inROW['content'])

        #############################
        # 収集判定(一括)
        if self.__copeCorr(wFulluser, inROW, wCont) != True:
            ##			self.STR_Cope['Outrange'] += 1
            return  ### 除外

        #############################
        # トゥートの時間 (変換&差)
        wReaRIPmin = gVal.DEF_STR_TLNUM['reaRIPmin'] * 60  #秒に変換
        wGetLag = CLS_OSIF.sTimeLag(str(inROW['created_at']),
                                    inThreshold=wReaRIPmin)
        if wGetLag['Result'] != True:
            self.STR_Cope['Invalid'] += 1
            return
        if wGetLag['Beyond'] == True:
            self.STR_Cope['OffTime'] += 1
            return  #反応時間外
        wGetTime = str(wGetLag['InputTime'])

        #############################
        #解析種類の判定
        wKeyList = self.ARR_AnapTL.keys()
        for wKey in wKeyList:
            #############################
            # 解析:ついったー転送
            if self.ARR_AnapTL[wKey]['Kind'] == "t" and gVal.STR_MasterConfig[
                    'Twitter'] == "on":
                ### ハード監視ユーザか
                if CLS_UserData.sCheckHardUser(
                        self.Obj_Parent.CHR_Account) != True:
                    continue

                ### 自分が指定ユーザか
                if self.ARR_AnapTL[wKey]['Fulluser'] != "":
                    if self.ARR_AnapTL[wKey][
                            'Fulluser'] != self.Obj_Parent.CHR_Account:
                        continue
                ### 無指定の場合、登録ユーザか(第三者避け)
                else:
                    wUserList = CLS_UserData.sGetUserList()
                    if wFulluser['Fulluser'] not in wUserList:
                        continue

                ### マッチチェック
                wPatt = "#" + self.ARR_AnapTL[wKey]['Tag']
                wRes = CLS_OSIF.sRe_Search(wPatt, wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ### 実行
##				if self.TwitterBoost( inROW['id'] )!=True :
                if self.TwitterBoost(inROW['id'], wFulluser) != True:
                    self.STR_Cope['Invalid'] += 1
                else:
                    self.STR_Cope["Now_Twitter"] += 1

            #############################
            # 解析:指定ブースト
            if self.ARR_AnapTL[wKey]['Kind'] == "h":
                ### 自分のトゥートか
                if wFulluser['Fulluser'] == self.Obj_Parent.CHR_Account:
                    continue  #自分
##				### 収集判定(一括)
##				if self.__copeCorr( wFulluser, inROW, wCont )!=True :
##					continue	# 除外

### 自分が指定ユーザではない
                if self.ARR_AnapTL[wKey]['Fulluser'] != "":
                    if self.ARR_AnapTL[wKey][
                            'Fulluser'] != self.Obj_Parent.CHR_Account:
                        continue
                ### 無指定の場合、登録ユーザか(第三者避け)
                else:
                    wUserList = CLS_UserData.sGetUserList()
                    if wFulluser['Fulluser'] not in wUserList:
                        continue

                ### マッチチェック
                wPatt = "#" + self.ARR_AnapTL[wKey]['Tag']
                wRes = CLS_OSIF.sRe_Search(wPatt, wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ### 実行
                if self.Boost(inROW['id']) != True:
                    self.STR_Cope['Invalid'] += 1
                    break
                self.STR_Cope["Now_Boot"] += 1
                break

            #############################
            # 解析:指定フルブースト
            if self.ARR_AnapTL[wKey]['Kind'] == "p":
                ### 自分のトゥートか
                if wFulluser['Fulluser'] == self.Obj_Parent.CHR_Account:
                    continue  #自分
##				### 収集判定(一括)
##				if self.__copeCorr( wFulluser, inROW, wCont )!=True :
##					continue	# 除外

### 自分が指定ユーザではない
                if self.ARR_AnapTL[wKey][
                        'Fulluser'] != self.Obj_Parent.CHR_Account:
                    continue  #指定ではない

                #対象のブーストユーザか
                if self.ARR_AnapTL[wKey]['Tag'] != wFulluser:
                    continue  #指定ではない

                ### 実行
                if self.Boost(inROW['id']) != True:
                    self.STR_Cope['Invalid'] += 1
                    break
                self.STR_Cope["Now_Boot"] += 1
                break

        return
示例#2
0
    def __cope(self, inROW):
        #############################
        # ユーザ名の変換
        wFulluser = CLS_UserData.sGetFulluser(inROW['account']['username'],
                                              inROW['account']['url'])
        if wFulluser['Result'] != True:
            ###今のところ通らないルート
            return False

        #############################
        # トゥートからHTMLタグを除去
        wCont = CLS_OSIF.sDel_HTML(inROW['content'])

        #############################
        # 収集判定(一括)
        if self.__copeCorr(wFulluser, inROW['language'], wCont) != True:
            return  ### 除外

        #############################
        #ユーザ収集ファイルに記録
        #  ・新規  :追加
        #  ・追加済:更新
##		if self.Obj_Parent.OBJ_UserCorr.AddUser( inROW )==True :
##			self.STR_Cope['UserCorr'] += 1
##		self.Obj_Parent.OBJ_UserCorr.AddUser( inROW )
        self.Obj_Parent.OBJ_UserCorr.AddUser(inROW, wFulluser)

        #############################
        #単語学習
        ##		if gVal.STR_MasterConfig['WordStudy'] == "on" :
        ##			self.Obj_Parent.OBJ_WordCorr.WordStudy( inROW )
        ##		self.Obj_Parent.OBJ_WordCorr.WordStudy( wCont, inROW['created_at'] )
        self.Obj_Parent.OBJ_WordCorr.WordStudy(wCont)

        ##		#############################
        ##		#パターン反応
        ##		###トゥートからHTMLタグを除去
        ##		wCont = CLS_OSIF.sDel_HTML( inROW['content'] )
        ##
        ##		###ユーザ名の変換
        ##		wFulluser = CLS_UserData.sGetFulluser( inROW['account']['username'], inROW['account']['url'] )
        ##		if wFulluser['Result']!=True :
        ##			###今のところ通らないルート
        ##			return False
        ##
        ##		#############################
        ##		#除外トゥート
        ##		###リプライ(先頭に@付きトゥート)
        ##		if wCont.find('@') == 0 :
        ##			return
        ##
        ##		###自分(このbot)のトゥート
        ##		if wFulluser['Fulluser'] == self.Obj_Parent.CHR_Account :
        ##			return

        #############################
        # フォロワー状態
        #   True =フォロワー
        #   False=フォロワーじゃない
        wFLG_Follower = self.Obj_Parent.OBJ_Follow.Check_Follower(
            wFulluser['Fulluser'])

        #############################
        #解析種類の判定
        wKeyList = self.ARR_AnapTL.keys()
        for wKey in wKeyList:
            #############################
            #解析:ニコる
            if self.ARR_AnapTL[wKey]['Kind']=="f" and gVal.STR_MasterConfig['PTL_Favo']=="on" and \
               wFLG_Follower==True :
                ###マッチチェック
                wRes = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['Pattern'],
                                           wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ###実行
                if self.Nicoru(inROW['id']) != True:
                    break
                self.STR_Cope["Now_Favo"] += 1
                break

            #############################
            #解析:ブースト
            if self.ARR_AnapTL[wKey]['Kind']=="b" and gVal.STR_MasterConfig['PTL_Boot']=="on" and \
               wFLG_Follower==True :
                ###マッチチェック
                wRes = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['Pattern'],
                                           wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ###実行
                if self.Boost(inROW['id']) != True:
                    break
                self.STR_Cope["Now_Boot"] += 1
                break

            #############################
            #解析:紐エアリプ
            if self.ARR_AnapTL[wKey]['Kind']=="h" and gVal.STR_MasterConfig['PTL_HRip']=="on" and \
               wFLG_Follower==True :
                ###マッチチェック
                wRes = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['Pattern'],
                                           wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ###実行
                if self.HimoRipry(self.ARR_AnapTL[wKey]['File'],
                                  inROW['id']) != True:
                    break
                self.STR_Cope["Now_ARip"] += 1
                break

            #############################
            #解析:エアリプ
##			if self.ARR_AnapTL[wKey]['Kind']=="a" and gVal.STR_MasterConfig['PTL_ARip']=="on" and \
##			   wFLG_Follower==True :
            if self.ARR_AnapTL[wKey]['Kind'] == "a" and gVal.STR_MasterConfig[
                    'PTL_ARip'] == "on":
                ###マッチチェック
                wRes = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['Pattern'],
                                           wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ###実行
                if self.AirRipry(self.ARR_AnapTL[wKey]['File']) != True:
                    break
                self.STR_Cope["Now_ARip"] += 1
                break

            #############################
            #解析:ワード監視
            if self.ARR_AnapTL[wKey]['Kind']=="w" and gVal.STR_MasterConfig['PTL_WordOpe']=="on" and \
               gVal.STR_MasterConfig['AdminUser']!="" :
                ###マッチチェック
                wRes = CLS_OSIF.sRe_Search(self.ARR_AnapTL[wKey]['Pattern'],
                                           wCont)
                if not wRes:
                    ##アンマッチ
                    continue
                ###実行
                if self.IndWordOpe(wFulluser['Fulluser'],
                                   self.ARR_AnapTL[wKey]['Pattern'],
                                   inROW['uri']) != True:
                    break
                self.STR_Cope["Now_Word"] += 1
                break

        return