Sunday 20 November 2011

More texting on your N810

In a previous post I explained how I made a web texting app for my nokia n810 using cabbage on my server and Illumination and a few custom blocks to write a little python script on for my device. Unfortunately this post's app was only really relevant to people in Ireland and I have found another way to text on my n810, using a bluetooth connection to my phone. Its a cool command line app called gnokii. When I originally installed gnokii it  had a feature in the control panel to configure and a gui called phone link neither of which actually worked for me. So I uninstalled all the phone link stuff and was just left with the command line app gnokii. I did a bit of googling and found out you have to write a config file for gnokii to work properly with you phone. So I wrote one and placed it in gnokii's default place for its config on the n810 ./home/user/.gnokiirc, this is a different place from its config on desktop linux to which I can only say "Why?". My config will work with most phones. The port is your phone's mac address. I've blanked mine out in case some mean people ever read this. Model refers to how the commands that gnokii will use to communicate with the phone. AT stands for AT commands which were developed in the 80's for old telephone systems and I think you can guess connection.

I decided re-use my Illumination file from my web text project so I just added a button to the GUI, moved a few blocks around and wrote a quick little custom block to read text messages using gnokii. I made sure the app could do this because the entire idea of this project is that I never have to take my phone out of my bag. Anyway here's the code I use for the custom block.

 filearray = f.readlines()
 lastline = filearray[-3]+filearray[-2]+filearray[-1]
 ISCVariable2 = lastline

This block runs a gnokii command gnokii --getsms 1 end and grab the last message the phone received from the output. Now I never have to look at my phone again if I don't want to. It can stay in my bag while I play emulator on my n810 and if I receive a text I can read and respond to it all from my n810. By the way if anyone thinks its cool how easy it is to develop for this device why don't you grab one on ebay I got mine for 60 euro. Also you may want to get illumination especially if your lazy like me. I think they have sale on and its only 20 dollars until December 1st.

Here is the Illumination file and source code:
Illumination file

Did I mention the python script, I have written for n810, will also work on any linux desktop with python and gtk support(ie. pretty much all of them) for this particular one you just need to sudo apt-get install gnokii. Although if you really want something like this for Desktop Linux use Wammu its an amazing application for using your phone with Linux.

Last but certainly not least a little bit of news on the jupiter broadcasting app. I've added the feature to see the live video. Although I would like to point out this is entirely due to scale engine and Allan being awesome.
 Commented this bit out because turns out I put it in the market ;)

 I've given Chris and unsigned apk to sign himself and put it in the market so you should see it in the market soon.

Tuesday 1 November 2011

Easy Ruby Media Player

I'm currently in the process of learning ruby due to a college module but one of the crap things about learning a new language is that most of the examples and short programs you write are so pointless. They don't really do anything or at least anything useful. So I decided to write something in ruby that I could actually use.

One of the local radio stations radio nova a rather awesome rock station just had a top 500 guitar songs of all time and published them on their website. Its a pretty good list of songs so I thought why not make a script to play a random song the list using ruby and youtube . Turns out its not that hard :

This just picks a random line in an inputed file searchs for it on youtube and opens the first link. I thought that was easy why not make something slight more useful lets give it the ability to to play multiple songs and skip songs. Another regex to get the length of the video and tell the thread to sleep for that length between songs. Then a second thread to take input from the command line and we are done :

There we have it my new media player at least until I get bored of the novelty of it and go back to a real one. Obviously this isn't the most advance ruby script ever but still it was nice to make my first multi-threaded ruby script and have it doing something relatively useful rather than turning on and off the light in an imaginary lighthouse. Hope this was helpful to others just starting off with ruby.