2014-08-08, 19:02
hi,
i was wondering, that there isn't any shutdown-hook-possibility integrated already. or did i missed something?
i thought i can not be the only one with this kind of usual use cases, that's why i wanna share the code,
maybe someone else has also usage for it. so far i patched and tested it with the current gotham branch from git with linux.
if someone has any criticism/suggestions about the code, ideas or whatever,
i would be happy to hear about!
what?:
why? - some of my use cases
any future plans? - stuff i was thinking about:
what's about the os independence exatly?
i have to say that i'm a linux-only guy and i don't have any other os to test this.
that's also a reason, why i wanna make this feature optional via advancedsettings,
to make sure this will not gonna make problems on some other os, if you did'nt activated it.
at least i would say that i would have to add some os-switches for the path of the shutdown-hooks,
but i don't know if that would be enough.
maybe there are also different exit codes for scripting or some c/c++ functions missing.
best regards,
sven
my xbmc branch and patches are rebased against xbmc-gotham.git-867305b.
xbmc branch on github...............................................: https://github.com/svenburkard/xbmc/comm...nHookCheck
some example shutdown-hook-scripts on github: https://github.com/svenburkard/xbmcShutdownHooks
#-----------------------------------------------------------------------------------------------------------------------#
latest patches:
0001-custom-shutdown-hook-support-added-with-a-possible-e.patch
0002-shutdown-hook-folder-is-now-changed-to-an-available-.patch
0003-send-a-xbmc-notification-if-a-shutdown-hook-script-i.patch
0004-.deb-build-related-stuff-added-to-.gitignore-file.patch
0005-trailing-whitespaces-removed.patch
0006-improved-the-way-of-getting-the-home-directory-to-be.patch
0007-replaced-the-sendMSGtoXBMC-curl-hack-with-a-native-x.patch
0008-replaced-cout-with-a-native-xbmc-logging-function.patch
0009-improved-the-way-of-getting-the-home-directory-now-u.patch
0010-separated-the-functions-and-class-stuff-into-.h-.cpp.patch
0011-gui-option-added-for-enabling-disabling-of-shutdownH.patch
latest AllInOne Patch:
fb_shutdownHookCheck-AllInOnePatch-2014.09.13-f0e5f80.patch
#-----------------------------------------------------------------------------------------------------------------------#
EDIT:
latest patches added;
future plans modified;
i was wondering, that there isn't any shutdown-hook-possibility integrated already. or did i missed something?
i thought i can not be the only one with this kind of usual use cases, that's why i wanna share the code,
maybe someone else has also usage for it. so far i patched and tested it with the current gotham branch from git with linux.
if someone has any criticism/suggestions about the code, ideas or whatever,
i would be happy to hear about!
what?:
- easy integration of custom hook scripts, which will be executed right before xbmc exit/shutdown
- the code is checking a predefined folder for custom hooks and executes all scripts inside this folder (until one of them returns an exit code not 0)
- prevent xbmc from exit/shutdown (xbmc stays active in it's current state), if one of the custom hook scripts returns an exit code not 0
- inform the user via xbmc-notifications if the exit/shutdown will be stopped by a custom hook script
why? - some of my use cases
- this days i built a setup with xbmc and vdr on a single pc for a friend
and i wanted to be able to prevent xbmc from exit/shutdown and inform the user,
when a vdr timer is active or in 15min or less. if you are trying to solve that problem outside of xbmc, it's already to late.
you could try to stop the shutdown with a custom script in your init-system,
but xbmc would already be closed and you couldn't use it in a usual way from your couch until the blocking condition is done and the pc restarts the next time
or you restart the xbmc process (which needs manul input or a custom remote key)
- at my home i have a setup with multiple xbmc-clients, a vdr-server and a data-server. it's all seperated hardware.
before i shutdown one of the xbmc-clients a script always checks, if the data-server is running
and if anyone is using it right now (exept the client, which want's to shutdown).
if this client is the only one, the data-server will be shutdown and all xbmc-clients in the house get a xbmc-notification,
that the data-server isn't needed anymore and will be shutdown.
otherwise the xbmc-clients will get a notification, that the server is still in use.
in the past i solved this just with replacing the xbmc-shutdown function on my remote with a custom script.
but now i prefer this integrated solution, because it's working without any skin or remote modifications, it's easy expandable and has more possibilities
any future plans? - stuff i was thinking about:
- replacing curl binary with native c/c++ functions to reduce dependencies
- gui option to enable/disable shutdown-hooks (old idea: checking only for shutdown-hooks if it's activated in advancedsettings)
- giving the custom hook scripts the information which kind of 'exit' (exit, shutdown, reboot, ...) is going on as a parameter
=> this adds more possibilities to the custom hook scripts
- os independence? is there really something else than linux? just kidding ;-)
what's about the os independence exatly?
i have to say that i'm a linux-only guy and i don't have any other os to test this.
that's also a reason, why i wanna make this feature optional via advancedsettings,
to make sure this will not gonna make problems on some other os, if you did'nt activated it.
at least i would say that i would have to add some os-switches for the path of the shutdown-hooks,
but i don't know if that would be enough.
maybe there are also different exit codes for scripting or some c/c++ functions missing.
best regards,
sven
my xbmc branch and patches are rebased against xbmc-gotham.git-867305b.
xbmc branch on github...............................................: https://github.com/svenburkard/xbmc/comm...nHookCheck
some example shutdown-hook-scripts on github: https://github.com/svenburkard/xbmcShutdownHooks
#-----------------------------------------------------------------------------------------------------------------------#
latest patches:
0001-custom-shutdown-hook-support-added-with-a-possible-e.patch
0002-shutdown-hook-folder-is-now-changed-to-an-available-.patch
0003-send-a-xbmc-notification-if-a-shutdown-hook-script-i.patch
0004-.deb-build-related-stuff-added-to-.gitignore-file.patch
0005-trailing-whitespaces-removed.patch
0006-improved-the-way-of-getting-the-home-directory-to-be.patch
0007-replaced-the-sendMSGtoXBMC-curl-hack-with-a-native-x.patch
0008-replaced-cout-with-a-native-xbmc-logging-function.patch
0009-improved-the-way-of-getting-the-home-directory-now-u.patch
0010-separated-the-functions-and-class-stuff-into-.h-.cpp.patch
0011-gui-option-added-for-enabling-disabling-of-shutdownH.patch
latest AllInOne Patch:
fb_shutdownHookCheck-AllInOnePatch-2014.09.13-f0e5f80.patch
#-----------------------------------------------------------------------------------------------------------------------#
EDIT:
latest patches added;
future plans modified;