#!/usr/bin/python import upggmcfunc upggmcfunc.upggmc('full')
def __init__(self): fixpermissions() time.sleep(1) me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running upggmcfunc.upggmc('silent') xbmc.executebuiltin( 'UpdateAddonRepos' ) time.sleep(120) fixpermissions() while not monitor.abortRequested(): sts=0 stsx=0 stsn=0 stsj=0 xbmc.log("**GMCupdateservice service executing checks... %s" % time.time(), level=xbmc.LOGDEBUG) fixpermissions() try: loc = urllib.URLopener() loc.retrieve('http://repo.galaxymediaonline.com//System_Upgrades//currentversion', '//mnt//sda2//update//upgradeversion') except: xbmc.log("**GMCupdateservice cannot connect to server. Update failed. %s" % time.time(), level=xbmc.LOGERROR) stsn=1 if not stsn == 1: GMCV = next(open('//home/osmc//currentversion')) upgv=next(open('//mnt//sda2//update//upgradeversion')) gmcv=self.remove_control_chars(GMCV) upgv=self.remove_control_chars(upgv) url='http://repo.galaxymediaonline.com//System_Upgrades//GMCv'+upgv+'.tar.gz' if gmcv == upgv: xbmc.log('**GMCupdateservice system v'+upgv+' is current. %s' % time.time(), level=xbmc.LOGNOTICE) sts=1 else: dialog.notification(' ', 'Galaxy Media Center new system version '+upgv+' is available', xbmcgui.NOTIFICATION_INFO, 10000) xbmc.log("**GMCupdateservice new system version "+upgv+" found. %s" % time.time(), level=xbmc.LOGNOTICE) if sts == 1: try: loc = urllib.URLopener() loc.retrieve('http://repo.galaxymediaonline.com//System_Upgrades//menuversion', '//mnt//sda2//update//menuupgradeversion') except: xbmc.log("**GMCupdateservice cannot connect to server. Menu update failed. %s" % time.time(), level=xbmc.LOGERROR) stsj=1 if not stsj == 1: menuv = next(open('//home/osmc//menuversion')) mupgv = next(open('//mnt//sda2//update//menuupgradeversion')) menuv=self.remove_control_chars(menuv) mupgv=self.remove_control_chars(mupgv) url='http://repo.galaxymediaonline.com//System_Upgrades//GMCMENUUPDATE.tar.gz' if menuv == mupgv: xbmc.log("**GMCupdateservice settings v"+mupgv+" is current. %s" % time.time(), level=xbmc.LOGNOTICE) stsx=1 else: xbmc.log("**GMCupdateservice new settings update v"+mupgv+" found. %s" % time.time(), level=xbmc.LOGNOTICE) try: req=urllib2.urlopen(url, 'OSMC') except urllib2.HTTPError, e: errc=str(e.code) xbmc.log("**GMCupdateservice Error downloading settings update. %s" % time.time(), level=xbmc.LOGERROR) stsx=1 if not stsx == 1: dialog.notification('', 'Galaxy Media Center settings update is available', xbmcgui.NOTIFICATION_INFO, 10000) if monitor.waitForAbort(sdel): break