LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How can I use my laptop as an Alarm Clock? (https://www.linuxquestions.org/questions/slackware-14/how-can-i-use-my-laptop-as-an-alarm-clock-4175518549/)

Bertman123 09-14-2014 10:27 AM

How can I use my laptop as an Alarm Clock?
 
I have an old compaq laptop that had XP on it and currently has linux mint 17 on it.

I like to use it as an alarm clock - using alarm-clock-applet. I have it set to start rhythmbox and automatically shuffle my music.

Is there a similar way that I can set that up with slackware? I've found the website for the program and could try compiling the program on slackware, but before I do that I figured I see if there's another way to do that.

yancek 09-14-2014 11:33 AM

Are you using KDE on Slackware? If so, you can use kalarm. Type kalarm or /usr/bin/kalarm in a terminal to open it. If you get no response, it's not installed. If you are not using KDE, you didn't indicate what you are using so...?

Bertman123 09-14-2014 01:32 PM

Quote:

Originally Posted by yancek (Post 5237758)
Are you using KDE on Slackware? If so, you can use kalarm. Type kalarm or /usr/bin/kalarm in a terminal to open it. If you get no response, it's not installed. If you are not using KDE, you didn't indicate what you are using so...?

Actually the laptop is old enough I'm probably going to use xfce or mate.

jmccue 09-14-2014 01:38 PM

Not sure what you mean by 'simple was to set up', but depending upon your music files you can use a combination of at(1) and ogg123(1) to play a music file at a specified date/time. Maybe create a script to pass a shuffled playlist into ogg123 or another command line music player. Or even better use crontab(1) entries instead of at(1)

John

kikinovak 09-14-2014 03:17 PM

You can use the Lightning plugin for Thunderbird. It has a calendar as well as an alarm function.

dslackw 09-14-2014 03:40 PM

alarm.py

Code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import time

ALARM = "23:35:50"
SONG = "/path/to/song/song.mp3"

while True:
    os.system("clear")
    print "Alarm set at %s" % ALARM
    start_time = time.strftime("%H:%M:%S")
    sys.stdout.write("Time : " + start_time)
    sys.stdout.flush()
    time.sleep(0.1)
    if start_time == ALARM:
        os.system("mplayer %s" % SONG)
        break

python alarm.py

Bertman123 09-14-2014 08:37 PM

Quote:

Originally Posted by kikinovak (Post 5237868)
You can use the Lightning plugin for Thunderbird. It has a calendar as well as an alarm function.

Lightning has an alarm function? I'll have to look into that more.

Thanks guys for all of your advice and help.

Bertman123 09-14-2014 08:38 PM

Quote:

Originally Posted by dslackw (Post 5237889)
alarm.py

Code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import time

ALARM = "23:35:50"
SONG = "/path/to/song/song.mp3"

while True:
    os.system("clear")
    print "Alarm set at %s" % ALARM
    start_time = time.strftime("%H:%M:%S")
    sys.stdout.write("Time : " + start_time)
    sys.stdout.flush()
    time.sleep(0.1)
    if start_time == ALARM:
        os.system("mplayer %s" % SONG)
        break

python alarm.py

Thanks, I'm going to play round with this and see how it works for me.

moisespedro 09-14-2014 09:29 PM

I would suggest using this as the alarm sound:

# aplay /dev/sda

Richard Cranium 09-14-2014 10:36 PM

Quote:

Originally Posted by dslackw (Post 5237889)
alarm.py

Code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import time

ALARM = "23:35:50"
SONG = "/path/to/song/song.mp3"

while True:
    os.system("clear")
    print "Alarm set at %s" % ALARM
    start_time = time.strftime("%H:%M:%S")
    sys.stdout.write("Time : " + start_time)
    sys.stdout.flush()
    time.sleep(0.1)
    if start_time == ALARM:
        os.system("mplayer %s" % SONG)
        break

python alarm.py

I wouldn't do short sleeps in a loop, myself...

Code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import time
import datetime

ALARM = "23:35:50"
SONG = "/path/to/song/song.mp3"

os.system("clear")
print "Alarm set at %s" % ALARM
(hr, minutes, secs) = ALARM.split(":")
tgttime = datetime.time(int(hr), int(minutes), int(secs))
today = datetime.date.today()
tgt = datetime.datetime.combine(today,tgttime)
if (now < tgt):
    stime = (tgt - now).total_seconds()
else:
    stime = (tgt - now).total_seconds() + 24*60*60
time.sleep(stime)
os.system("mplayer %s" % SONG)


ttk 09-14-2014 11:18 PM

When I need an alarm in seven hours, I keep it simple:

Code:

# sleep 25200 ; xine something_raucous.mp3

enorbet 09-14-2014 11:19 PM

If you'd prefer to not have to install anything and you don't mind a bit of Flash, you can use http://onlinealarmclock.ms/

Ilgar 09-15-2014 12:23 AM

If you're going to use Xfce, there's a panel plugin that I've written: xfce4-timer-plugin. You can set it to run a specific command.

Darth Vader 09-15-2014 03:45 AM

To have a Real Alarm Clock (TM), the victim computer should have the ability to wake-up from stand-by, at specified time, a task available in some BIOS-es...

Then, after your Slack was booted at the right time, enter in the game Your Patented Noise System (TM).

Or, you will leave the computer on, beyond the night? :p

eloi 09-15-2014 10:44 AM

Wake Up! This is Unix.
 
Run:

Code:

$ arecord > /path/to/wakeUp.wav
Cry in your microphone "HEY, WAKE UP!", several times. Stop the recording with Ctrl-C. Then open your crontab with:

Code:

$ crontab -e
And write this line to run it at 7:00 AM:

Code:

0 7 * * * aplay /path/to/wakeUp.wav

(All of you should wake up.)


All times are GMT -5. The time now is 02:26 PM.