def CheckForHits(self): print('Checking for hits') for plr in self.plrs: print('Checking player %s' % plr.num) if(plr.status != cfg.PLR_GOING): print('Player is not going, skipping') continue else: print('Checking blots') for blot in self.blots: if(blot.status == cfg.BLOT_ACTIVE): distance = Util.Distance(plr, blot) print('distance = %s' % distance) if(distance < blot.size): plr.status = cfg.PLR_HIT self.RemoveWidget(plr.getButton()) self.plrsHit += 1 print('Distance : %s' % distance) print('Player Hit: %s' % plr.PrintPlr()) print('Blot : %s' % blot.PrintBlot()) continue
def BlackListVerify(blackUser): result = Util.MessageContent('BlackListVerify').format( Util.BlackUserToText(blackUser)) return result
def MemberListSpread(memberList, documentURL): result = Util.MessageContent('MemberListSpread').format( memberList.Name, memberList.GetStrUpdateTime(), str(len(memberList.Members)), documentURL) return result
def IDKYou(channelName): result = Util.MessageContent('IDKYou').format(channelName) return result
def MemberListVerify(memberList): result = Util.MessageContent('MemberListVerify').format( memberList.ToText()) return result
def MemberListUpdate(source, adminUserDiscord, documentURL): result = Util.MessageContent('MemberListUpdate').format( source, ', '.join(adminUserDiscord), documentURL) return result
def BlackListError(error): result = Util.MessageContent('BlackListError').format(error) return result
def BlackListSpread(blackUser, documentURL): result = Util.MessageContent('BlackListSpread').format( blackUser.Source, Util.BlackUserToText(blackUser), documentURL) return result
return result def MemberListVerify(memberList): result = Util.MessageContent('MemberListVerify').format( memberList.ToText()) return result def MemberListUpdate(source, adminUserDiscord, documentURL): result = Util.MessageContent('MemberListUpdate').format( source, ', '.join(adminUserDiscord), documentURL) return result def MemberListSpread(memberList, documentURL): result = Util.MessageContent('MemberListSpread').format( memberList.Name, memberList.GetStrUpdateTime(), str(len(memberList.Members)), documentURL) return result def IDKYou(channelName): result = Util.MessageContent('IDKYou').format(channelName) return result BlackListHelp = Util.MessageContent('BlackListHelp') MemberListHelp = Util.MessageContent('MemberListHelp') VerifyDeny = Util.MessageContent('VerifyDeny')
from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import time import pymysql from modules import Util from modules import Logger url = 'https://music.163.com/' logger = Logger.Logger(__file__) util = Util.Util() def run(url): db = pymysql.connect("111.230.244.113", "root", "10001000", "music") cursor = db.cursor() try: driver = webdriver.Chrome() driver.implicitly_wait(10) driver.get(url) driver.maximize_window() time.sleep(5) hand = driver.find_element_by_xpath("//div[@class='hand']") ActionChains(driver).move_to_element(hand).perform() time.sleep(0.5) driver.execute_script('document.getElementsByClassName("left f-fl")[0].children[0].click()') current_handle = driver.current_window_handle hot_iframe = driver.find_element_by_xpath("//iframe[@id='g_iframe']") driver.switch_to.frame(hot_iframe) # 处理首页歌单 index_hot = driver.find_elements_by_xpath( "//div[@id='discover-module']//ul[@class='m-cvrlst f-cb']/li/div[@class='u-cover u-cover-1']")
def UpdateClanListSheet(self): sheetContent = Util.ConvertClanListForSheet() self.MemberListSheet.clear() self.MemberListSheet.update('A1', sheetContent)