Thursday, March 16, 2006

Walkies

Right. The other point of this blog was for me to keep track of how many times I've walked each week. I try to get around 5 or 6 walks. The length of one of these "walks" should be about as long as it takes me to walk to school---50 minutes.

This week so far I've gotten four walks in. I walked to and back from school on Monday. On Tuesday I walked back from school. Yesterday I walked to MIT (too short, doesn't count) then walked back a long way (counts, way over 50 minutes). Today I walked in to school, and will likely walk back to my apartment afterwards. Tomorrow, however, I doubt I'll walk either way:-
So, I should get in 5. That'll be enough;)

Wednesday, March 08, 2006

Script 4 done! Also, non-script stuff?

With some great help from Debajyoti and lots of monkeys on irc (richie, lj, raddykins, srl) on appending strings to files, I got my latest script to work. This one takes the current song playing in amaroK and stores it to a specified playlist. Like the others, it's very specific to my machine, but I'd also like to write in some error checking before I post it. I will soon, though.

In other news, I just took a trip this weekend and took "Mere Christianity" by C.S. Lewis with me. A few people want my input on this, me being a spiritual person without many conservative political tendencies. I read not very far before I found what I think is a break in his logic, and I lost some motivation to keep on going. I dunno whether I'll finish it, but I will take another look and comment on the error that I think I found.

In any case, I would like this blog to not only be about scripts and the size of my wang. It would be nice for some politics and religion to get in here also. I'm extremely open about both, and I'd like to get challenged on my views.

Having said that, I should probably say something about my views:-P

Not yet, though. It's late, and it's time for monkeys like me to sleep.

zzzzz

Tuesday, March 07, 2006

Playscript is Happy

First, I should mention that I've posted the sleepscript and the alarmscript here at the bottom. Feel free to scroll down the bottom of this post if you care at all:-P

I (think I've) finished a third script. This one loads a specified playlist, chooses a place at random in that script to start, then plays from there, once the current song (if any) is done playing. It turns off the randomness as soon as it starts playing from the new script, so it'll keep the order once it starts.

So, if I want to play my playlist named 'Progressive', I type the following:

$ ./playscript.sh Progressive

playscript:
DISPLAY=:0.0
export DISPLAY
fileString="file:///home/paithan/.kde/share/apps/amarok/playlists/$1.m3u"
echo $fileString
dcop amarok player enableRandomMode true
dcop amarok playlist clearPlaylist
dcop amarok playlist addMedia $fileString
sleep 1
if [ "$(dcop amarok player isPlaying)" = "true" ];then
totalSeconds=$(dcop amarok player trackTotalTime)
secondsPlayed=$(dcop amarok player trackCurrentTime)
secondsLeft=$(( totalSeconds - secondsPlayed ))
echo "amaroK is currently playing"
echo "The new playlist will begin playing in $secondsLeft seconds."
sleep $((secondsLeft + 1))
else
sleep 1
dcop amarok player play
fi
dcop amarok player enableRandomMode false

Now, as promised, here are the other two scripts.

sleepscript:
DISPLAY=:0.0
export DISPLAY
echo "Time to go to sleep, Kyle..."
echo "Stopping amaroK..."
dcop amarok player stop
echo "Setting your machine's volume..."
aumix -v 4
echo "Enabling amaroK's randomness..."
dcop amarok player enableRandomMode true
echo "Clearing the previous playlist..."
dcop amarok playlist clearPlaylist
echo "Loading the Sleep playlist..."
dcop amarok playlist addMedia file:///home/paithan/.kde/share/apps/amarok/playlists/Sleep.m3u
echo "Playing in 3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
echo "Now."
dcop amarok player play
echo "Go to sleep, Kyle..."
for i in $(seq 71)
do
j=$((70-i))
dcop amarok player setVolume $j
sleep $i
done
dcop amarok player stop

alarmscript:
DISPLAY=:0.0
export DISPLAY
aumix -v 9
echo "It's time to wake Kyle up..."
echo "Enabling Randomness..."
dcop amarok player enableRandomMode true
echo "Clearing the previous playlist..."
dcop amarok playlist clearPlaylist
echo "Stopping amaroK..."
dcop amarok player stop
echo "Loading the Awaken playlist..."
dcop amarok playlist addMedia file:///home/paithan/.kde/share/apps/amarok/playlists/Awaken.m3u
echo "Maximizing amaroK's volume..."
dcop amarok player setVolume 65
echo "AmaroK will play in 3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
echo "Now."
dcop amarok player play
echo "Here's the weather"
firefox http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Boston%2C+MA