Hi,

with the help of Mike Ruelle and Stephan Kanthak I was able to improve the 
integration of the nvram-wakeup stuff into freevo.

There's now a plugin called "idletimer" which checks for user activity within 
freevo (e.g. read mail, news, etc.). The bash-script checks for external 
activity (e.g. mplayer, xine, lame, cdparanoia, etc.) and should cover all 
current plugins which call external programs. If you want to control the 
automatic shutdown manually, you can press "e" on the "Shutdown"-item 
from freevo's main menu. It offers to pause/resume.

To setup the whole stuff add:

ENABLE_NETWORK_REMOTE = 1
SHUTDOWN_SYS_CMD="/path/to/wakeup_check.sh shutdown"
IDLETIMER_INTERNAL_DELAY=700 # feel free to change
IDLETIMER_EXTERNAL_DELAY=900 # feel free to change
plugin.activate('idletimer') 

to your local_conf. Edit the wakeup_check.sh to your personal needs
(quiet easy) and add a new cronjob:

 */1 * * * * /path/to/wakeup_check.sh 
 
You shouldn't change the 1 minute cycle. Copy idletimer.py into 
plugins-directory, wakeup_check.sh to your favorite script dir, patch 
shutdown.py (located at src/plugins/). 

That's it. Hope someone will find it usefull. I'd be happy to receive
some feedback.

Regards
        Georg

-- 
Mein oeffentlicher Schluessel fuer PGP/GPG - Verschluesselung:

pub �1024D/63EB55CA 2002-11-27 Georg Kuenzel <[EMAIL PROTECTED]>
Key fingerprint = 8DA9 55C6 91FA D92D 89C3 �7C22 0A1D 790C 63EB 55CA

Attachment: idletimer.py
Description: application/python

Attachment: wakeup_check.sh
Description: application/shellscript

47a48
> import plugin
52c53
< 
---
> from gui.AlertBox import AlertBox
137c138
< 
---
> 	self.lockfile = '/tmp/idletimer_lock_manually'
144c145
<             items = [ (self.confirm_freevo, _('Shutdown Freevo') ),
---
>             items = [ 	  (self.confirm_freevo, _('Shutdown Freevo') ),
146,147c147,151
<                           (self.confirm_system_restart, _('Restart system') ) ]
<         else:
---
>                           (self.confirm_system_restart, _('Restart system') ),
> 			  (self.confirm_pause_nvram, _('Pause automatic shutdown') ), 
> 			  (self.confirm_resume_nvram, _('Resume automatic shutdown') ),]
>         
> 	else:
150,152c154,169
<                           (self.shutdown_system_restart, _('Restart system') ) ]
<         if config.ENABLE_SHUTDOWN_SYS:
<             items = [ items[1], items[0], items[2] ]
---
>                           (self.shutdown_system_restart, _('Restart system') ),
> 			  (self.pause_nvram, _('Pause automatic shutdown') ),
> 			  (self.resume_nvram, _('Resume automatic shutdown') ) ]
> 
>         idletimer = plugin.getbyname('idletimer')
> 	if config.ENABLE_SHUTDOWN_SYS:
> 	    if idletimer:
> 	    	items = [ items[1], items[0], items[2], items[3], items[4] ]
> 	    else:
> 		items = [ items[1], items[0], items[2] ]
> 	else:
> 	    if idletimer:
> 	    	items = [ items[0], items[1], items[2], items[3], items[4] ]
> 	    else:
> 	    	items = [ items[0], items[1], items[2] ]
> 	return items
154d170
<         return items
155a172,178
>     def confirm_pause_nvram(self, arg=None, menuw=None):
>         """
>         Pops up a ConfirmBox.
>         """
>         self.menuw = menuw
>         what = _('Do you really want to pause the automatic shutdown?')
>         ConfirmBox(text=what, handler=self.pause_nvram, default_choice=1).show()
156a180,187
>     def confirm_resume_nvram(self, arg=None, menuw=None):
>         """
>         Pops up a ConfirmBox.
>         """
>         self.menuw = menuw
>         what = _('Do you really want to resume the automatic shutdown?')
>         ConfirmBox(text=what, handler=self.resume_nvram, default_choice=1).show()
> 	
181a213,230
>     def pause_nvram(self, arg=None, menuw=None):
>         """
>         pause nvram-wakeup script
>         """
> 	open(self.lockfile, 'w').close()
> 	pop = AlertBox(text=_( 'Automatic shutdown has been paused.' ))
> 	pop.show()
>     	
>     def resume_nvram(self, arg=None, menuw=None):
>         """
>         resume nvram-wakeup script
>         """
> 	try:
> 		os.remove(self.lockfile)
> 		pop = AlertBox(text=_( 'Automatic shutdown has been resumed.' ))
> 	except:		
> 		pop = AlertBox(text=_( 'Automatic shutdown has allready been resumed.' ))
> 	pop.show()
182a232
> 	

Reply via email to