haschmich;594499 Wrote:
> Can you point me to an example how to access TrackStat attributes in lua
> scripts? I would like to patch the _updateTrack() function in
> NowPlayingApplet.lua to display the TrackStat rating.
>
The below is just samples, I haven't tried that it works so it probably
doesn't even compile. Hopefully it still gives you some ideas. There is
no way to get the TrackStat title formats to the Touch automatically,
you need to issue a JSON request that fetches them from one of the
server plugins that issues JSON commands.
Alternative 1: Calling TrackStat plugin directly.
Code:
--------------------
-- TODO: Make sure trackId contains the identifier for the track
server:userRequest(function(chunk,err)
if err then
log:warn(err)
else
-- TOOD: Implement loging that use the retived rating
rating = chunk.data
end
end,
player and player:getId(),
{'trackstat','getrating',trackId}
)
--------------------
Alternative 2: Calling Custom Clock Helper plugin which will get title
formats from TrackStat
Code:
--------------------
server:userRequest(function(chunk,err)
if err then
log:warn(err)
else
local customtitleformats = chunk.data.titleformats
for attribute,value in pairs(customtitleformats) do
-- TODO: Implement logic to get the TrackStat title
formats
log:debug("Title format:
"..tostring(attribute).."="..tostring(value))
end
end
end,
player and player:getId(),
{'customclock','titleformats'}
)
--------------------
If you get it to work, please post the changes you have done. Ideally
as a patch for Patch Installer but if you don't know how to do that,
just post the source code files you have changed and someone can help
you to offer it through Patch Installer.
--
erland
Erland Isaksson ('My homepage' (http://erland.isaksson.info))
(Developer of 'many plugins/applets'
(http://wiki.slimdevices.com/index.php/User:Erland). If my answer
helped you and you like to encourage future presence on this forum
and/or third party plugin/applet development, 'donations are always
appreciated' (http://erland.isaksson.info/donate))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=75410
_______________________________________________
Touch mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/touch