Tuesday 28 July 2009

Alarm - Update

Due to a bug with DCoP, I had to slightly change the script so that it works always. I had to use sed as well this time. I also licenced it.
So, here again is my crontab file:
http://files.getdropbox.com/u/289093/crontab

And so, here is the alarm script again:
http://files.getdropbox.com/u/289093/alarm
Hope you enjoy this.

Ps. I know I am no he best sed user but, at least now this works.

Update: Volume goes to 60% not 80.

Update 2: Due to a bug within crontab, it s necessary to have a blank new line at the end. Otherwise, crontab will load well but the last command will not execute.

Monday 27 July 2009

Potential treats in my Linux! =D

One of the things I am very proud of about the operative system on my pc is the fact that there are hardly few viruses out there that can cause harm to it. It is a very well known fact about Linux.

My only question is why some people just doesn't get it?

Wednesday 22 July 2009

Alarm with Amarok, Cron, DCoP, xterm and the bios.

I realised that my pc has the option to "auto-turn on" at a specific time and date. So I thought of making an alarm out of my computer.

After a lot of googling, searching, reading and trying (listening to Technology by Daft Punk) I found this out:
http://forums.fedoraforum.org/showthread.php?t=106321

So I decided to modify this script to my needs.
I didn't want to use kalarm either as I tra;y to be minimalist and I don't have a very powerful machine.

Well, after a lot more of google tis, google that, I finally have my alarm working. This is my crontab:
# m h dom mon dow command
34 05 * * 1-6 export DISPLAY=:0.0 ; xterm -e "/home/adan/alarm & bin/bash"


And this is the "alarm" script (I don't like naming every script with .sh I just don like it):
#!/bin/bash

amarok
sleep 20s

dcop amarok player setVolume 0

dcop amarok playlist togglePlaylist
dcop amarok playlistbrowser loadPlaylist "50 Random Tracks"

sleep 10s
dcop amarok player play
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s
dcop amarok player volumeUp
sleep 43s


Explanations:
  • You should specify the DISPLAY in order to run X apps from cron.
  • I run a xterm that runs the script because of unresolved problems with DCoP.
  • Xterm needs the /bin/bash at the end. If you don't use it it will just terminate and disapear after the last command.
  • Volume goes to 80% with this script.
  • You need to toggle to the playlist window because otherwise, amarok will not recognise the playlist.
  • Uhm, and 34 minutes because we are so used to the 0s and 5s and we have always to approximate everything and I am not in agreement with that. If I want to meet someone at 10:58, why do people always says "well, that's 11 o'clock"? Do I add or substract minutes to their arrangements? I don't.
Here are the web pages (apart from the one with the script) that helped me do this:
  • http://ubuntuforums.org/showthread.php?t=815881
  • http://amarok.kde.org/wiki/DCOP_Functions
  • http://linux.derkeiler.com/Newsgroups/alt.os.linux.suse/2004-01/3951.html
  • http://www.linuxforums.org/forum/misc/115239-getting-prompt-after-xterm-e-command.html
I hope you all have found this useful.

Have a nice week.