-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdumpforums.py
More file actions
31 lines (30 loc) · 1.16 KB
/
dumpforums.py
File metadata and controls
31 lines (30 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from embeddedpyqt import *
import random
import json
#import PyQt4
print ""
#print 'names in current namespace', dir()
print "dumping subscribed forums... please wait!"
forums = bridge.getForums()
with open('jout/forums.json', 'w') as ffile:
ffile.write(json.dumps(forums))
def dumpMsg(forumID,msgID):
#print msgID
msg = bridge.getForumMessage(forumID,msgID)
with open("jout/msg"+msgID+".json", 'w') as ffile:
ffile.write(json.dumps(msg))
msgheaders = bridge.getForumThreadMsgList(forumID,msgID)
with open("jout/thread"+msgID+".json", 'w') as ffile:
ffile.write(json.dumps(msgheaders))
for msgh in msgheaders:
dumpMsg(forumID, msgh['msgId'])
for f in forums:
if f['forumRelationship'] == "SUBSCRIBED":
print "dumping " + f['forumId']
threadlist = bridge.getForumThreadList(f['forumId'])
with open("jout/forum"+f['forumId']+".json", 'w') as ffile:
ffile.write(json.dumps(threadlist))
for tm in threadlist:
#print tm
dumpMsg(f['forumId'], tm['msgId'])
print "done dumping forum messages"