Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _print(self, rawData):
- loc1 = rawData.loc(1)
- loc2 = rawData.loc(1)
- _logger("Packet: [%s:%s]"%(loc1, loc2))
- if loc1 == 40:
- if loc2 == 40:_logger("Online mice: %s"%rawData.readInt())
- if loc1 == 2:
- if loc2 == 2:
- thread = {}
- locale = {}
- _logger('2x2')
- locale['locale'] = rawData.readUTF() #now lang
- while rawData.length() > 0:
- #_logger("s %s")
- thread = {}
- thread['id'] = rawData.readInt()
- thread['country'] = rawData.readUTF()
- thread['icon'] = rawData.readShort()
- test = self.SQLITE.execute("select id from LIST_FORA where t_id=%s"%thread['id'])
- res = test.fetchone()
- if res == None:
- self.SQLITE.cursor()
- self.SQLITE.execute("insert into LIST_FORA(t_id, country, icon) values('%s', '%s', '%s')"%(thread['id'], thread['country'], thread['icon']))
- self.SQLITE.commit()
- test = self.SQLITE.execute("select id from LIST_FORA where t_id=%s"%thread['id'])
- _logger('2x2 - [x]')
- self.nextListFora(0)
- if loc2 == 4:
- thread = {}
- topic = {}
- _logger('2x4')
- thread['admonly'] = rawData.readBoolean()
- thread['id'] = rawData.readInt()
- thread['community'] = rawData.readUTF()
- thread['icon'] = rawData.readShort()
- self.SQLITE.cursor()
- test = self.SQLITE.execute("select id from FORA_SETTING where t_id=%s"%thread['id'])
- res = test.fetchone()
- if res == None:
- #self.SQLITE.cursor()
- self.SQLITE.execute("insert into FORA_SETTING(t_id, adminonly, icon, community) values('%s', '%s', '%s', '%s')"%(thread['id'], thread['admonly'], thread['icon'], thread['community']))
- self.SQLITE.commit()
- test = self.SQLITE.execute("select id from FORA_SETTING where t_id=%s"%thread['id'])
- _logger(thread)
- while rawData.length() > 0:
- topic = {}
- topic['id'] = rawData.readInt()
- topic['header'] = rawData.readUTF()
- topic['date'] = rawData.readInt()
- topic['author'] = rawData.readUTF()
- topic['last_answer'] = rawData.readUTF()
- topic['msg_count'] = rawData.readShort()
- topic['type'] = rawData.readByte()
- topic['stick'] = rawData.readBoolean()
- test = self.SQLITE.execute("select id from THREAD_LIST where thread_id=%s"%topic['id'])
- if test.fetchone() == None:
- try:
- strs = self.SQLITE.execute("insert into THREAD_LIST(t_id, header, date, author, last_posted, msg_count, type, stick, thread_id) values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"%(thread['id'], topic['header'], topic['date'], topic['author'], topic['last_answer'], topic['msg_count'], topic['type'], topic['stick'], topic['id']))
- self.SQLITE.commit()
- except:_logger(topic)
- _logger('2x4 - [x]')
- self.nextListFora(self.currentFora)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement