def main(self): self.init() if 'file' == self._mode: with self._file.open(self._filePath) as f: for line in f: line = file.delete_line_breaks(line) result = self.add_friends(line) if result == 1: break f.close() elif 'loop' == self._mode: for line in range(int(self._loop[0]), int(self._loop[1])): self.add_friends(str(line))
def main(self): self.init() if 'file' == self._mode: with self._file.open(self._file) as f: for line in f: line = file.delete_line_breaks(line) self.add_friends(line) f.close() elif 'loop' == self._mode: for line in range(int(self._loop[0]), int(self._loop[1])): self.add_friends(str(line)) # 输出最后的添加结果 self._file.dump(self._success, 'success') self._file.dump(self._failed, 'failed')
def main(self): # self.test() self.init() if 'file' == self._mode: print("self._file=" + str(self._file)) for f in self.file.open1(self._file): if self._end is False: print(f) line = f line = file.delete_line_breaks(line) self.add_friends(str(line)) elif 'loop' == self._mode: if self._end is False: for line in range(len(self._loop)): self.add_friends(str(self._loop[line])) # 输出最后的添加结果 self.file.dump1(self._success, 'success') self.file.dump1(self._failed, 'failed')
def main(self): self.init() if 'file' == self._mode: linenum = 0 with self._file.open(self._fileurl) as f: for line in f: linenum = linenum + 1 print('=====================', linenum, '=======================') line = file.delete_line_breaks(line) self.add_friends(line) f.close() elif 'loop' == self._mode: nums = range(int(self._loop[0]), int(self._loop[1])) for line in nums: self.add_friends(str(line)) # 输出最后的添加结果 self._file.dump(self._success, 'success') self._file.dump(self._failed, 'failed')
def run(self): try: if self._mode == 0: print('添加好友') for f in self.file.open1(self._file_add_friends): print(f) line = f line = file.delete_line_breaks(line) line = line.strip() self.phonelist.append(line) friend = Addfriend(self._adb, self._wechat_list, self._reminder, self._input_hint, self._continue_add, self._addfriendcount, self.wechats_index, self.phonelist, self._tag, self._add_f_sleep, self) friend.main() # 输出最后的添加结果 self.file.dump1(self._success, 'success') self.file.dump1(self._failed, 'failed') elif self._mode == 1: print('添加公众号') for f in self.file.open_w(self._file_add_official): print(f) line = f line = file.delete_line_breaks(line) line = line.strip() self.official_list.append(line) off = Addofficial(self._adb, self._wechat_list, self.wechats_index, self.official_list, self) off.main() # 输出最后的添加结果 self.file.dump1(self._success, 'success_add_official') self.file.dump1(self._failed, 'failed_official') elif self._mode == 2: print('聊天') chat_chat = Chat(self._adb, self._wechat_list, self._chat_mode, self._account, self._chats, self.wechats_index, self._end_sign) chat_chat.main() elif self._mode == 3: print('发送朋友圈') for f in self.file.open_w(self._file_send_cicle): print(f) line = f line = file.delete_line_breaks(line) self._strlist.append(line) time.sleep(2) send = Sendfriends(self._adb, self._wechat_list, self._imagenum, self._strlist, self.wechats_index, self) send.main() # 输出最后的添加结果 self.file.dump1(self._success, 'success_circle') self.file.dump1(self._failed, 'failed_circle') elif self._mode == 4: print('分享文章') for f in self.file.open_w(self._file_share_article): line = f line = file.delete_line_breaks(line) line = line.strip() print(line) self._articlelist.append(line) share = Sharearticle(self._adb, self._wechat_list, self.common_name, self._share_str, self._articlelist, self.wechats_index, self) share.main() # 输出最后的添加结果 self.file.dump1(self._success, 'success_share') self.file.dump1(self._failed, 'failed_share') elif self._mode == 5: print('评论朋友圈') comment = Commentcircle(self._adb, self._wechat_list, self._comment_mode, self._comment_wechat_friend, self._comment_list, self.wechats_index, self._end_sign, self) comment.main() elif self._mode == 6: print('阅读公众号文章') read = Readofficial(self._adb, self._wechat_list, self._officialnames, self.wechats_index, self) read.main() elif self._mode == 7: print('给好友打备注') mark = Remark(self._adb, self._wechat_list, self._wechat_remark_friends_list, self._wechat_remarks, self.wechats_index, self) mark.main() elif self._mode == 8: print('加群') group = Addgroup(self._adb, self._wechat_list, self.groups_list, self.wechats_index, self._end_sign, self) group.main() # 输出最后的添加结果 self.file.dump1(self._success, 'success_group') self.file.dump1(self._failed, 'failed_group') elif self._mode == 9: self._adb.adb_keyboard(63) self._adb.click_by_text_after_refresh("ADB Keyboard") for f in self.file.open_w(self.file_groups_txt): line = f line = file.delete_line_breaks(line) line = line.strip() print(line) self._groups_txt_list.append(line) gchat = Groupchat(self._adb, self._wechat_list, self.groups_list, self.wechats_index, self._groups_txt_list, self.file_groups_image, self) gchat.main() elif self._mode == 10: for f in self.file.open1(self._file_add_friends): print(f) line = f line = file.delete_line_breaks(line) line = line.strip() self.phonelist.append(line) sreachw = SreachFriend(self._adb, self._wechat_list, self.phonelist, self.wechats_index, self) sreachw.main() except KeyboardInterrupt as e: print('e', e)