Nitro212

Android app install

Sep 10th, 2011
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.71 KB | None | 0 0
  1. import os
  2. import time
  3. import glob
  4. import platform
  5.  
  6. files_to_change = '*.apk'
  7. lame_space = ' ';
  8. cool_space = '.';
  9.  
  10.  
  11. #Rename Apk: space to .
  12. def rename_apk():
  13.  for f in glob.glob(files_to_change):
  14.   f2 = f
  15.   f2 = f2.replace(lame_space, cool_space)
  16.   print 'renaming: ', f, ' -> ', f2
  17.   os.rename(f, f2)
  18.  clear_screen()
  19.  print "Done Renaming."
  20.  time.sleep(2)
  21. #Clear the screen output.
  22. def clear_screen():
  23.  if platform.system() == "Windows":
  24.   os.system('cls')
  25.  else:
  26.   os.system('clear')
  27. #Install Apk  
  28. def install_apk():
  29.     for files in os.listdir('.'):
  30.      if files.endswith(".apk"):
  31.       string=files
  32.       cmd="adb install "+string
  33.       os.system(cmd)
  34.     time.sleep(2)
  35.     clear_screen()  
  36.     print "Apps Installed Rebooting."
  37.     os.system("adb shell reboot")
  38. #re-install apk
  39. def re_install_apk():
  40.     for files in os.listdir('.'):
  41.      if files.endswith(".apk"):
  42.       string=files
  43.       cmd="adb install -r "+string
  44.       os.system(cmd)
  45.     time.sleep(2)
  46.     clear_screen()  
  47.     print "Apps Installed Rebooting."
  48.     os.system("adb shell reboot")
  49.    
  50.  
  51. warn = "\n  You must from the menu 1, 2, 3, 4, 5.\n"+\
  52.      "  Enter your choice : "
  53. quest = ("""
  54. 1 - Install All Apps.
  55. 2 - Reinstall All Apps.
  56. 3 - Install apps (with spaces)
  57. 4 - Reinstall apps (with spaces)
  58. 5 - Only Rename Apps from this to.this
  59.  
  60. """"Choose :")
  61.  
  62. qts1 = raw_input(quest)
  63. while qts1 not in ('1','2','3','4','5'):
  64.     qts1 = raw_input(warn)
  65. if "1" in qts1:
  66.  install_apk()
  67. elif "2" in qts1:
  68.  re_install_apk()
  69. elif "3" in qts1:
  70.  rename_apk()
  71.  install_apk()
  72. elif "4" in qts1:
  73.  rename_apk()
  74.  re_install_apk()
  75. elif "5" in qts1:
  76.  rename_apk()
  77.  
  78.  
  79. print
  80. print
  81. raw_input("Press ENTER to exit")
Advertisement
Add Comment
Please, Sign In to add comment