Browse files

Future upgrades should no longer require a restart (service is hot-de…

…ployed)
  • Loading branch information...
1 parent 22a379c commit 8d22c46a867fc99e63a6a9eb4977bbc753af0927 killdash9 committed Aug 21, 2012
View
2 addons.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
-<addon id="script.video.parentalcontrols" name="Parental Controls" version="1.5.0" provider-name="killdash9">
+<addon id="script.video.parentalcontrols" name="Parental Controls" version="1.5.2" provider-name="killdash9">
<requires>
<import addon="xbmc.python" version="2.0"/>
</requires>
View
2 addons.xml.md5
@@ -1 +1 @@
-c73624bb30c532990425605e07622323
+741a087c59e1ba8dd0f16efbc4d6a347
View
6 deploy-local.sh
@@ -1,2 +1,6 @@
mkdir "$HOME/Library/Application Support/XBMC/addons/script.video.parentalcontrols"
-cp -Rv script.video.parentalcontrols/* "$HOME/Library/Application Support/XBMC/addons/script.video.parentalcontrols"
+while true
+do
+ cp -R script.video.parentalcontrols/* "$HOME/Library/Application Support/XBMC/addons/script.video.parentalcontrols"
+ sleep 1
+done
View
BIN repo/script.video.parentalcontrols/script.video.parentalcontrols-1.5.2.zip
Binary file not shown.
View
2 script.video.parentalcontrols/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.video.parentalcontrols" name="Parental Controls" version="1.5.0" provider-name="killdash9">
+<addon id="script.video.parentalcontrols" name="Parental Controls" version="1.5.2" provider-name="killdash9">
<requires>
<import addon="xbmc.python" version="2.0"/>
</requires>
View
6 script.video.parentalcontrols/changelog.txt
@@ -1,6 +1,10 @@
+1.5.2
+Future upgrades should no longer require a restart (service is hot-deployed)
+Bug fixes
+
1.5.0
Better search integration
-Adult addons are blocked at the top level
+xbmc-adult addons are blocked at the top level
Bug fixes
1.4.11
View
1 script.video.parentalcontrols/resources/lib/parentalcontrols/hook.py
@@ -2,6 +2,7 @@
import re
import os
import xbmcaddon
+import traceback
__addon__ = xbmcaddon.Addon()
__addonpath__ = __addon__.getAddonInfo('path')
View
55 script.video.parentalcontrols/resources/lib/parentalcontrols/service.py
@@ -1,46 +1,29 @@
import time
-import common
-import hook
import traceback
-import xbmcgui
+import xbmcaddon
+import os
+import xbmc
-def checkProtection():
- plugins = common.getProtectedPlugins()
- for plugin in plugins:
- state = hook.getPluginHookState(plugin)
- if (not state['hooked']) or not (state['uptodate']):
- p=hook.hookPlugin(plugin)
- common.msg("Re-protecting plugin " + p['name'])
-
-def closeProgressDialogIfInterfering():
- pythonWindow = None
- pythonWindowId=13000
- try:
- pythonWindow=xbmcgui.Window(pythonWindowId)
- except:
- pass
- #window not found
- if pythonWindow:
- xmlfile = pythonWindow.getProperty('xmlfile')
- codeDialogIsUp = xmlfile and xmlfile.find('DialogCode.xml')>=0
- if codeDialogIsUp:
- #close any other open dialogs so they don't interfere
- common.closeProgressDialogIfOpen()
+import common
+import serviceiter
+__addonpath__ = xbmcaddon.Addon().getAddonInfo('path')
+
common.msg("Started")
lastMessage = time.time()
-counter=0
while (not xbmc.abortRequested):
try:
- counter = counter+1
- if counter % 20 == 0:
- checkProtection()
- common.getXbmcAdultIds() #keep the cache up to date
- closeProgressDialogIfInterfering()
-
+ files = os.listdir(__addonpath__ + "/resources/lib/parentalcontrols")
+ for file in files:
+ if file.endswith(".py") and file != "service.py" and file != "settings.py":
+ module=file[:-3]
+ #reimport the module
+ try:
+ reload(eval(module))
+ except NameError:
+ exec("import " + module)
+ serviceiter.iterate()
except:
traceback.print_exc()
- if (time.time() - lastMessage > 5*60): #we don't want to be too annoying with errors
- common.msg("Error checking plugin protection status")
- lastMessage = time.time()
- time.sleep(.5)
+ time.sleep(10)
+
View
46 script.video.parentalcontrols/resources/lib/parentalcontrols/serviceiter.py
@@ -0,0 +1,46 @@
+import time
+import xbmcgui
+import xbmcaddon
+import xbmc
+import inspect
+
+import common
+import hook
+
+__addon__ = xbmcaddon.Addon()
+__addonpath__ = __addon__.getAddonInfo('path')
+
+def checkProtection():
+ plugins = common.getProtectedPlugins()
+ for plugin in plugins:
+ state = hook.getPluginHookState(plugin)
+ if (not state['hooked']) or not (state['uptodate']):
+ p=hook.hookPlugin(plugin)
+ common.msg("Re-protecting plugin " + p['name'])
+
+def closeProgressDialogIfInterfering():
+ pythonWindow = None
+ pythonWindowId=13000
+ try:
+ pythonWindow=xbmcgui.Window(pythonWindowId)
+ except:
+ pass
+ #window not found
+ if pythonWindow:
+ xmlfile = pythonWindow.getProperty('xmlfile')
+ codeDialogIsUp = xmlfile and xmlfile.find('DialogCode.xml')>=0
+ if codeDialogIsUp:
+ #close any other open dialogs so they don't interfere
+ common.closeProgressDialogIfOpen()
+
+
+def iterate():
+ counter=0
+ while (not xbmc.abortRequested and counter < 20):
+ if counter % 20 == 0:
+ checkProtection()
+ common.getXbmcAdultIds() #keep the cache up to date
+ closeProgressDialogIfInterfering()
+ time.sleep(.5)
+ counter = counter+1
+
View
16 script.video.parentalcontrols/resources/lib/parentalcontrols/wrap.py
@@ -208,20 +208,22 @@ def wrapper_import(*args,**kwargs):
#Determines whether to wrap the plugin. Also shows unlock dialog
def check():
-
- unlockWindow = 5*60
- if time.time() - getUnlockedTime() < unlockWindow:
- return #early return, we're in unlock window so we don't wrap
-
- # see if we're an adult plugin
- showUnlockDialog = thisAddonId in common.getXbmcAdultIds()
+ showUnlockDialog = False
+
# see if our marker is present
match=re.search(overridemarkerPattern, sys.argv[2] if len(sys.argv) > 2 else None)
if match:
sys.argv[2] = re.sub(overridemarkerPattern,'',sys.argv[2]) #strip marker
showUnlockDialog=True
+ unlockWindow = 5*60
+ if time.time() - getUnlockedTime() < unlockWindow:
+ return #early return, we're in unlock window so we don't wrap
+
+ # see if we're an adult plugin
+ showUnlockDialog = showUnlockDialog or thisAddonId in common.getXbmcAdultIds()
+
if showUnlockDialog:
if codeui.unlockUI():
setUnlockedTime(int(time.time()))
View
2 zip-plugin.sh
@@ -4,4 +4,4 @@ zip -r $FILENAME script.video.parentalcontrols/
git add $FILENAME
python addons_xml_generator.py
git status
-echo "Don't forget to commit and push"
+echo "Don't forget to add, commit and push"

0 comments on commit 8d22c46

Please sign in to comment.