Guest User

Untitled

a guest
Dec 21st, 2016
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. def SPORTS_DEVIL_FIX():
  2.  
  3. SPORTS_DEVIL_FOLDER = xbmc.translatePath(os.path.join('special://home/addons','plugin.video.SportsDevil'))
  4. PYDEV_FOLDER = xbmc.translatePath(os.path.join('special://home/addons','script.module.pydevd'))
  5. REPO_FOLDER = xbmc.translatePath(os.path.join('special://home/addons','repository.echo'))
  6. path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
  7.  
  8. choice = xbmcgui.Dialog().yesno(AddonTitle,'This option will remove all traces of Sports Devil (If Installed) and install a clean version along with the ECHO Repo.','Would you like to continue?',yeslabel='[B][COLOR lime]YES[/COLOR][/B]',nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
  9. if choice == 0:
  10. sys.exit(1)
  11. dialog = xbmcgui.Dialog()
  12. if os.path.exists(SPORTS_DEVIL_FOLDER):
  13. try:
  14. shutil.rmtree(SPORTS_DEVIL_FOLDER)
  15. except: pass
  16. if os.path.exists(PYDEV_FOLDER):
  17. try:
  18. shutil.rmtree(PYDEV_FOLDER)
  19. except: pass
  20. purgePath = xbmc.translatePath('special://home/addons/packages')
  21. for root, dirs, files in os.walk(purgePath):
  22. file_count = 0
  23. file_count += len(files)
  24. for root, dirs, files in os.walk(purgePath):
  25. file_count = 0
  26. file_count += len(files)
  27. if file_count > 0:
  28. for f in files:
  29. os.unlink(os.path.join(root, f))
  30. for d in dirs:
  31. shutil.rmtree(os.path.join(root, d))
  32.  
  33. if not os.path.exists(path):
  34. os.makedirs(path)
  35.  
  36.  
  37. url = ('https://github.com/echocoderkodi/echo.addon.installer/raw/master/dependencies/script.module.pydevd-3.4.1.zip')
  38. dp = xbmcgui.DialogProgress()
  39. dp.create(AddonTitle,"","","Installing Dependencies")
  40. lib=os.path.join(path, 'addon.zip')
  41.  
  42. try:
  43. os.remove(lib)
  44. except:
  45. pass
  46.  
  47. downloader.download(url, lib, dp)
  48. addonfolder = xbmc.translatePath(os.path.join('special://home','addons'))
  49. time.sleep(2)
  50. dp.update(0,"","Extracting Zip Please Wait","")
  51. extract.all(lib,addonfolder,dp)
  52. url = ('https://github.com/echocoderkodi/echo.addon.installer/raw/master/addons/Plugins/plugin.video.SportsDevil.zip')
  53. dp = xbmcgui.DialogProgress()
  54. dp.create(AddonTitle,"","","Installing Sports Devil")
  55. lib=os.path.join(path, 'addon.zip')
  56.  
  57. try:
  58. os.remove(lib)
  59. except:
  60. pass
  61.  
  62. downloader.download(url, lib, dp)
  63. addonfolder = xbmc.translatePath(os.path.join('special://home','addons'))
  64. time.sleep(2)
  65. dp.update(0,"","Extracting Zip Please Wait","")
  66. extract.all(lib,addonfolder,dp)
  67. try:
  68. os.remove(lib)
  69. except:
  70. pass
  71. xbmc.executebuiltin("UpdateAddonRepos")
  72. xbmc.executebuiltin("UpdateLocalAddons")
  73.  
  74. dialog.ok(AddonTitle,"[COLOR white]The Sportd Devil plugin should now be fixed and working correctly. If you have any issues please turn AUTO UPDATE OFF on Sports Devil and run this fix again.[/COLOR]")
  75. sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment