From a7b0277a311e98a307ea13f869f268a282f280df Mon Sep 17 00:00:00 2001 From: D4708 Date: Tue, 29 Jun 2021 00:36:05 +0300 Subject: [PATCH] add unlock.py --- scripts/unlock.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/unlock.py diff --git a/scripts/unlock.py b/scripts/unlock.py new file mode 100644 index 0000000..9ccf17e --- /dev/null +++ b/scripts/unlock.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# +# Auto-following/reading bot written in Python 2 has a mission to safe distributed data shared in the twister network +# (https://github.com/twisterarmy/twister-data-guard) +# This script based on the official usernameCrawler +# (https://github.com/miguelfreitas/twister-core/blob/master/contrib/usernameCrawler.py) +# +# Downloaded data is cached in a python pickle file, so it may be executed +# again and it won't need to get everything all over again (you may run it +# from cron scripts, for example) + +import sys, cPickle + +dbFileName = "twisterDataGuard.pickle" # service database file + +class MyDb: + lastBlockHash = 0 + dataLock = False + +try: + db = cPickle.load(open(dbFileName)) + db.dataLock = False + cPickle.dump(db, open(dbFileName, "w")) + print "indexing uclocked." +except: + print "database not created yet."