Tuesday, February 28, 2006

Friday's Talk, More Scripting...

Friday's talk didn't go as well as I had hoped. Still, in the end, I think the important ideas were broadcasted to the audience... I hope:-P

My scripts are working perfectly! I completely believe that it was a problem of telling it to play while the list was still loading.

I had to change the initial volume they set for amarok, because my soundcard is dying and my machine sounds horrible when amarok is pumped to 100%.

Currently they're both riddled with comments, but I'll post them after... probably once I get the schema for lowering the volume correct on the sleepscript.

I'm working on another script to just load a playlist that I tell it to. Seems simple, but I want it to do a few other things too:) I'll keep you all (meaning Radsaq) updated.

Friday, February 24, 2006

DJ is Famous

DJ, sometimes more well known as, "Deej", is famous for being awesome to computers:

http://www.osnews.com/comment.php?news_id=13778


It should also be noted that I said I would give him this computer before I gave him my phone. I'll stick to that. Especially since I will never give him my phone;)

As far as the scripts are concerned, they are working perfectly, and I'm quite happy. They are happy, but my soundcard is still sad. It goes back and forth between being happy and unhappy, although not as unhappy as it was when it first became very angry at me. In any case, it will need to be replaced, I just don't see any good time this semester for me to be sending my computer off to Dell and not minding that it's gone:-P

I have a talk today. Things seem to be coming together just at the last minute, but I haven't been worried at all. I wish I had been like this for my quals, except that I might not have passed them then;) Of course, I still didn't. And, as one person is likely to say, if I don't start worrying, then I won't ever graduate.

Well, I'm sure this talk is likely to be sexy, and with sexy talks like this, I'm certain to graduate like a pro:-D

Tuesday, February 21, 2006

Luck is not on my side

I got up this morning, and had some extra time, so I decided to modify the two scripts. Now the machine sleeps for a few seconds between loading the playlist and playing. I think the problem before was that it didn't like being told to play while the playlist was still loading. I'll post the scripts when I have the chance.

As soon as I got to school, I tested it again. Everything still worked. So I invited my officemate over to listen to my headphones, and ran the script. She said she heard only a buzz. I turned up the volume... still only a buzz.

I tried it myself. Definitely a buzzing. And faint in the background... some music. Deb checked things out when he returned. Status: bad sound card. Ugh. Not dead, but very ill.

So, in the next few days, I will be sending my machine to Dell... if I'm still under warranty, which I believe I am. I'll have to wait until after the beginning of the weekend, but after then I hopefully won't have to wait long to get it back.

Saturday, February 18, 2006

Fixed? No...

Thanks again to Debajyoti for pointing out where I might be able to find where amaroK stores playlists by default (that place is: ~/.kde/share/apps/amarok/playlists/, by the way).

So I changed my scripts to go look for the playlists there. Initially I had complete success, but at this point, it's again unpredictable by me. Sometimes the scripts work, sometimes they don't.

Deb suggested that I look somewhere for amarok-specific help. I think I may take him up on this...:-P

Thursday, February 16, 2006

Argh.

I took a nap last night, and the scripts worked perfectly. I tried to use them for sleeping at night, however, and it didn't work out so well. It took a number of tries to coax the sleepscript to work, and the alarmscript crashed amaroK.

I think that I need to determine where amaroK stores playlists itself, then try accessing them from there.

Wednesday, February 15, 2006

Using more dcop

I decided to remove all instances of simple command line amarok calls, and replace them with dcop calls. This seems to "fix" some problems. At least it does with the alarmscript. Well... it doesn't make it perfect, but it does make it more predictable, which is nice:)

alarmscript1.sh is now:

DISPLAY=:0.0
export DISPLAY
aumix -v 20
dcop amarok player enableRandomMode true
dcop amarok playlist clearPlaylist
dcop amarok player stop
dcop amarok playlist addMedia file:///home/paithan/Awaken.m3u
dcop amarok player setVolume 100
dcop amarok player play
firefox http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Boston%2C+M

Which seems to work just fine. It is annoying that it tells firefox to head to the wunderground page from whichever firefox browser tab is active in some instance of firefox... I'd rather it just start a new window... but whatever. I can worry about that later.

I made the same changes to sleepscript, but it hasn't seem to have helped. Here's the new sleepscript:

killall -9 firefox
DISPLAY=:0.0
export DISPLAY
aumix -v 6
dcop amarok player enableRandomMode true
dcop amarok playlist clearPlaylist
dcop amarok player stop
dcop amarok playlist addMedia file:///home/paithan/Sleep.m3u
dcop amarok player play
for i in $(seq 101)
do
j=$((101-i))
dcop amarok player setVolume $j
sleep 10
done
dcop amarok player stop

This has the following problems:
If amaroK is playing, it dies, and kills amaroK.
If amaroK is running but not playing, it dies, killing amaroK.
If amaroK is not running, it does nothing.

...hmmm, perhaps this script is just junked now.
...
Okay, some more tests have revealed that some of the calls to firefox may be behind the problem. If these calls do not resolve happily, then the whole script becomes unhappy. Is there a way to make this a bit more roboost... er... robust?

This appears to be even more prevalent with the alarmscript now that I've been messing around with my firefox tabs. It seems like one of those calls just keeps on dying. I'm not sure, though... it could be something with amaroK.

I removed the call to kill firefox from sleepscript, and it appears to be working fine now. I'll update if I have difficulties with that again. I'm going to try more alarmscripts, without having any browser windows open... see what happens.

Wish me luck:)

Testing alarmscript

Okay, I tested alarmscript a bunch more times. It seems to work fine if amaroK is closed, or if the only visible part of amaroK is the little icon in the toolbar (this means it's still running, but what does one call this state?). Then, I tried running it again with full playlists, etc, trying to get it to crash again... but it won't. It's started to work perfectly again.

I just don't understand it.

So then I tried to run the sleepscript while amaroK was playing. This time, it crashes.

Alarmscript starts from no amaroK, then sleepscript crashes it again. Consecutive runs of sleepscript crash it.

It's like only one of them wants to be happy at a time. Awesome. I wonder if there's some issue with the playlists and where they're sitting, etc. I wish I knew where amaroK saves playlists (when you don't specify a location) so I could just have my scripts go access things from there.

No alarm:(

Again, my alarm didn't work. Of course, amaroK was running when I went to bed. When I woke up, it was gone, and the alarm time had passed.

I'll take another look at the script today if I get the chance.

Tuesday, February 14, 2006

Onion

I love The Onion.

http://www.theonion.com/content/node/45388

Sleep worked. Alarm Failed.

Okay, so the sleepscript worked last night, although the alarmscript failed. Here's my shell I/O:

[paithan@localhost ~]$ ./sleepscript1.sh
firefox: no process killed
object not accessible
call failed
amaroK: [Loader] Starting amarokapp..
amaroK: [Loader] Don't run gdb, valgrind, etc. against this binary! Use amarokapp.
QLayout: Adding KToolBar/mainToolBar (child of QVBox/unnamed) to layout for PlaylistWindow/PlaylistWindow
QMultiInputContext::changeInputMethod(): index=0, slave=xim
QMultiInputContext::changeInputMethod(): index=0, slave=xim
QMultiInputContext::changeInputMethod(): index=0, slave=xim
QMultiInputContext::changeInputMethod(): index=0, slave=xim
QColor::setRgb: RGB parameter(s) out of range
QColor::setRgb: RGB parameter(s) out of range
QColor::setRgb: RGB parameter(s) out of range
[paithan@localhost ~]$ at -f alarmscript1.sh 10:30am
warning: commands will be executed using (in order) a) $SHELL b) login shell c) /bin/sh
job 252 at 2006-02-14 10:30
[paithan@localhost ~]$ QMultiInputContext::changeInputMethod(): index=0, slave=xim

When I woke up, amaroK had died. I'm not sure when, but I assume that the alarmscript killed it when it ran in the morning.

I'm of the belief that the scripts don't like running when amaroK is already running. I'll give that a test right now, running the sleepscript.

Okay, on the first test, it failed and killed my running session of amaroK.

On the second, third and fourth tests it worked, but as soon as I quit the script, amaroK died. All three of these tests were run without a running version of amaroK. Also, it is worth noting that amaroK "randomly" chose the same song each time ("Souvenir" by Morphine). It seems to often pick this song when it's in trouble!

On the fifth test, after running amaroK first (but without loading a playlist or anything), the script works correctly. "Control-C"ing the script does not kill amaroK.

After that ctrl-c, I ran the script again. Again, it does fine. Ctrl-c does not kill it. A seventh run does the same. In these cases it is even picking different songs.

After getting the same result for a bunch more times (note that these yield the desired sexiness), I've decided I'll mess with the playlist a bit before I run the script again.

Clear the playlist: Seems to have no negative effects.

Replace with a different playlist: No effect.

Append a playlist: no problem.

Argh... I don't know what the problem was:(

Now I'll try to run alarmscript...

Nope... that killed amaroK! With amaroK dead, we try sleepscript again. Wow, we have the same problem as before: We get Morphine's Souvenir over and over, and "ctrl-c" kills amaroK again. On the fourth try, amaroK has died whilst opening. Thanks a bunch, amaroK, for having a big unremovable icon sit in the middle of the screen on each of my desktops. That is a huge help. Like, help the size of a grizzly bear. (As I found out, clicking on the icon makes it go away.)

amaroK: [Loader] amaroK is taking a long time to load! Perhaps something has gone wrong?

Thanks for the news, amaroK loader.

Further runs of sleepscript do the same thing. So, let's just see what happens with alarmscript.

Hmm, alarmscript starts amaroK and begins to play... yup... Morphine's "Souvenir". It's not even on the Awaken playlist. Looking at this, though, I see that the Awaken list appears directly after the Sleep list in amaroK's playlist. Sleep should not be there. Awaken should clear it off. A second call to alarmscript works. Strange.

Further calls to both scripts all seem to work fine. Gah... I'll worry about this later...:(

On another annoying note, my laptop cuts the sound just after each decrement of the sleepscript. Awesome.




FIRST POST!!!!!!!!!!!11111

Oh SWEET! I am so lucky! I get to be the first person to post here!!!!!!!

Okay, junk-wrangling aside (no, that's not a reference to Brokeback Mountain), here's what I'm working on now:

I'm trying to write a pair of scripts, both to control amaroK. One of these jives should wake me up in the morning (at a given time) and the other should play sleepy music, while slowly reducing in volume.

Right now they work... kinda. At least, they worked last night, because they put me to sleep and woke me up. However, on Sunday morning, the alarm script failed to work, because amaroK crashed or something, and blahblahjunker. The problem is, I don't think I changed anything between when I went to bed on Saturday night and today when I woke up.

Here's the alarm script: (it gets called with 'at -f alarmscript1.sh X:XXam')

DISPLAY=:0.0
export DISPLAY
aumix -v 20
dcop amarok player enableRandomMode true
dcop amarok playlist clearPlaylist
amarok -s
dcop amarok playlist addMedia file:///home/paithan/Awaken.m3u
dcop amarok player setVolume 100
amarok -p
firefox http://www.wunderground.com/cgi-bin/findweather/getForecast?query=Boston%2C+MA

I don't recall why those first two lines are there, but Debajyoti worked out that they were necessary... at one point in time. Deb showed me the coolness of dcop, while radsaq helped me figure out how to make the call to addMedia. Note that after it's all done it also gives me my sexy weather:)

Here's the sleepythyme script: (I just call this junker with './sleepscript1.sh')

killall -9 firefox
DISPLAY=:0.0
export DISPLAY
aumix -v 6
dcop amarok player enableRandomMode true
dcop amarok playlist clearPlaylist
amarok -s
dcop amarok playlist addMedia file:///home/paithan/Sleep.m3u
amarok -p
for i in $(seq 101)
do
j=$((101-i))
dcop amarok player setVolume $j
sleep 10
done
amarok -s

Note that the first thing this wants to do is kill any instances of firefox. It'd be great to get that working. Stupid firefox crashes my computer if it's left idle for too long. Well... it doesn't crash it... but it does get X to start using 99% of my CPU, overheating my laptop, and melting a hole in my desk:-P (Thank you Lapinator for preventing that hole from actually occuring!) Of course, this also prevents anything else from running properly;)

The changes that I made at the end on Saturday night was moving the (first instance of the) line 'amarok -s' further down in the script. I think amaroK was unhappy about being given some command (at which point it starts up if it hadn't already been) then immediately stopping. But, like I said, I think this version of the scripts caused it to crash on Sunday morning (and I woke up an hour late, egads!).
These are the first scripts I've ever (really) written, and any help with these would be great. I will try to do most of the writing of them myself as I update them (I want to end up calling at somehow inside the script instead of using at to call the script).

In other news, I want to get an alphasmart neo. Yay. Also in other news, I'm already annoyed with Blogger. Here are my annoyances so far:

1) I can't seem to turn off Italics at the end of my text using the hot keys. Is this a problem with my version of Firefox?

2) I can't edit an existing link just by placing the cursor inside the linked text and clicking on the link button. This is annoying, because in order to decide where the link will be, I have to highlight text. As soon as I click the link button, it opens a window over Firefox, so I can't go and highight the actual url I want to put in there (generally the url from another Firefox tab).

There's probably an easy work around, but I don't want to have to use Windowy hotkeys to copy-paste:-P

Similarly annoying, is that then when I then close that little window, my cursor has the little link attached to it, and if I put it somewhere it throws it in my text box here. Awesome. Just plain awesome.

Okay, it's just about time for bed for me. Indeed, Kyle is sleepy. Or, he will be if his sleepythyme(pizzapie) script works.