import logging
import os


def migrate_db(db_dir, start, end):
    current = start
    old_dirs = []
    if os.name == "nt":
        return old_dirs
    while current < end:
        if current == 0:
            from lbrynet.db_migrator.migrate0to1 import do_migration
            old_dirs.append(do_migration(db_dir))
            current += 1
    return old_dirs


def run_migration_script():
    import sys
    log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
    logging.basicConfig(level=logging.DEBUG, format=log_format, filename="migrator.log")
    sys.stdout = open("migrator.out.log", 'w')
    sys.stderr = open("migrator.err.log", 'w')
    migrate_db(sys.argv[1], int(sys.argv[2]), int(sys.argv[3]))
    
    
if __name__ == "__main__":
    run_migration_script()
@@ -97,16 +97,18 @@
 = %5B%5D%0A   
+ #
  if os.n
@@ -119,24 +119,26 @@
 == %22nt%22:%0A   
+ #
      return 
@@ -149,16 +149,18 @@
 dirs%0A   
+ #
  while c
@@ -177,20 +177,22 @@
 nd:%0A    
+#
     
+ 
 if curre
@@ -199,24 +199,26 @@
 nt == 0:%0A   
+ #
          fro
@@ -275,24 +275,25 @@
 ion%0A    
+#
         
 old_dirs
@@ -280,24 +280,25 @@
    #        
+ 
 old_dirs.app
@@ -326,16 +326,18 @@
 ir))%0A   
+ #
         

comment out migrate0to1 import