2009-01-05 20:16:44 +01:00
|
|
|
engine = dataEngine("nowplaying");
|
|
|
|
players = engine.sources;
|
|
|
|
watchingPlayer = players[0];
|
2009-01-05 21:49:26 +01:00
|
|
|
controller = service("nowplaying", watchingPlayer);
|
2009-01-05 20:16:44 +01:00
|
|
|
|
2009-01-05 13:53:01 +01:00
|
|
|
plasmoid.dataUpdate = function(a, b)
|
|
|
|
{
|
|
|
|
label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " +
|
|
|
|
parseInt(b.Position/60) + ":" + (parseInt(b.Position)%60);
|
|
|
|
}
|
|
|
|
|
2009-01-05 13:58:05 +01:00
|
|
|
plasmoid.stop = function()
|
|
|
|
{
|
2009-01-05 21:49:26 +01:00
|
|
|
data = controler.operationDescription("stop");
|
2009-01-05 20:16:44 +01:00
|
|
|
print(data+controller.name());
|
|
|
|
for ( var i in data ) {
|
|
|
|
print(i + ' -> ' + data[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
controller.startOperationCall(controller.operationDescription("stop"));
|
2009-01-05 13:58:05 +01:00
|
|
|
print("stopping");
|
|
|
|
}
|
|
|
|
|
2009-01-05 13:53:01 +01:00
|
|
|
layout = new LinearLayout(plasmoid);
|
2009-01-05 13:58:05 +01:00
|
|
|
layout.orientation = Vertical;
|
2009-01-05 13:53:01 +01:00
|
|
|
label = new Label();
|
|
|
|
layout.addItem(label);
|
|
|
|
|
2009-01-05 13:58:05 +01:00
|
|
|
stop = new PushButton();
|
|
|
|
stop.text = "Stop";
|
|
|
|
layout.addItem(stop);
|
|
|
|
|
2009-01-05 20:16:44 +01:00
|
|
|
controller.associateWidget(stop, "stop");
|
|
|
|
print(controller.operationNames());
|
|
|
|
|
2009-01-05 13:58:05 +01:00
|
|
|
stop["clicked()"].connect(plasmoid.stop);
|
|
|
|
|
2009-01-05 21:49:26 +01:00
|
|
|
engine.connectSource(watchingPlayer, plasmoid, 500);
|