Monday, June 29, 2009

Invoking Spotify playlist using applescript

Spotify has plenty of Finnish children's music available so it has gained specific popularity in our household. This has rendered my older iTunes-control -scripts not that useful anymore. I decided to give Spotify scripting a go, even though I knew there's not applescript interface available. Thankfully simple key navigation is enough for the basic use case of "play random song from this playlist":

-- Invoke Spotify simply by opening a Spotify playlist or artist URL

open location "http://open.spotify.com/artist/4Zml6rzsSiVkfIIWJh6EWX"

-- Make sure we have the spotify-application on front and in focus
tell application "Spotify"
activate
end tell

-- Now navigate to the song we want to play and play it
tell application "System Events"
-- Three times tabulator = move selection to the songs list
key code 48
key code 48
key code 48
-- Wait for a while the spotify app to catch up
delay (2)
-- enter key = play selected song
key code 36
-- right key with command = next song (random assumed)
key code 124 using command down
end tell
Note that if the Spotify URL is your private playlist this still works, as the playlist is invoked locally!

Other assumptions:
  • "enable access to assistive devices" is enabled on the "Universal Access" -settings
  • Spotify URL:s properly associated to your favourite browser (tested only with firefox)
Known issues:
  • Invoking a random song requires you to set the shuffle on manually on the Spotify app
  • Naturally this generates new browser tabs on each time the script is invoked
  • As the key events are used, and even with a noticeable wait in between, this can cause really weird results if something is happening onscreen either interactively or autonomously.
  • There is no straightforward way of knowing if Spotify is already playing something. Toggling the playback off, if invoked second time (useful when used with RFID tags) isn't therefore easy.. or is there a apparent solution other than closing the app?
As this works OK, I have to print out new RFID-tag for Ti-Ti -nalle for my daughters ;)

Again, the script is not really a rocket science and most of the elements were just copy&pasted from invaluable Doug's AppleScripts. It is just fun to simply being able to control other apps in OSX!

Tuesday, May 05, 2009

Changes, changes..

Looking back couple years there has been "one big change" happening in our life each year. Change of country, moving places, change of job, getting married, birth of children etc.

This year it will be significant change in my employment.

I am leaving Nokia this month, after six years, and I'm heading to a researcher position in Finnish Defence Forces! One can say that this will be a big change in company ways of working, scope and the whole technology context. On the other hand, I am looking forward applying some of my experience in this new envinronment in new ways and learning a lot at the same time.

I am looking back to my years at Nokia with warmth. It is a very good, big company to work for - providing lots of exciting challenges with lot of variety. I have also had the pleasure of constantly working with very intelligent people, many of which are the absolute world class top professionals in their fields.

Now, maybe I can have a bit more opportunities for doing mobile programming as a hobby as it is not filling 110% of my work days? Well, you never know.. ;-)

Saturday, March 07, 2009

Simple applescript for playing music in iTunes

In addition to make skype video calls I thought it would be nice to give my kids some control over playing music on the iMac. So, a new rfid tag was assigned to following simple applescript:

tell application "iTunes"
if player state is playing then
stop
else
set the view of the front browser window to playlist "kertun musaa"
set myNumberOfTracks to number of tracks in playlist "kertun musaa"
set randomTrack to (random number (myNumberOfTracks - 1)) + 1
play track randomTrack of user playlist "kertun musaa"
end if
end tell

So when the tag is shown to the reader the script either
  • stops the playback if itunes is playing a something, or
  • if nothing is playing, starts a play a random song in a named playlist
The script would've been even more simple if iTunes would allow setting the current playlist. Then I could've used the native shuffle mode of the player.

Using applescript one can do almost anything on iTunes. A good source for further information is http://dougscripts.com/itunes/

Friday, March 06, 2009

RFID "calling cards" for OSX and Skype

I made a simple "calling cards" for my daughter(s) which enable her to make a Skype video call to me and to her grandparents without using keyboard and mouse. In order to make the call she would just show the card with right image to the reader. Computer would respond by saying aloud either "calling grandma" or "cannot make the call to grandma", depending whether the other party is online or not.

cheap rfid-reader and "calling cards"

Setup:
  • iMac with Skype installed
  • Tikitag/Touchatag rfid reader. Bought the reader and some tags for about 12€ (75% discount) when the company changed its name.
  • Applescripts for calling to grandmas and myself at work, saved as application. The scripts check if the target is online, gives voice feedback using speech synthesizer, and makes the call with the window maximized.
  • Rfid tags assigned with local URL:s at touchatag service. The local url is simply a link to the application to start when the tag is shown to the reader. As example, an URL to "call my work skype app" is
    file:///Applications/as/call_simo.app
  • Pictures in see-through plastic pouches. The Rfid tag is put behind the image. One could also e.g. laminate the cards.
I have also experimented having Nokia N770 internet tablet next to the reader showing visually who is online and who isn't. Having the extra device on the table did make the setup look a bit complex. Let's see with the target audience if is it needed or not. ;-)

Controlling a computer via non-traditional methods feels nice. If the setup works reliably and the actual interaction makes sense I will definitely expand the use to playback of some favourite music etc.

OK, nice hack but will it be used for real? We see it next week when the family comes back home ;)

EDIT: Added the example of a local URL

Thursday, March 05, 2009

Learning applescript: controlling skype

While I've always known that you can control many of the applications running in OSX using applescript I have very rarely tried that myself.

Now, as I have a use case of semi-automation of skype video calling for the kids I started experimenting. I did buy a tikitag rfid reader on cheap which will be used for triggering the call.

Here's what will be triggered by the rfid tag. This simple script checks if person xxxxxx is online and tries to open a call if he is. At the same time the script enlarges the call window to full screen for maximum video size. I have added some text-to speech notifications just for sake of experimenting, most probably I will replace them later with recorded samples.

Edit: Updated the script a bit and framed it in

SkypeCall("xxxxxx")

on SkypeCall(login)
set AppleScript's text item delimiters to " "
tell application "Skype"
set foo to send command "GET USER " & login & " ONLINESTATUS" script name "MyScript"
set UserStatus to my GetPart(foo, 4, " ")
if UserStatus is "ONLINE" then
say "soitan"
send command "CALL " & login script name "MyScript"
copy (run script "tell application \"Finder\" to desktop's window's bounds") to bounds of window 1
else
say "[a] onnnnissstu!"
end if
end tell
end SkypeCall

on GetPart(s, p, d)
set theList to every text item of s
return (item p of theList)
end GetPart
I used this macoshints article as an example.

Friday, January 23, 2009

New s60 freeware: deli.s

In the series of small s60 utilities I have made for myself: deli.s is an application which helps the user to post links to http://del.icio.us from the handset.

I was tired of copy-pasting URLs and using numerous dialogs. With deli.s you can send a link to delicious just by selecting the right bookmark and adding the tags and extra description you want.

As a piece of software made just for myself, it is a bit rough on the edges with known and unknown bugs and limitations. Decided to share this anyway as I bet I am not the only one that needed something like this.

Download and check it out from the following page:

http://huopio.fi/simo/software/delis/

Any comments and suggestions are appreciated. I am not promising quick turnaround on new features - as I am coding this only when commuting on a bus ;).

Sunday, September 21, 2008

TTP v0.93

Already a while ago I updated the To The Point (TTP) application to version 0.93. The major new features are:

  • Now TTP scales images to the size of the screen when loaded!
  • Now there are up to five stored sets supported.
  • Now you can swap the locations (under which key they are bound) of two images in the set.

There are still many thinks to polish. Now after the basic scaling of the images the app is definitely worth checking.

For app description and download links, check http://huopio.fi/simo/ttp/

Thursday, August 07, 2008

To The Point (TTP)

To The Point (TTP) v0.90 screenshot

Here's a public launch of a tiny background project of mine. To The Point (short: TTP) is a small native S60 3rd edition application specialized for quick viewing of screenshot-size images on your mobile screen with minimum clicks.

What you can do with TTP? I use it like this:

  • I have either imported full-screen size images (320x240 on my E61i) from my photo collection or taken full-screen screenshots of them e.g. with http://www.antonypranata.com/screenshot.
  • I have loaded them into TTP under separate number keys for quick viewing
  • I have put TTP as one of my active standby applications
  • Now I can access full screen images with maximum of two clicks straight from the idle screen!

    • When TTP is run, the image assigned to the number "5"-key is loaded immediately
    • If I now press e.g. the "3"-key, or the left arrow, image assigned under that key is now displayed. The same goes with all the number keys.
    • "*" and "#" keys cycle through the images

The use case above was my reason to write this application. Basically it does that but not much else. It is not suitable for generic gallery application as it does not e.g. scale your images, and you are not able to browse the images that are on the phone.

Naturally the application has bugs and known issues. If you find a bug that can be easily reproduced please let me know. There are no guarantees of timely fix, though. ;)

For more information and the download links, please check http://huopio.fi/simo/ttp/

Saturday, June 14, 2008

How many channels is enough? (part two)

Continuing from my rant on the multitude of channels.

Ok, maybe the everyday reality of the communications channels is not that bad in reality thanks to the tool consolidation. Both in mobile setup and from a home/work workstation I can handle all of the necessary channels with just a few tools. The question is, does it really make it any easier?

On my primary mobile (Nokia E61i at the moment) I use Fring to handle MSN, GTalk and Skype. Via XMPP it can also deliver the updates from Jaiku (or twitter, if needed) back and forth. The only missing piece is IRC for which I need to launch a separate application (putty or Mirggi). For my email on the go I use gmail, through mobile website or with the java app. The email funnels all the reminders from the social networking sites I need really to react to.

On the workstations browser is the key. At home I use OSX applications like Adium or Skype for best user experience but at work or from on the road Meebo has it all. Again, for IRC I need to ssh to my unix account. Email, Jaiku and the social sites are all handled through the browser.

Funneling everything through the browser also helps to the challenge of using one computer at the home for all the family members. Using many user accounts at the iMac does not really work for us, things need to be handled in "one session". There would be a room for development of an "identity swithch" which would authorize all the native clients with correct credentials - I wonder if anybody has been experimenting with this using e.g. OSX keyring?

With me using everything through the browser and my wife using the native clients and her own email account with separate login we can manage somehow.

With all the social sites, blogging systems, and IM networks having their more or less public and open API:s there is still room for more consolidation. Supercharging applications like Adium or Mobile goodies like Fring to handle all the listed channels could be possible, but will the projects like that take the controversial task to get "all in". Before that, only way for the end user is to be selective with the networks and bear with the fact of not reaching everybody you want - or maximize the reach and bear with the time consumption and brain bandwith overhead ;)

Thursday, June 12, 2008

Perfect pair of keylock applications for Nokia E61(i)

In order to fulfill my needs for key lock with my Nokia E61i, I use two little freeware applications:

First one is AutoLock ( http://s60addons.com/autolock/ ) , an automatic keylock utility which triggers the key lock after given time of inactivity. Pretty standard stuff and there must be dozens of other little utilities doing the same.

The second application is mLock ( http://cooga.ch/ ), an application originally meant for the N80 slider for quick manual activation of key lock. I use it with my "own key": I can quickly lock the keys with that regardless of the application that is in front. With that I can e.g. quickly fetch a pretty picture on screen, lock the keys and give the phone to my 19 mo daughter ;-)

Has anybody found a single freeware utility combining the both of these functionalities?

Monday, June 02, 2008

How many channels is enough - or is there a limit?

When looking at all the Internet communication services and sites that we are using - the picture is very fragmented. Lately I have been questioning myself why I really use this and this service - and is it really serving the purpose for me?

When you have certain unified peer group (e.g. school class, or group of university mates) the choice is easy - you use the service(s) your friends are using.

That was also my situation in the university, we all did hang around on IRC channels a lot. Most of us did not even have cell phones yet. The IRC channel and emails did most of the things that the SMS:es, microblogs and facebooks do today: Casual chats, keeping friends up-to-date, agreeing on place to eat, drink or whatever. OK, it was very nerdy at the time and even then was not for everybody.

Now as many many years have gone and people and life has gone its own way for everybody. From my perspective there are numerous small peer groups which still randomly overlap. Interaction with the friends is more one-to-one, or with the families. Obviously the need for keeping everybody tightly informed and involved is not there anymore.

To approach the answers of why? and does it work? Lets list the used channels first:

To start with, there's email - the Killer Application of the Internet. My personal emailings are infrequent but they usually weigh a lot. Couple of old friendships have stayed alive the couple of last years just by couple e-mails a year.

For IM at home, we use Skype and MSN Messenger. Skype handles also the occasional needs for the voice and video chats to the grandparents and friends abroad. While using the gmail, the GTalk/XMPP is also there. Occasionally I also log to IRC and drop couple lines on good old channels. The IM use is usually short dialogs and sharing links. It is not uncommon to chat with some even close friends much more often than call or SMS. So, counting these ways together there's four separate channels in addition to email.

We keep a family blog, mostly filled with pictures and stories of our daughter. In addition to that I occasional post non-family-related things here. Adding two more "channels" to the previous.

Come the social networking sites. Only LinkedIn and Facebook have really picked some traction with me. I've used the former networking with professional and latter with non-professional contacts (some of them are in both). I have not invited any of my friends or acquaintances to these services, only added or responded to people who are already there - the result is that only less than half the people I know are listed in these services.. In any case, two additional channels here.

Come the microblogging. My first touch to it was Jaiku, to which my colleague invited me say two years ago. I did not find almost any of my friends there at the time and that kind of sizzled. Now couple months back I picked up twitter, first to follow some tech discussions there, then I started to occasionally post my life notes there coupled with the Facebook status message. I had also the Jaiku account active and noted that on Jaiku there are more people connected which I actually know in person. Couple days back I decided to use Jaiku as my "primary microblog channel" and leave twitter cough about its capacity problems in the background. So, there are two additional channels added to the list here.

Counting these with my fingers and one toe I get 11 (eleven!) different internet communication services which are more or less in use for me. I am sure I have forgotten some obvious services - but even this number seems to be a bit too much..

So which subset of these I really need - what could be ideal for me? Only thing that is sure that there's some room for convergence.

To avoid too long single posts I continue this monolog in an another one later on.

Friday, May 09, 2008

Google Translate handles now Finnish!

Hooray! The Google Translate handles now Finnish language. Naturally the results are quite funny as the language is not the most easy for machine translation.

Check out for example Finnish translation of this blog you're reading right now.

Saturday, December 29, 2007

Problems with blogger and nebula

I had some persistent problems with updating the blog via sftp to the nebula.fi servers. The root cause in the end was that after a server upgrade Nebula started to filter incoming ssh connections according to a whitelist. Blogger.com (or whatever address they're internally using) was not on the list and the symptoms to my directions were just timeouts after another.

Co-incidentally I've had some gmail problems lately so I already had started to think alternatives to Google services. The problems with gmail are not over yet and there's no apparent reason. Let's see how the year 2008 will begin..

Thursday, December 20, 2007

emTube: youtube videos on mobile

emTube, is an application for browsing and viewing YouTube videos on a S60 mobile. I tried the application quickly on N95 8GB and successfully viewed couple videos. (Ron Paul supporters seem to be very active doing ratings over there, thank god you can also do free-text search for videos.. )

MobiTubia, a winner of Nokia OpenC challenge seems to be a very similar application but with a quick search I wasn't able to find a installation package for comparison.

Tuesday, December 18, 2007

Panoman, upgraded version of s60 panorama capture app

mobile panorama from Ruoholahti

Very not-pc name for us Finns, but a nice mobile application: panoman. Great upgrade to previous version: now the panoramas are captured by the native resolution of the mobile camera, not the puny video resolution..

Panoman takes the full frame photos automatically as you pan the camera sideways. The UI is very clear and intuitive:

panoman screenshot

After taking the last photo you want, you just press stop or ok and the application stitches the panorama together for previewing.

The included sample is not very good, nor is the camera of the Nokia E61i by itself. In good light conditions and with a steady hand this will deliver good results.



Sadly no demo version available at the moment. I bought the app for testing as I was eager to see what's new. I used the previous version quite a lot and I bet this one will be worth the money for me too.

Friday, November 30, 2007

Use rsync through ssh on your S60 device

I have been waiting this to appear: rsync and ssh forwarding working on S60 phone. Surely it will be a bit rough to use at this early stages but being open source I bet it will gain some volunteers to make it better. Let's see if this will eventually replace the multi-step process to get media files to my phone wirelessly.

Thursday, November 29, 2007

Google Maps for Mobile now gets the location even without GPS


Guys at Google continuously crank new features to their Google Maps Mobile -application. Now they're added acquiring the phone's location without GPS.

The blog posting does not say much how exactly the location information is resolved. Is it calculated on the google's servers, using the CellID and possibly other data sent by the GMM application? Or does the application figure it out by itself.

I bet the first option is the correct answer. On that case I wonder has Google harvested the cellid location data already for some time with the existing gmm applications out there, and therefore figured out the locations of most of the cell towers? The video on the blog post says that "the service gets better the more you use it", it might refer to data collection of some sort.

Interesting development nevertheless.

If you are using gmm a lot, make sure your data plan is either unlimited or the flat rate quota is put high enough - the maps eat the megabytes pretty fast.

Update: One analysis is saying that gmm is really using the CellID data sent by the existing users with gps and data sharing enabled. The location data is then only valid if someone has used gmm before on that area with GPS, or if Google has preloaded some information on its systems. There has been many projects of getting CellID data around the world, so I would assume that the results of those initiatives have been feed also in to the system. In most of the projects the databases have been public (?)

Saturday, October 13, 2007

Google Maps Mobile now to Symbian and with GPS

Google Maps Mobile got its first public native Symbian application yesterday. I do not yet have decided whether I do like the new one better over the old J2ME one. The native version is sure faster and more slick, but it does not (seem) to have all the functionality in. GPS support is of course very long awaited and useful addition.

What I would like to see is the integration of the locations and maps stored in the online service (My Maps) with the mobile version. This would allow storing the important locations conveniently with the browser and just have access to them when needed. Also placemarking on the go, with some kind of annotation would be very useful. I have no doubts that these features are on the Googles list too..

Note: If one's wondering why not just use Nokia Maps - the reason is that these tools are for different use cases. I use Google Maps for quick check for the neibourghood or the street names. The satellite imagery feature of the GMM is naturally also a good for showing off what can be done with the mobiles and Internet. Nokia Maps is then for a bit more serious stuff: It has more solid searching funciton and POI database. The navigation feature is also very useful to have. Nokia Maps starts up much slower so it is not really for quick checks.

Sunday, September 30, 2007

One way to get your TV shows to your S60 mobile for viewing

I commute daily via either bus or train & underground. The one-way trip is 40+ minutes door to door. Sometimes I read or listen to podcasts or audio books. Once in a while I watch a TV show from my mobile or Nokia 770 tablet.

I have moved just lately to following tool chain to get the shows to my mobile is eyetv, iTunes, MyTunesRSS and S60 podcasting. It is not by all means perfect but it is definitely usable.

1) Recording the TV shows
On my iMac I am using Miglia TVMini for watching and recording . I bought the stick when the Elgato eyetv (http://www.elgato.com/) was still bundled with it. I just love the eyetv software. I haven't seen a match of the similar software in the Windows world.

So, I record the TV-shows as usual from the terrestial DVB. We use the iMac as primary TV at home as the pvr functionality is just so convenient. This might change when we buy a proper set-top-box to the living room - this move would free the mac for use as a computer ;)

2) Converting the files suitable to format suitable for the S60 phone

In this easy-as-possible route, I use eyetvs built in "convert to iPod" functionality. To make it happen automatically I tick the "convert to iPod" checkbox for the scheduled shows I want to view from the mobile. I found that though the "Fastest MP4" option produces files which are viewable on the phone. The E61i cannot handle the H.264 which would produce much smaller files. There is an interactive way to export files from eyetv with more suitable parameters but you cannot make that automatic.

eyetv_export_choises.png
Default (iPod) export options of eyetv

I have not yet checked whether the default option that uses H.264 codec produces files that are viewable in N-series models. The E61i does not have the codec nor the horsepower to do view them.

3) Making the files available

In this stage I used to transfer the files via USB cable which is reasonably fast but requires manual steps and time with the computer: Not usually doable in a busy morning with a little girl living in the house. I wanted to have the phone update the shows wirelessly in automatic fashion during the night.

As I use the S60 podcasting application daily I thought to give it a try also with the videos. E61i has WLAN and is therefore able to contact our home network. The missing link was a server software to produce RSS feeds with the video files as enclosures.

MyTunesRSS
MyTunesRSS generated page

After some googling MyTunesRSS (http://www.codewave.de/products/mytunesrss/) seemed suitable for the job. The ease of installation was also reason to try it first. The software is intended for interactive browsing and streaming for your iTunes library, especially PSP in mind. PSP browser seems to support RSS nicely to make it work. When trying out the software and browsing the generated pages, I found out that the generated RSS link is static per iTunes folder, and can be therefore reused. As the generated pages require login and password, having the RSS feed to change its address would render the software unusable for me. The link is very long so copy&pasting and e-mailing was only practical way to get it to the phone.

4) Getting the files to the phone

The S60 podcasting application (http://www.nokia.com/podcasting) was able to use the RSS feed without problems. Setting the app to use the home WLAN and updating the feeds resulted the shows and their sizes to show on the screen exactly the same way as audio podcasts.

TV programs from iTunes
S60 podcasting view to the served videos

Downloading the shows is slow business. I haven't investigated this further whether it is due to the S60 application, MyTunesRSS, WLAN encryption or the WLAN throughput in the phone in general. The download speeds are around 70-80kb/s, which adds up to really long download times - over an hour per 500M episode.

Despite long download times I prefer this approach over the USB cable. If I just remember initiate the downlaods in the evening the mobile is "topped up" in the morning.

5) Things to improve

- Make the files smaller than the eyetv default (e.g. using applescript and external utilities)
- Better alternative to MyTunesRSS (easier RSS feed link(s))
- Enhance the transfer speed
- The S60 podcasting application has some bugs & annoyances.
- Get a bit more suitable phone, e.g. N95 8GB, which is faster and could handle also the H.264.

Update 20071005: Tried the system with N95. The WLAN download rates were considerably better being between 300-600kB/s. With those speeds rather quick covert+download cycles could be possible.

Sunday, September 16, 2007

Testing new location

First post to new location at http://huopio.fi/simo/blog

With the proper web hosting setup in place I decided to get the old blog back from the dead. The old one was hosted from a home location from a ancient PC through a normal DSL line - not very durable nor scalable.. ;) For the family news, please head to the http://finnlife.blogspot.com - a place filled with baby news and pics!

I will continue here with quite slow rate of posting tech-related stuff. Some gadget- and mobile stories have been waiting in the back of my brains for a channel to get out..