User talk:Reldruh

Jump to: navigation, search

No problem at all. In fact I went on to the #kde-devel channel to get information and opinions on changing that. It was a group effort. :) --Steveire 23:56, 21 February 2008 (CET)

Some notes on scripting with amarok 2.0 beta1 I'm slowly working my way through the amarok 2.0 scripting framework and thought I'd write some notes down for anybody who wanted to do the same. There's a hell of a lot I don't know but the things that took a while to figure out are:

1. Scripts consist of a script.spec file and a main.js file

2. Not only does the script itself have to be executable, the files inside the script do to. So just doing chmod +x script.amarokscript.tar.gz isn't enough. Before you tar it up you have to make sure all the files are executable. I think this is fixed in trunk but until packages get updated, everything needs to be executable.

3. Here's the example script.spec file I've been using: [Desktop Entry] Icon=get-hot-new-stuff-amarok Type=script ServiceTypes=KPluginInfo

Name=Crazy Streams Comment=A script that sets up a service with a few crazy internet radio stations

X-KDE-PluginInfo-Author=Nikolaj Hald Nielsen X-KDE-PluginInfo-Email=nhnFreespirit@gmail.com X-KDE-PluginInfo-Name=Crazy Streams X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-Category=Scriptable Service X-KDE-PluginInfo-Depends=Amarok2.0 X-KDE-PluginInfo-License=LGPL X-KDE-PluginInfo-EnabledByDefault=false

It's a copy of the radio_station_service but I changed all instances of 'cool' to 'crazy' so I could differentiate between them. In the code, name, version and category are the important parts.

4. Category is very important, I think (I'm not sure). There are lots of files in svn called 'AmarokOSDScript.cpp' or 'AmarokPlaylistScript.cpp' or 'AmarokScriptableServiceScript.cpp'. My guess is that for each Amarok*Script.cpp I can put whatever's in that asterisk as the category in the script.spec file and then use the functions in the .cpp file, but when I tried that with AmarokStatusbarScript.cpp it didn't work. I changed the category to Statusbar and then tried to use the setMainText() function. Maybe I didn't initialize it right but I'm not sure exactly how that works.

5. Uninstalling scripts doesn't work very often but all you have to do is delete it from ~/.kde4/share/apps/amarok/scripts

6. If anybody knows where the log it tells you to look at when there are errors is, please let me know.

7. Amarok.alert("sometext"); is a wonderful thing, especially if you're running packages and don't get much in the way of debug output.

I'll try and add more as I go along

There are no threads on this page yet.

This page was last modified on 29 August 2008, at 10:44. This page has been accessed 551 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal