[help] Javascript in Konfabulator Widget

I am porting over GC's Sleek Tunes widget from AveDesk to Konfabulator for personal use, and I have everything, except the rating and the album art. I'm using XiDG's AlTunes as a base. AlTunes doesn't have rating in it, so I took a peek at iTunes Display's code and found this

					rawRating = telliTunes('return ((get rating of current track) as string)');

if (preferences.custom_rating.value == 0) {

if (rawRating == 0) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 1) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 2) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 3) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 4) {

rating.data = rating_shadow.data = "?????";

} else if (rawRating/20 == 5) {

rating.data = rating_shadow.data = "?????";

} else {

rating.data = rating_shadow.data = "";

}

so I modified it to show images instead:

				rawRating = telliTunes('return ((get rating of current track) as string)');

if (preferences.custom_rating.value == 0) {

if (rawRating == 0) {

rating.src = "Resources/rate0.png";

} else if (rawRating/20 == 1) {

rating.src = "Resources/rate1.png";

} else if (rawRating/20 == 2) {

rating.src = "Resources/rate2.png";

} else if (rawRating/20 == 3) {

rating.src = "Resources/rate3.png";

} else if (rawRating/20 == 4) {

rating.src = "Resources/rate4.png";

} else if (rawRating/20 == 5) {

rating.src = "Resources/rate5.png";

} else {

rating.src = "";

}

}

I added this to my kon file:

	<image src="../../unavailable.html">

<name>rating</name>

<hOffset>76</hOffset>

<vOffset>87</vOffset>

</image>

The thing is it doesn't display my rating, just the rate0.png. Also now when I launch the widget, it shows "undefined" in the info pane for a couple of seconds, then displays the info. Help is appreciated :)

#258036

AFAIK Konfabs cross platform iTunes subset does not support rating at all, unless escaped with AppleScript on the Mac and shell'ed to ActiveScript on the WinTel PC. One would need to see the source code of "tellitunes" to be of more help.

#258044

Well, I'm on a Mac, and iTunes Display works on the Mac, so I just thought the code could be copied over :slant:

Anyways from what I can deduce, the code is logical, but logic doesn't always work :P

#258085