Advertisement
Guest User

main.py

a guest
Jun 19th, 2011
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1. #imports
  2.  
  3. import help
  4. import get
  5. import syn
  6.  
  7. #main loop
  8.  
  9. i = ""
  10.  
  11. print(help.introduction)
  12.  
  13. print("Please specify a folder to write to:")
  14. folder = input("")
  15. if syn.existing_db(folder) == False:
  16.     syn.touch_db(folder)
  17. syn.read_to_db(folder)
  18.  
  19. while i != "exit": #exiting jumps straight to the end of code
  20.    
  21.     if i == "help":
  22.         print(help.help)
  23.     elif i[0:4] == "help":
  24.         args = i.split(" ")
  25.         if len(args) > 2 or args[1] != "get" or args[1] != "synchronize":
  26.             print(help.specific)
  27.        
  28.     elif i == "change folder":
  29.         print("Please specify a folder to write to:")
  30.         folder = input("")
  31.         print("Folder was changed to " + str(folder))
  32.  
  33.     elif i == "get top":
  34.         get.top(folder)
  35.     elif i[0:8] == "get page":
  36.         args = i.split(" ")
  37.         if len(args) == 3:
  38.             get.page(args[2], folder)
  39.     elif i[0:8] == "get hash":
  40.         args = i.split(" ")
  41.         if len(args) == 3:
  42.             get.hash(args[2], folder)
  43.     elif i[0:9] == "get image":
  44.         args = i.split(" ")
  45.         if len(args) == 3:
  46.             get.image(args[2], folder)
  47.        
  48.     elif i == "get estimated archive size":
  49.         get.estimated_archive_size()
  50.     elif i == "get last page number":
  51.         print(get.last_page_number())
  52.     elif i == "get version":
  53.         get.version()
  54.     elif i == "get author":
  55.         get.author()
  56.     elif i == "get folder":
  57.         print("Current folder is: " + str(folder))
  58.    
  59.     else:
  60.         print(help.general)
  61.  
  62.     i = input("").lower()
  63.    
  64. syn.write_db_to(folder)
  65. print("Bye")
  66.  
  67. #end of main loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement