After hacking the source code for one hour, it appeared to me that the functionality I wanted already was available. I am using ncmpc, an excellent and small program that controls the mpd music player daemon, and wanted it to display how long each song in the playlist is and did not find an obvious example of how to do it.
I found it a useful project to start hacking the source and add the functionality, and I started to dig into the sourcecode. But the solution is actually to add the following to the configuration file ~/.ncmpc/config :
list-format = “[[%artist% - ]%title% (%time%)]|[%file (%time%)]”
Now you will se how long each song is when you browse and watch the playlist.
Hope this tip will help anyone.