def __init__(self, apar, cpar, session): Greet.__init__(self, apar, cpar, session) self.animationTag = self.BOW_TAG # Parse the action parameters self.apar = self.apar.split(' ') # Parse the cultural parameters self.cpar = self.cpar.split(' ') self.volume = float(self.cpar[0]) self.speed = float(self.cpar[1]) self.pitch = float(self.cpar[2]) self.languageTag = self.cpar[3].title().replace('"', '') self.username = self.cpar[4].replace('"', '') self.setRobotLanguage() self.setVoiceVolume(self.volume) self.setVoiceSpeed(self.speed) self.setVoicePitch(self.pitch) self.sp = speech.Speech("speech_conf.json", self.languageTag.lower()) self.sp.enablePepperInteraction( self.session, caressestools.Settings.robotIP.encode('utf-8')) self.content = self.sp.script["Greet"]["other"]["0"][ self.languageTag.lower()].replace("$USERNAME$", self.username)
def _click(self): # 不确定1号框架可以点击还是2号框架可以点击,测试发现每次最多只有一个可点击 for i in range(1, 3): # 定位框架 frame = self.d(resourceId="cn.soulapp.android:id/item_post_all", className="android.view.ViewGroup", instance=i) try: # 耗时超过 1s center = frame.center() except: # logger.error(f'{i},无法获取中心位置') continue # 可能图标还没漏出来 if center[1] > 1200: # logger.warning(f'{i},中心位置大于1200') continue # 可能没有文字 try: name = frame.child( resourceId="cn.soulapp.android:id/expandable_text" ).get_text(timeout=1) except: name = str(time.time()) # 过滤地址 存在没有地址但是仍能识别出在上海的情况 try: address = frame.child( resourceId="cn.soulapp.android:id/square_item_location" ).get_text(timeout=1) if address not in ['Shanghai', '上海市']: continue except: logger.info('没有地址') continue if redis_cli.sismember('soul', name): logger.info(f'存在该用户') continue # 判断小心心有没有暴露出来 try: star_distance = frame.child( resourceId="cn.soulapp.android:id/iv_like", clickable=True).center(timeout=1) if star_distance[1] > 1800: continue except: pass frame.child(resourceId="cn.soulapp.android:id/iv_like", clickable=True).click_exists(timeout=1) self.num += 1 logger.info(f'{self.num},点击完成,{name}') Greet(self.content).greet(self.d, frame) redis_cli.sadd('soul', name)
nick = config.get("xmpp", "nick") logging.basicConfig(level=logging.INFO, format='%(levelname)-8s %(message)s') storage = Storage(config.get("db", "storage")) status = Status() conf = Configuration(storage, config) questions = load_database(config.get("db", "questions")) msgdb = MessageDatabase(questions) pingpong = PingPong() alphabet = Alphabet(storage, conf) count = Count(storage, conf) greet = Greet( [x.strip() for x in config.get("modules", "greetings").split(",")], nick) flooding = Flooding(conf) search_engines = load_database(config.get("db", "searchengines")) search = Search(search_engines) #expression = Expression() actions = Actions(storage) choice = Choice(conf) scripting = Scripting(storage, search_engines=search_engines) fatfox = FatFox() burgi = Burgi() cookies = Cookies() #urltitle = Urltitle() #finder = Finder() hands = Hands(storage, conf, config.get("modules", "hands"))
#Use of the greeting module from greet import Greet Greet("Big guy")
#!/usr/bin/python # -*- coding: utf-8 -*- from greet import Greet gr = Greet() print(gr.greet())
import yapypy.extended_python.pycompat from greet import Greet import numpy as np arr = np.array([1, 2, 3]) print(arr) Greet.greet() print(Greet.destruct({'yapypy': 'take away!'}))