maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Design (https://talk.maemo.org/forumdisplay.php?f=46)
-   -   Custom Icon e.g. Starting Favorite Webradio (https://talk.maemo.org/showthread.php?t=39858)

Reflektorfalke 2010-01-09 14:35

Custom Icon e.g. Starting Favorite Webradio
 
Hi,

inspired by this thread: http://talk.maemo.org/showthread.php?t=35858 I came up with the idea of creating a desktop shortcut for starting my favorite internet radio:

Step 1: Create a file named e.g. "webradio.desktop" in the /usr/share/applications/hildon/ directory
(will need root access to do that).

Step 2: Enter the text below in the new file and replace the text within < ... > (custom name + link to stream) with whatever you want...

Step 3: Afterwards you have a new entry in your application list with your custom name and may create a shortcut on your desktop.
When you click on your new icon / shortcut a xterm window will appear for a second before media player starts playing your webradio...

PHP Code:

[Desktop Entry
Encoding=UTF-
Version
=0.1 
Type
=Application 
Terminal
=true 
Name
=<custom name
Exec=/usr/bin/osso-xterm '/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"<link to your webradio / stream>"' 
Icon
X-HildonDesk-ShowInToolbar=true 
X
-Osso-Type=application/x-executable 

BTW, you can also exchange the blue standard icon - check this post to see what you need to do!
http://talk.maemo.org/showpost.php?p...0&postcount=26

Thanx to archebyte for the great work!!!

Please share with whatever other functions you create your own custom icons / shortcuts...

orientel 2010-01-17 03:18

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by Reflektorfalke (Post 461072)
When you click on your new icon / shortcut a xterm window will appear for a second before media player starts playing your webradio...

Thanks, cool idea! I also found a way to avoid seing xterm windows:
  • Create a script file (e.g. "play.sh") like the following including the xterm command to be executed
    Code:

    #!/bin/bash
    /usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"<link to your webradio / stream>"
    exit 0

  • Change the Exec including sh command followed by the script file created, e.g.:
    Code:

    ...
    Exec=sh /home/user/play.sh
    Terminal=false
    ...


Reflektorfalke 2010-01-17 17:47

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by orientel (Post 477427)
Thanks, cool idea! I also found a way to avoid seing xterm windows

Aah sweet, nice improvement!!!

Was experimenting with realizing it via script...
Somehow it didnīt work.
Whatever now it does - Thanks a lot!!!

cardiff-blues 2010-02-03 21:12

Re: Custom Icon e.g. Starting Favorite Webradio
 
How do you create the file in the first instance? Do you do this on the N900 first?

cardiff-blues 2010-02-03 21:53

Re: Custom Icon e.g. Starting Favorite Webradio
 
Have followed the instructions but don't see the shortcut. DO you have to keep the <> or remove them?

les_garten 2010-02-03 22:47

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by orientel (Post 477427)
Thanks, cool idea! I also found a way to avoid seing xterm windows:
  • Create a script file (e.g. "play.sh") like the following including the xterm command to be executed
    Code:

    #!/bin/bash
    /usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"<link to your webradio / stream>"
    exit 0

  • Change the Exec including sh command followed by the script file created, e.g.:
    Code:

    ...
    Exec=sh /home/user/play.sh
    Terminal=false
    ...


I rebooted and still don't see my entry showing up. I've seen this before with other applications and then they mysteriously appear some hours later. Any idea how to refresh the applications Icon menu?

Reflektorfalke 2010-02-03 22:54

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 509319)
How do you create the file in the first instance? Do you do this on the N900 first?

Just create a copy of another .desktop-file by typing

cp example.desktop examplecopy.desktop

in Xterm.

Reflektorfalke 2010-02-03 22:55

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 509381)
Have followed the instructions but don't see the shortcut. DO you have to keep the <> or remove them?

You have to remove <>, they just highlight the parts you want to edit

Reflektorfalke 2010-02-03 23:02

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by les_garten (Post 509479)
I rebooted and still don't see my entry showing up. I've seen this before with other applications and then they mysteriously appear some hours later. Any idea how to refresh the applications Icon menu?

Well I remember reading about a command that refreshs the icon cache, but reboot will do the same!
If your icon does not appear recheck if you followed the steps as described or have typos somewhere!?
I think once it didnīt work for me when I created the .desktop file from the scratch on my Win PC, but it worked when I edited a copy of an existing .desktop file...

cardiff-blues 2010-02-03 23:13

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by Reflektorfalke (Post 509491)
Just create a copy of another .desktop-file by typing

cp example.desktop examplecopy.desktop

in Xterm.

OK it wouldn't show up in app manager so I have followed your tip here. Now how do I put the content into my webradio.desktop file that I have just created?

Reflektorfalke 2010-02-03 23:16

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 509535)
OK it wouldn't show up in app manager so I have followed your tip here. Now how do I put the content into my webradio.desktop file that I have just created?

Use a editor of your choice to edit the file...e.g. vi or leafpad
I suggest leafpad as its way easier!

For editing with leafpad enter in Xterm:

leafpad webradio.desktop

cardiff-blues 2010-02-03 23:36

Re: Custom Icon e.g. Starting Favorite Webradio
 
does this look ok?

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=KVMV
Exec=/usr/bin/osso-xterm '/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer
/com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"
http://kvmv.streamon.fm/player/player.php?username=KVMV&stream=64k&type=1"'
Icon=X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Reflektorfalke 2010-02-03 23:46

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 509566)
does this look ok?

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=KVMV
Exec=/usr/bin/osso-xterm '/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer
/com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://kvmv.streamon.fm/player/player.php?username=KVMV&stream=64k&type=1"'
Icon=X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable


Looks like there is a blank before http.. ("_http).
Remove this blank and make sure that the Exec command is in one line without break.
Then it should work!


EDIT: Sorry, just noted that your link goes to a webradio player...
But you need to use a link to a media stream...

EDIT2: Check the source of the link you used. There you find this link: http://kvmv.streamon.fm/play/KVMV-64k-168-1.html
And there you find several media streaming links that should work!

les_garten 2010-02-04 03:07

Re: Custom Icon e.g. Starting Favorite Webradio
 
1 Attachment(s)
OK, got this working. Very Kewl!

My Favorite shoutcast server is the one streaming FOX Business channel off Directv in my house!

Here's the Icon I used, looks pretty kewl to me at least.

The Icon is 48x48 and looks great.

Grant 2010-02-04 04:20

Re: Custom Icon e.g. Starting Favorite Webradio
 
Thanks for this guys, it was just what I was looking for. Any way to make it so that media player opens in the background, or make it so you end up back at the desktop? This way, if you setup multiple shortcuts to different stations, you could just quickly switch between all of them right from the desktop.

cardiff-blues 2010-02-04 09:25

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by Reflektorfalke (Post 509580)
EDIT2: Check the source of the link you used. There you find this link: http://kvmv.streamon.fm/play/KVMV-64k-168-1.html
And there you find several media streaming links that should work!

I can now see the icon but when I click on it xterm pops up for a brief moment then disappears but nothing happens. Is this likely to be a problem with the stream url.

Can you try this url in your file to see if it will work
http://kvmv.streamon.fm/stream/KVMV-64k.mp3

les_garten 2010-02-04 17:53

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510072)
I can now see the icon but when I click on it xterm pops up for a brief moment then disappears but nothing happens. Is this likely to be a problem with the stream url.

Can you try this url in your file to see if it will work
http://kvmv.streamon.fm/stream/KVMV-64k.mp3

You need to pay attention to the post that suggested making a simple shell script as the exec line. I did that and there is no xterm POP up. Just opens the stream in the media player.

cardiff-blues 2010-02-04 17:59

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by les_garten (Post 510734)
You need to pay attention to the post that suggested making a simple shell script as the exec line. I did that and there is no xterm POP up. Just opens the stream in the media player.

>>>
When you click on your new icon / shortcut a xterm window will appear for a second before media player starts playing your webradio...
<<<

I don't get it to play anyway so shouldn't it play regardless of whether I create that script or not?

les_garten 2010-02-04 18:37

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510742)
>>>
When you click on your new icon / shortcut a xterm window will appear for a second before media player starts playing your webradio...
<<<

I don't get it to play anyway so shouldn't it play regardless of whether I create that script or not?

Well, you were mentioning you didn't want the xterm launch. You're going to get that the way you are doing it.

Post your code, if you want help on it.

Here's mine:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=TurboNET
Comment=TurboNET Radio
Exec=sh /home/user/turbonet_radio.sh
Icon=shoutcast
Terminal=false
Name=TurboNET
Type=Application
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

See how simple it is.

#!/bin/bash
/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://xxxxxx.com:8000/listen.pls"
exit 0

Reflektorfalke 2010-02-04 19:46

Re: Custom Icon e.g. Starting Favorite Webradio
 
1 Attachment(s)
Quote:

Originally Posted by cardiff-blues (Post 510072)
I can now see the icon but when I click on it xterm pops up for a brief moment then disappears but nothing happens. Is this likely to be a problem with the stream url.

Can you try this url in your file to see if it will work
http://kvmv.streamon.fm/stream/KVMV-64k.mp3

Hi Cardiff-blues,

tested your link and it works!:D

Attached you will find the .desktop file as well as the shell script.

Put
kvmv.desktop into /usr/share/applications/hildon
and
KVMV.sh into /home/user/MyDocs/.documents/Scripts

cardiff-blues 2010-02-04 20:16

Re: Custom Icon e.g. Starting Favorite Webradio
 
Thanks with your efforts to help me out here :)

I copied the files over to the N900 and was able to click on the icon. A black window then appears (not the xterm window) and I see the animated timer at the top status bar area. It looks like it is going to do something and stays like this for about 5 seconds and then just closes. :(

les_garten 2010-02-04 20:22

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510938)
Thanks with your efforts to help me out here :)

I copied the files over to the N900 and was able to click on the icon. A black window then appears (not the xterm window) and I see the animated timer at the top status bar area. It looks like it is going to do something and stays like this for about 5 seconds and then just closes. :(

will that Radio site play in the media player?

cardiff-blues 2010-02-04 20:25

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by les_garten (Post 510958)
will that Radio site play in the media player?

Yep. It's one of my saved stations.

Reflektorfalke 2010-02-04 20:34

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510938)
Thanks with your efforts to help me out here :)

I copied the files over to the N900 and was able to click on the icon. A black window then appears (not the xterm window) and I see the animated timer at the top status bar area. It looks like it is going to do something and stays like this for about 5 seconds and then just closes. :(

What happens if you enter this line
(The command line from the shell script)

/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer /com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://kvmv.streamon.fm/stream/KVMV-64k.mp3"

into XTerm?

cardiff-blues 2010-02-04 20:41

Re: Custom Icon e.g. Starting Favorite Webradio
 
~ $ /usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer/com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://kvmv.streamon.fm/stream/KVMV-64k.mp3"
process 1678: arguments to dbus_message_new_method_call() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1078.
This is normally a bug in some application using the D-Bus library.
process 1678: arguments to dbus_message_set_auto_start() were incorrect, assertion "message != NULL" failed in file dbus-message.c line 2492.
This is normally a bug in some application using the D-Bus library.
Couldn't allocate D-Bus message

Reflektorfalke 2010-02-04 20:52

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510979)
~ $ /usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer/com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://kvmv.streamon.fm/stream/KVMV-64k.mp3"
process 1678: arguments to dbus_message_new_method_call() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1078.
This is normally a bug in some application using the D-Bus library.
process 1678: arguments to dbus_message_set_auto_start() were incorrect, assertion "message != NULL" failed in file dbus-message.c line 2492.
This is normally a bug in some application using the D-Bus library.
Couldn't allocate D-Bus message

/usr/bin/dbus-send --print-reply --dest=com.nokia.mediaplayer_/com/nokia/mediaplayer com.nokia.mediaplayer.mime_open string:"http://kvmv.streamon.fm/stream/KVMV-64k.mp3"

You missed a <blank> after --dest=com.nokia.mediaplayer

Copy & Paste and remove the red underscore _ and your good...

cardiff-blues 2010-02-04 20:56

Re: Custom Icon e.g. Starting Favorite Webradio
 
:) Ok that works in xterm!

Reflektorfalke 2010-02-04 20:59

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 510999)
:) Ok that works in xterm!

Hehe Great!!! :D
Now copy & paste this line into your shell script and your done ;-)

cardiff-blues 2010-02-04 21:31

Re: Custom Icon e.g. Starting Favorite Webradio
 
Arghhhh!

Nearly there. It launches and then connects to media player, briefly says, "opening stream" and then comes up with an error message, "no connection to server".

Reflektorfalke 2010-02-04 21:33

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511042)
Arghhhh!

Nearly there. It launches and then connects to media player, briefly says, "opening stream" and then comes up with an error message, "no connection to server".

Hmm, think that can only mean you are have either no internet connection or there is another typo within the stream link...

cardiff-blues 2010-02-04 21:36

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by Reflektorfalke (Post 511043)
Hmm, think that can only mean you are have either no internet connection or there is another typo within the stream link...

When I cat the KVMV.sh and paste it straight into xterm it opens up media player and plays the stream. I'm confused???

Reflektorfalke 2010-02-04 21:45

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511044)
When I cat the KVMV.sh and paste it straight into xterm it opens up media player and plays the stream. I'm confused???

Please send me your KMVM.sh and I will have a look

les_garten 2010-02-04 21:55

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511044)
When I cat the KVMV.sh and paste it straight into xterm it opens up media player and plays the stream. I'm confused???

I had all kinds of problems with cutting and pasting and nothing worked right. I entered everything manually and it worked perfectly. I used nano, but Leafpad would work as well, or vi/vim for the wussies who have problems with ed :rolleyes:

There were obviously some type of invisible meta characters that were driving me nutz with it not working.

cardiff-blues 2010-02-04 21:55

Re: Custom Icon e.g. Starting Favorite Webradio
 
1 Attachment(s)
Here it is. And thanks for your help

cardiff-blues 2010-02-04 22:09

Re: Custom Icon e.g. Starting Favorite Webradio
 
Yipee!

It's working :)

Many thanks, Reflektorfalke and les_garten. Thanks for persisting to help and get this sorted for me.

In the end I just opened leafpad on the N900 and typed in the all the info into a new KVMV.sh file and it worked.

It seems like les_garten's final tip was what was needed but thank you bigtime to Reflektorfalke for all your help these last few days.

Reflektorfalke 2010-02-04 22:13

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511088)
Yipee!

It's working :)

Many thanks, Reflektorfalke and les_garten. Thanks for persisting to help and get this sorted for me.

In the end I just opened leafpad on the N900 and typed in the all the info into a new KVMV.sh file and it worked.

It seems like les_garten's final tip was what was needed but thank you bigtime to Reflektorfalke for all your help these last few days.

Sweeet, glad I was able to help figure this out !!!
See, its quite simple to setup :p

Now enjoy listening to your beats with your new webradio icon !!!:D:D:D

BTW: Donīt forget to add a nice icon ;-)

cardiff-blues 2010-02-04 22:18

Re: Custom Icon e.g. Starting Favorite Webradio
 
I am a windows user but since I have got the N900 I just installed kubuntu and have learned a bit just by getting this shortcut to work.

I didn't even know how to create, copy and delete files with linux until you guys started helping me here. :)

Thanks.

Hopefully if I just do the editing in leafpad on the N900 then I shouldn't get any problems adding other shortcuts.

Thanks once again guys!

les_garten 2010-02-04 22:19

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511088)
Yipee!

It's working :)

Many thanks, Reflektorfalke and les_garten. Thanks for persisting to help and get this sorted for me.

In the end I just opened leafpad on the N900 and typed in the all the info into a new KVMV.sh file and it worked.

It seems like les_garten's final tip was what was needed but thank you bigtime to Reflektorfalke for all your help these last few days.

I was working on this the other day, and pulled out my Hari Kari blade! Somebody else mentioned it earlier in the thread and that's what it was. Glad it's working for ya!

cardiff-blues 2010-02-04 22:21

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by les_garten (Post 509780)
OK, got this working. Very Kewl!

My Favorite shoutcast server is the one streaming FOX Business channel off Directv in my house!

Here's the Icon I used, looks pretty kewl to me at least.

The Icon is 48x48 and looks great.

Les, is there a thread explaining how to use a different icon?

les_garten 2010-02-04 22:36

Re: Custom Icon e.g. Starting Favorite Webradio
 
Quote:

Originally Posted by cardiff-blues (Post 511104)
Les, is there a thread explaining how to use a different icon?

The mod thread has a lot.

Short version with my icon

cp shoutcast.png /usr/share/icons/hicolor/48x48/hildon


cp shoutcast.png /usr/share/icons/hicolor/scalable/hildon

there may be two scalable dirs because one of the developers didn't know how to spell scalable.

then in your desktop file place just the name of the icon without the .png extension.

Look at the other desktop files and you'll figure it out.


All times are GMT. The time now is 21:28.

vBulletin® Version 3.8.8