--- a/scripts/migrate_shorturls.py Wed Jul 01 20:03:41 2009 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-from lib import shorturl, db
-
-sdb = shorturl.DB()
-
-def gen () :
- count = 0
-
- for key in sdb.db.keys() :
- if key.startswith("_") :
- continue
-
- print "%6s" % key,
-
- value = sdb.db[key]
-
- if not isinstance(value, tuple) or len(value) != 3 :
- print "CORRUPT VALUE!!!"
- continue
-
- type, dirpath, fname = value
-
- id = shorturl.key2int(key)
- dirpath = dirpath.lstrip('.').lstrip('/')
-
- if type == "img" :
- print "img"
- continue # already imported images
-
- print "img %6d %50s %10s" % (id, dirpath, fname)
-
- yield id, dirpath, fname
-
- else :
-
- print "dir %6d %50s" % (id, dirpath)
-
- yield id, dirpath, ''
-
- count += 1
-
- if count % 500 == 0 :
- print count
-
-
-print "Starting import..."
-
-c = db.insert_many("""
- INSERT OR IGNORE INTO nodes VALUES (?, ?, ?)
-""", gen())
-
-print "Done!"
-
-print "%d rows affected" % c