Skip to content

Commit

Permalink
Return of Agent delete of subs, as well as changelog ;-)
Browse files Browse the repository at this point in the history
  • Loading branch information
ukdtom committed Feb 27, 2016
1 parent 1699c60 commit b1e1c9e
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 84 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ Icon
# gedit tmp files
#*****************
*~

*.pyc
debug


Binary file modified Contents/Code/Docs/webtools-README_DEVS.odt
Binary file not shown.
13 changes: 9 additions & 4 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ def Start():
DEBUGMODE = os.path.isfile(debugFile)
if DEBUGMODE:
VERSION = VERSION + ' ****** WARNING Debug mode on *********'
PLUGIN_VERSION = VERSION
print("******** Started %s on %s **********" %(NAME + ' V' + PLUGIN_VERSION, Platform.OS))
Log.Debug("******* Started %s on %s ***********" %(NAME + ' V' + PLUGIN_VERSION, Platform.OS))
print("******** Started %s on %s **********" %(NAME + ' V' + VERSION, Platform.OS))
Log.Debug("******* Started %s on %s ***********" %(NAME + ' V' + VERSION, Platform.OS))
HTTP.CacheTime = 0
DirectoryObject.thumb = R(ICON)
ObjectContainer.title1 = NAME + ' V' + PLUGIN_VERSION
ObjectContainer.title1 = NAME + ' V' + VERSION
Plugin.AddViewGroup('List', viewMode='List', mediaType='items')
ObjectContainer.view_group = 'List'
makeSettings()
Expand Down Expand Up @@ -97,6 +96,12 @@ def makeSettings():
# Create the pwdset entry
if Dict['pwdset'] == None:
Dict['pwdset'] = False
# Init the installed dict
if Dict['installed'] == None:
Dict['installed'] = {}
# Init the allBundle Dict
if Dict['PMS-AllBundleInfo'] == None:
Dict['PMS-AllBundleInfo'] = {}
return

####################################################################################################
Expand Down
33 changes: 23 additions & 10 deletions Contents/Code/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,9 @@ def removeEmptyFolders(path, removeRoot=True):
Log.Debug('Removing empty directory: ' + path)
os.rmdir(path)



# Reset dicts
nukeSpecialDicts()


url= req.get_argument('debugURL', 'https://api.github.com/repos/dagalufh/WebTools.bundle/releases/latest')
bundleName = Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name, NAME + '.bundle')
Log.Info('WT install dir is: ' + bundleName)
Expand Down Expand Up @@ -174,16 +171,17 @@ def removeEmptyFolders(path, removeRoot=True):
req.set_header('Content-Type', 'application/json; charset=utf-8')
req.finish('Upgraded ok')
except Exception, e:
Log.Critical('***************************************************************')
Log.Critical('Error when updating WebTools')
Log.Critical('The error was: ' + str(e))
Log.Critical('***************************************************************')
Log.Critical('DARN....When we tried to upgrade WT, we had an error :-(')
Log.Critical('Only option now might be to do a manual install, like you did the first time')
Log.Critical('The error was: ' + str(e))
Log.Critical('Do NOT FORGET!!!!')
Log.Critical('We NEED this log, so please upload to Plex forums')
Log.Critical('***************************************************************')
return


''' This function will return a list of bundles, where there is an update avail '''
def getUpdateList(self, req):
Log.Debug('Got a call for getUpdateList')
Expand Down Expand Up @@ -218,7 +216,6 @@ def getUpdateList(self, req):
req.set_status(500)
req.set_header('Content-Type', 'application/json; charset=utf-8')
req.finish('Fatal error happened in getUpdateList ' + str(e))


''' This function will migrate bundles that has been installed without using our UAS into our UAS '''
def migrate(self, req, silent=False):
Expand Down Expand Up @@ -259,9 +256,6 @@ def getIdentifier(pluginDir):
# Main call
Log.Debug('Migrate function called')
try:
# Init dict, if not already so
if Dict['installed'] == None:
Dict['installed'] = {}
# Let's start by getting a list of known installed bundles
knownBundles = []
for installedBundles in Dict['installed']:
Expand All @@ -286,6 +280,11 @@ def getIdentifier(pluginDir):
uasListjson = getUASCacheList()
bFound = False
for git in uasListjson:
'''
if target == 'com.plexapp.plugins.Plex2csv':
print 'GED KIG HER'
continue
'''
if target == uasListjson[git]['identifier']:
Log.Debug('Found %s is part of uas' %(target))
targetGit = {}
Expand All @@ -302,6 +301,8 @@ def getIdentifier(pluginDir):
Log.Debug('Dict stamped with the following install entry: ' + git + ' - ' + str(targetGit))
# Now update the PMS-AllBundleInfo Dict as well
Dict['PMS-AllBundleInfo'][git] = targetGit
# Update installed dict as well
Dict['installed'][git] = targetGit
# If it existed as unknown as well, we need to remove that
Dict['PMS-AllBundleInfo'].pop(uasListjson[git]['identifier'], None)
Dict['installed'].pop(uasListjson[git]['identifier'], None)
Expand Down Expand Up @@ -402,7 +403,15 @@ def updateUASCache(self, req):
req.finish('Exception in updateUASCache: ' + errMsg)
return req
# Grap file from Github
zipfile = Archive.ZipFromURL(self.UAS_URL+ '/archive/master.zip')
try:
zipfile = Archive.ZipFromURL(self.UAS_URL+ '/archive/master.zip')
except Exception, e:
Log.Critical('Could not download UAS Repo from GitHub')
req.clear()
req.set_status(500)
req.set_header('Content-Type', 'application/json; charset=utf-8')
req.finish('Exception in updateUASCache while downloading UAS repo from Github: ' + str(e))
return req
for filename in zipfile:
# Walk contents of the zip, and extract as needed
data = zipfile[filename]
Expand Down Expand Up @@ -549,7 +558,11 @@ def removeEmptyFolders(path, removeRoot=True):
if len(files) == 0 and removeRoot:
Log.Debug('Removing empty directory: ' + path)
os.rmdir(path)

try:
# Get the dict with the installed bundles, and init it if it doesn't exists
if not 'installed' in Dict:
Dict['installed'] = {}
zipPath = url + '/archive/' + branch + '.zip'
try:
# Grap file from Github
Expand Down
Loading

0 comments on commit b1e1c9e

Please sign in to comment.