N900: Start mediaplayer from desktop with specific file

Every morning I record the Radio 1 morningshow as an ogg-file, and transfer it to my mobile to listen to it in the car on the way to work. This way I am not depending on coverage the whole way, and I can skip the commercials. With the builtin FM-sender of the N900, this is a perfect solution…

So, I want an icon on my desktop to start the mediaplayer and start playing the radio1-file. This is how you do it:

1)
Make a file to start the mediaplayer with the radio1-file. Mine is /opt/script/radio1.sh:
#!/bin/sh
dbus-send –print-reply –dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:”file:////home/user/MyDocs/.sounds/radio1_bergen.ogg”

2) Make a file for your desktop-button. It should be located in /usr/share/applications/hildon/ and be called something that ends in .desktop, mine is radio1.desktop:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=true
Name=radio1
Exec=/usr/bin/osso-xterm /opt/script/radio1.sh
Icon=
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
X-Icon-Path=/usr/share/icons

3) Link it to your desktop as any other program.

4) If you want a custom icon you can either type the name of an existing icon in the file above (without path and file-ending, the actual icons are in /usr/share/icons/hicolor/*), or make your own. To make your own, make png-files with the following sizes (don’t really know which are being used, but the following should be enough):
26×26
32×32
40×40
48×48
64×64
one a bit larger
All of them should be png-files, and put into the respective folders under /usr/share/icons/hicolor/. The last one should go in the scalable-folder, and all of them should be called the same, f.ex. radio1.png. The full path to f.ex. the 64×64-version would be:
/usr/share/icons/hicolor/64×64/apps/radio1.png
Then in the file above, change the icon-lines to be
Icon=radio1
X-Window-Icon=radio1
After you input the new icon, you should turn the N900 off and on again to get the device to load the new icon. You could also try the following command, but it didn’t work for me:
gtk-update-icon-cache -f /usr/share/icons/hicolor/

Enjoy your new one-click-play-my-file-desktop-icon 🙂

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: