Hey, I have a lot things to demo since we were moving very fast In the past two weeks!
I’ve added a lot of QtScript API functions, including GUI, Playlist, Collection, Music Engine and Scriptable Service.
Here are some small pieces from the whole cake:
one of the engine signals:
function TrackChanged()
{
print( “Dude! Do something! The track changed!” );
}
Engine.trackChanged.connect( TrackChanged );
Track Meta Info:
var TrackInfo = Amarok.Engine.TrackInfo;
StatusBar.shortMessage( “You are listening to album: ” + TrackInfo.Album );
Collection and Playlist Access:
var totalTrack = Amarok.Collection.totalTracks;
Amarok.Playlist.clearPlaylist;
I’ve almost finished the DBus interface by supporting MPRIS standard ( http://wiki.xmms2.xmms.se/wiki/MPRIS ). Now the script manager could handle script errors, write them to log files and correctly start/stop scripts. A simple demo script and a scriptable service QtScript called “Cool Stream” was released with Amarok Alpha 1.

Everyone loves eye candy, the API implementation and bug fixing are mostly behind the scene. So I decided to make some candy for non-latin character users :).
I grabbed the charset detector code from Mozilla, merged them into Amarok. Now, the wolf recognizes non-UTF8 tags:

The summer of code project seems always stuck on some building system stuff. The charset detector didn’t compatible with cmake 2.4.8, and the Qt bindings generator was needed to be ported from qmake to cmake. ( thanks “compiling king” Ian for helping me
)
The SoC project will be ended in one month. And we still have some work to do. Ladies and Gentlemen, let’s wait for the finalized script API, and the brand new script manager!



AH! Some big progresses and decisions have been made this week. So let’s take a quick glance at the new Amarok Scripting interface. Here we go!
var Engine;
Engine = Amarok.Engine;
Engine.Stop( true );
Engine.Play();
Engine.Seek ( 60*1000 );
You can run the QtScript code using the script manager. Is the code simple enough for you? Using the code above, you can control the music engine of Amarok. For the current track info, just use AttriVal = Amarok.Engine.TrackInfo.someAttr.
No need to import libs for using any APIs. Besides, you will also be able to use the entire Qt APIs in the near future!
Now, let’s add two menu objects under the “Tool” menu:
function Menu1Clicked()
{
print (”hey, I am menu1!”);
}
function Menu2Clicked()
{
print (”hey, I am menu2!”);
}
Amarok.Window.addSeparator();
Amarok.Window.addMenu( “testMenu1″ ); //you are creating a new object here!
Amarok.Window.addMenu( “testMenu2″ );
Amarok.Window.Menu.testMenu1.triggered.connect(Menu1Clicked); //then we can play with the new toy ![]()
Amarok.Window.Menu.testMenu2.triggered.connect(Menu2Clicked);
Finally, you can control the OSD and the statusbar widget (in the right bottom corner of the main window) using the code below:
var OSD = Amarok.OSD;
OSD.setText( “Hey there!” );
OSD.show();
var StatusBar = Amarok.Window.Statusbar;
StatusBar.shortMessage( “Hey there!” );
Still a young wolf ah? A lot more APIs need to be implemented, like the playlist, collection, services, some GUI control, and networking APIs…
I am really happy as I am growing with Amarok. Let’s pray for an another productive week, and wait for more magics pop up! ![]()
I’ve been at home for three weeks, was with my family and had a three-weeks-leisure-break.
Finally, I am sitting here to talk about my summer of code project. I am sorry about the first three weeks break, I really do. But I did try to get familiar with the development environment and tried to hack some code. I am going back to campus in Hong Kong in two days, I can thus concentrate on my SoC project.
For a long time, I was trying to understand what is going on there. Trying to think what the other developers think. For the first month I joined the community, I was amazed that amarok folks are so in love with what they are doing, and have so much passion on it. Different from my past projects, amarok is a rather large project, different developers had different views on the future way.
For the first time, I am feeling myself being pulled to the bleeding edge. I compiled QT for four times in two different platforms (How many times for kdelibs and kdeRunTime? :)). I realized it is sure a though learning process. Playing with the fresh new hot stuffs, I am pretty happy with this.
In the first week, I was busy with my exams, and cleaned up the existing dbus interface.
For the second and third week, I had a slight trip with my girl friend, set up a new Leopard development environment, tested the MPRIS support, and made my first commitment to KDE svn server.
I did some paper work, studied a little with scripts, and I am now quite clear with my goals for the coming busy July.
I made my mind to immigrate everything to qtscript from dbus. I would keep the MPRIS stuffs (PlayerDBusHandler, RootDBusHandler, TracklistDBusHandler) for dbus interface. And the other functions will be scriptable through qtscript. (both ruby and python need additional runtime dependencies, but not qtscript. The simpler the better :))
Compare to the current functions, I will add more signals since the signal machanism are rather easy to be acheived using slots and signals. For example, signals like trackEnd ,trackChange, SeekingTime, configurationChange and etc. would be added.
The second change I will make is the scriptable GUI. You will be able to add buttons, menus, lists using scripts.
Before my visiting to Belgium, I will make a easier use script manager which include upgrade checking, simple dependency checking (to check amarok version and optional packages for amarok which will be also needed by scripts).
I am so looking forward to the coming working days and nights. Hopfully, I can work out a brand new scripting interface in one and half months and thus I can start a new script project during my visit to Europe.
Happy hacking ![]()
We developed single core CPUs, then we have developed dual cores, now we have multi-core CPUs… Do anyone knows how many cores do we have in our brains?
We can watch movies while eating although some persons may have difficulty eating while watching hot girls; We may listen to musics while reading… And we know that there are several parts of the brain having different functionality. Is it really means we are multi-core thinking machines?
No! I do believe we are single-”CPU” animals. Of course, we are much more creative than machines.
Here’s how human brain works:
First of all, human body should supports interrupts. In the example of watching hot girls/guys, our brain asks the mouth to eat, and then keep focusing on the hot person. It will get a signal after the mouth finishes its job. Then it controls the eyes to look at your remaining food to get another bite. OK, if you are too concentrating on the girl/guy, you will not be able to respond the interrupt generated by the month. You will thus look stupid.
Now, after we learned the mechanism of our mind, we should conclude some principles in order to be a smart man.
Principle ONE: Do remember to respond your internal interrupts!
Yes, our mind is powerful, it not only supports sequential interrupt processing, it also supports nested interrupt processing! But It is still in some versions between beta and release candidate…
You were looking at a girl while eating, what if another even hotter girl pass through? Your eyes should immediately interrupt your mind to move attention to the other one! When doing this, you are supposed to move your attention back to the first girl after the second girl leaves. But why you still do like this? You stare at nothing as if the first girl does not even exists!

Here’s Principle TWO: Since the features of nested interrupts mechanism is still in some beta versions, use it carefully!
At last, our mind supports embedded virtual thinking! This is really an advantage that our human has over machines!
Guess why you stared at the wall, forgot other girls, and even forgot eating. This is called the function of embedded virtual debugging. You were doing a test run. I don’t know what you ran, cuz different persons should have different results, this is called the “various architecture phenomenon”, like x86 and ppc platforms… different persons will generate different virtual environment to have the virtual run.
It is still under debugging why nested interrupt will always related to the internal embedded virtual debugging.
Principle Three: Use your virtual debugger well, or you will always look like this:

This bug is a high priority bug! But human race suffered this for thousands of years! However, if we have multi-cores in our mind, these principles will not be necessary.
HEY! Home sweet home!
Helloworld()
{
RegisterDomain(peterzl.net);
RegisterDomain(peterzl.org);
RegisterDomain(peterzl.com);
InstallWordPress(MYHOME);
RocknRoll();
}
I am not going to maintain my MSN Space blog anymore. Its stability, speed and yet functionalities are unacceptable…
Actually, M$ did do me a favor, it only saved three years archive of my blogs! This reduced my workload of exporting/importing I guess… SHIT…!
This page will be mainly used for development related blogs. And my Chinese Blog is located here:
http://www.peterzl.net/cn
RSS Feed: http://www.peterzl.net/en/?feed=rss2
Have a nice weekend^_^