Addons for Shadow4 skin

I created couple of examples for the Shadow4 skin. These don’t exactly have anything to do with calendars so they won’t be a part of the main installation but I’ll release them here as an addon to show what kind of things you can do with the Rainlendar skins and lua scripts. Feel free to use the scripts in your own skins.

Note that you need Rainlendar 2.10 or newer to run these.

Here’s the package: http://www.rainlendar.net/download/Shadow4-Widgets.r2skin-addon

To install just drop the file over the calendar window and if all goes well it should integrate itself to the default Shadow4 skin. After that you can go to the advanced skin options and choose these new windows:

RSS will show the rss feed from a given url. By default it shows the latest posts to this forum but you can define the location in the skin’s settings.

Photos shows interesting images from Flickr. You can define how often the image is reloaded and if it’s done randomly or not in the skin’s settings. Note that this works quite poorly with copy transparency enabled.

Weather displays current conditions and the forecast for the given location.

Countdown calculates downwards to a specific date. You can set the target day and the title from the skin’s settings.

TV shows current Finnish tv programs. This probably isn’t very useful if don’t live in Finland but I released it anyway as an example of a somewhat more complex script.

Moonphase shows the current phase of the moon.

File displays contents of a text file. The widget is automatically updated when the file changes.

Translate allows you to use Google’s translate service from a desktop widget. Supports multiple languages simultaneously.

World Time displays the current time in four different places in the world. Note that you might have to adjust for the daylight saving time manually.

Search opens your favorite web search page on your browser.

Localization:
If you want to help with the localization here is the psd template for the background texts: http://www.rainlendar.net/download/Language%20Template.psd

The font that is used in the texts is called Fusi which you probably can find from the internet quite easily. You can send the translated images to me (rainy@iki.fi) in png format so I can add them to the addon. Or you can just tell what the translations are and I’ll create the images.

Updates:
20.4.2019 - Added MS weather widget.
28.12.2012 - Changed the weather widget to use Yahoo weather.
2.7.2012 - Replaced the weather provider and added the search widget.
12.10.2010 - Added world time widget.
12.7.2010 - Updated for 2.7 release. Added translate widget.
22.8.2009 - Updated for 2.6 release.
13.9.2008 - The Photos window can now show images from local folders too (b65 or newer required).
7.12.2008 - Added Moonphase and File widgets (b68 or newer required).
22.12.2008 - Improved RSS feed support.

Here’s a screenshot of some of the addon windows:

Excellent work ! (again !)

Would it be possible to integrate the new features into the "Language Pack for Shadow4" and make it avilable here ?

No need to translate all new features, the only thing i’m missing at the moment is the translated "main calendar" skin.

BTW: The preview button when posting seems to be broken

That’s great, especially the weather script.
I tried to edit the script weather.lua for other langauge feeds from weather.msn.com but failed miserably for the tooltip :frowning:
Could you help me what I’m doing wrong?
Steps I did:
Feed: http://wetter.msn.com/RSS.aspx?wealocations=wc:AUXX0025&weadegreetype=C&culture=de-DE
the last part &culture=de-DE makes it a German feed and then the tooltip part of the script fails and only shows "Wien".
I tried to edit the lua script and did the following in it:

[code:1] – Create a tooltip for the weather icon
_, _, conditions = item:find("Aktuelle Wetterlage: (.) in"«»)
_, _, date = item:find("am (.
)."«»)
_, _, degrees = item:find("/>.-%p (.-)%p Luftfeuchtigkeit"«»)
_, _, humidity = item:find("Luftfeuchtigkeit: (%d*%%)"«»)
– _, _, winds = item:find("Windstärke: (.-)."«»)

			text = \"\"
			if (conditions) then
				text = text .. \"Aktuelle Wetterlage: \" .. conditions .. \"\\n\"
			end
			if (degrees) then
				degrees = degrees:gsub(\"°\", \"°\"«»)
				text = text .. \"Temperatur: \" .. degrees .. \"\\n\"
			end
			if (humidity) then
				text = text .. \"Luftfeuchtigkeit: \" .. humidity .. \"\\n\"
			end

– if (winds) then
– text = text … "Windstärke: " … winds … "\n"
– end
if (date) then
text = text … "am " … date … "\n"
end[/code:1]
With this I still can’t get it to correctly draw the tooltip. It still only shows me "Wien" (the title).
To be sure I just compared it again and this is the only difference to the original script.

On second view it seems that this part of the script is not actually used in Rainlendar but taken from a hardcoded part? Or something else I’m doing wrong because with the changed script from above I get the correct english tooltext when I delete the "&culture=de-DE" from the link.

Edit: another instance I fail is when I try to make the forecast temperatures show by editing Lo: Hi: to Niedrig: Höchst:

[code:1]-- Get the high and low temp
_, _, lo, hi = forecast:find("Niedrig: (-%d+).-Höchst: (-%d+)"«»)[/code:1]

It should be possible to install also the language addon together with this. I can change modify at least the window headers images so that they could be also translated by the language pack.

Gideon007, Try the attached version of the script. I at least got it to work with the German weather feed.

[file name=weather.lua size=4625]http://www.rainlendar.net/cms/images/fbfiles/files/weather.lua[/file]

Hi,

If you mean installing both Shadow4.r2skin-addon files, this does not work. It says something like "Can not merge this two versions"

The addons do not change the same files so it should be possible (I just tried it and did not get any errors). You need to make sure that you don’t apply the same addon twice to the skin because it can corrupt it. If you cannot get it to work could you check from the Rainlendar’s debug log what is the exact error it gives?

ok, found the very strange reason why it didn’t work.
Before editing the shadow4 skin directly I tried the script in my skin. Of course it didn’t work correctly since the call for the script in weather.xml goes out to the shadow4 skin lua file (I only noticed that later). So I removed the not working "calendar" in the skin settings from the active calendars and added the shadow4 weather calendar.
But for some strange reason Rainlendar still used the weather.lua from my skin. So no matter what I changed, it always used the wrong weather.lua file. Very strange why Rainlendar would do that and I’m very annoyed that I spent two hours or so figuring out what goes wrong in the script only to find that Rainlendar used the wrong one :slight_smile:
Maybe the log needs to track down the path of the script used from skins, too.
Also it is strange that even though I changed the url of the Shadow4 Weather skin but it used the wrong lua file…

SORRY, my fault.

Firefox renamed the Skin file to Shadow4.r2skin-addon(2).

Rainlendar does not know a skin with this name. Renaming the file solved the problem. Everything works as aspected now.

BTW, wouldn’t it be better to store the skin name in the skin file and check for it there ?

The scripts are always global. This means that if two script files have a function with the same name the one which is loaded later will overwrite the first one (or so I suspect; I haven’t actually tried this). So, when modifying the scripts the function names should be changed too (that’s the reason why they are usually prefixed with the skin name). Also note that the scripts are always loaded if you are using at least one window from the given skin even if that window wouldn’t use any of the scripts.

It might be useful (and probably more logical too) to limit the scripts only for the skin where they are defined but it would require a rewrite of all the scripting related code.

Yes :slight_smile:

I hadn’t thought about the problem of having multiple skin addons for the same skin. I’ll try to do something about it.

Hi!

I can’t drop the addon file over the calendar (I think because of kde4) Are there any other way to install the addon?

Thanks
Tsab

You can use the command line too:

./rainlendar2 -i Shadow4.r2skin-addon

hi,

is doesnt display weather information, it just sais "Refreshing" all the time.
Also my firewall doesnt display any outgoing connection from rainlendar.

cheers,

hachel

Same here. Just getting "Refreshing" on the weather info, and "Loading" on the RSS.

is it hard to convert the weather addon to the chromophone skin ?
(with a manual install of course, i don’t want to complicate at all…)

Philippe (french)

The widget addon has been updated. It now uses the same method to download stuff as the network shared calendars so proxies are supported now too. I also added couple of new widgets to the addon. You need to have build 59 or newer.

If you want to use e.g. the weather window in some other skin you need to copy the weather.xml and weather.lua files to the skin. The xml file defines the outlook of the window so you need to edit it to use different graphics and such. In the lua script you should replace all "Shadow4" texts to the name of the other skin (don’t use spaces in the skin name).

great stuff, works perfectly, cheers

I take it that documentation on the public interface to rainlendar is being worked on.

Yes, I’m thinking about writing at least some kind of reference manual for the scripting API. Someday :slight_smile:

The RSS window now crashes Rainlendar when I try to use it with the following feed:

Wired Top Stories
http://feeds.wired.com/wired/index

Any ideas?

Using Rainlendar 2.3b59 with Shadow4 Add-ons