How to delete 'userdata' and 'addons' directories within an addon script?
#1
Question 
Hi All,

Bear with me as I'm brand new to kodi/addon dev. My experience lies in web development and I'm just getting my feet wet here.

I'm playing around with creating my own installer addon. Basically the goal is to wipe and reload my user data ('addons' & 'userdata' folders). The addon script works great in that it fetches my zip, downloads and extracts it. The only problem is that it appears to be appending the contents of the zip to the existing user data folders instead or removing the user data folders first.

I assume what I need is the commands somewhere in here to remove/delete the addons and userdata folders. I Googled around trying to find the correct way to do this in Python/Kodi but didnt come up with much.
This is basically the "wizard" script that does the dirty work:

Code:
def wizard(name,url,description):
    path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("Selected Build","Downloading ",'', 'Please Wait')
    lib=os.path.join(path, name+'.zip')
    try:
       os.remove(lib)
    except:
       pass
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://','home'))
    time.sleep(2)
    dp.update(0,"", "Extracting Zip Please Wait")
    print '======================================='
    print addonfolder
    print '======================================='
    extract.all(lib,addonfolder,dp)
    dialog = xbmcgui.Dialog()
    dialog.ok("Download Complete.")
    killxbmc()


From the looks of it, there should be some functions in place just before the extractions that handle removing the folders. I'm hoping it's as simple as that anyways Wink

Any insights here would be much appreciated!
Reply
#2
were you able to find any solution to this?
i am looking for the same thing
Reply
#3
Yes, I would like to use this as well.
Reply

Logout Mark Read Team Forum Stats Members Help
How to delete 'userdata' and 'addons' directories within an addon script?0