Re: [Rhythmbox-devel] Suggestion: Power off until last media is played

On Sun, 2007-09-30 at 14:14 +0200, Dirk Fanick wrote:
> Hi!
> I've got a suggestion or request or however you wanna call it. I'd like
> to have a function to auto-switch-off my computer until the last
> media-file is played.
> I often go to bed (nearly every day) and I would like to listen to some
> music or watch some video until I sleep - without keeping my computer
> running the whole night. And yes: I'm too lazy to stand up and turn it
> down by myself.
> I can do it via 
> mplayer media.ogg && shutdown now -h
> but it's not as comfortable as it would be with rhythmbox (playlist
> etc.).

You could do something similar with rhythmbox-client, start Rhythmbox
playing the playlist you want then run a shell script which does
something like:

#! /bin/bash

PLAYING=`rhythmbox-client --no-start --print-playing`

while [ -n ${PLAYING} ]; do
	sleep 120s
	PLAYING=`rhythmbox-client --no-start --print-playing`

sudo shutdown -h now

For extra points you could modify the script to start the Rhythmbox
playing the playlist you like to listen to as you fall asleep and then
use Dbus to talk to Gnome Power Manager to ask your computer to suspend
rather than shutdown.

If you wanted to be REALLY clever you could modify the shell script to
use Zenity to present the user a GUI to select a playlist and then start
Rhythmbox playing automatically before entering the while loop.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]