Advertisement
Flyer

Untitled

Nov 11th, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.73 KB | None | 0 0
  1.     def _print(self, rawData):
  2.         loc1 = rawData.loc(1)
  3.         loc2 = rawData.loc(1)
  4.         _logger("Packet: [%s:%s]"%(loc1, loc2))
  5.         if loc1 == 40:
  6.             if loc2 == 40:_logger("Online mice: %s"%rawData.readInt())
  7.         if loc1 == 2:
  8.             if loc2 == 2:
  9.                 thread = {}
  10.                 locale = {}
  11.                 _logger('2x2')
  12.                 locale['locale'] = rawData.readUTF() #now lang
  13.                 while rawData.length() > 0:
  14.                     #_logger("s %s")
  15.                     thread = {}
  16.                     thread['id'] = rawData.readInt()
  17.                     thread['country'] = rawData.readUTF()
  18.                     thread['icon'] = rawData.readShort()
  19.                     test = self.SQLITE.execute("select id from LIST_FORA where t_id=%s"%thread['id'])
  20.                     res = test.fetchone()
  21.                     if res == None:
  22.                         self.SQLITE.cursor()
  23.                         self.SQLITE.execute("insert into LIST_FORA(t_id, country, icon) values('%s', '%s', '%s')"%(thread['id'], thread['country'], thread['icon']))
  24.                         self.SQLITE.commit()
  25.                         test = self.SQLITE.execute("select id from LIST_FORA where t_id=%s"%thread['id'])
  26.                 _logger('2x2 - [x]')
  27.                 self.nextListFora(0)
  28.             if loc2 == 4:
  29.                 thread = {}
  30.                 topic = {}
  31.                 _logger('2x4')
  32.                 thread['admonly'] = rawData.readBoolean()
  33.                 thread['id'] = rawData.readInt()
  34.                 thread['community'] = rawData.readUTF()
  35.                 thread['icon'] = rawData.readShort()
  36.                 self.SQLITE.cursor()
  37.                 test = self.SQLITE.execute("select id from FORA_SETTING where t_id=%s"%thread['id'])
  38.                 res = test.fetchone()
  39.                 if res == None:
  40.                         #self.SQLITE.cursor()
  41.                         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']))
  42.                         self.SQLITE.commit()
  43.                         test = self.SQLITE.execute("select id from FORA_SETTING where t_id=%s"%thread['id'])
  44.                 _logger(thread)
  45.                 while rawData.length() > 0:
  46.                     topic = {}
  47.                     topic['id'] = rawData.readInt()
  48.                     topic['header'] = rawData.readUTF()
  49.                     topic['date'] = rawData.readInt()
  50.                     topic['author'] = rawData.readUTF()
  51.                     topic['last_answer'] = rawData.readUTF()
  52.                     topic['msg_count'] = rawData.readShort()
  53.                     topic['type'] = rawData.readByte()
  54.                     topic['stick'] = rawData.readBoolean()
  55.                     test = self.SQLITE.execute("select id from THREAD_LIST where thread_id=%s"%topic['id'])
  56.                     if test.fetchone() == None:
  57.                         try:
  58.                             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']))
  59.                             self.SQLITE.commit()
  60.                         except:_logger(topic)
  61.                 _logger('2x4 - [x]')
  62.                 self.nextListFora(self.currentFora)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement