#!/bin/bash

if [ "x$1" == "x" ]; then
	APP=org.kde.amarok;
else
	APP=$1;
fi; 

length=`qdbus $APP /TrackList GetLength`
for (( i=0; i<$length; i++ ))
do
   T=`qdbus $APP /TrackList GetMetadata $i |grep title: |cut -f 2 -d ":"|tr -s "," " "`
   ni=`expr $i + 1`  
   echo "$ni.$T,"
done
