]> wagner.pp.ru Git - oss/ljdump.git/blobdiff - ljdump.py
mention ljdump community
[oss/ljdump.git] / ljdump.py
index 534e68382fe813f72e6947e0a86bfdac10590caa..f06f3578f2560ecde70d3237fd54792c2c96e942 100755 (executable)
--- a/ljdump.py
+++ b/ljdump.py
@@ -26,6 +26,9 @@
 # This program may be run as often as needed to bring the backup copy up
 # to date. Both new and updated items are downloaded.
 #
+# The community http://ljdump.livejournal.com has been set up for questions
+# or comments.
+#
 # LICENSE
 #
 # This software is provided 'as-is', without any express or implied
@@ -106,6 +109,12 @@ def writedump(fn, event):
     dumpelement(f, "event", event)
     f.close()
 
+def writelast():
+    f = open("%s/.last" % Username, "w")
+    f.write("%s\n" % lastsync)
+    f.write("%s\n" % lastmaxid)
+    f.close()
+
 def createxml(doc, name, map):
     e = doc.createElement(name)
     for k in map.keys():
@@ -201,6 +210,7 @@ while True:
                 pprint.pprint(x)
                 errors += 1
         lastsync = item['time']
+        writelast()
 
 # The following code doesn't work because the server rejects our repeated calls.
 # http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.getevents.html
@@ -324,10 +334,7 @@ while True:
 
 lastmaxid = maxid
 
-f = open("%s/.last" % Username, "w")
-f.write("%s\n" % lastsync)
-f.write("%s\n" % lastmaxid)
-f.close()
+writelast()
 
 if origlastsync:
     print "%d new entries, %d new comments (since %s)" % (newentries, newcomments, origlastsync)