Kodi Community Forum

Full Version: Question: AlarmClock, CancelAlarm. How to getAlarm(alarm name)?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Greetings all. I hope someone can answer this question. Many thanks in advance.

I'm working on a script here. I'm using Alarmclock and cancel alarm builtin functions. My question is, If I don't want to cancel an Alarm I just want to know if it exists and how much time is left in it what should I do.

My goal is simple show on home.xml a count down of a certain AlarmClock. Please can anybody help me with this?
There may be some infolabels available for this - take a nosy through GUIInfoManager.h/cpp.
jmarshall Wrote:There may be some infolabels available for this - take a nosy through GUIInfoManager.h/cpp.

Thank you for the answer. I download the source code for XBMC 10, no trace for the file you suggested unfortunatly!. Do you mean that there are some labels which slipped getting documented in the docs?


EDIT!!! My mistake I found the file. Sorry I was too excited to wait the search enough for the results XD
First of all I have to tell you that I'm genuinly writing this because I care and I hope for XBMC development. And if my note has no meaning and noobish I'm sorry I'm still undergrad in SWE Sad.

Why the whole labels list is in Else if isn't that a huge amount of processing per execution? why no kind of data structure was used here?

Back to my original question. I read the file and I guess I understand what's going on so please straightin me out if it turned out to be..... the other way around

so we use $info[] to get something. This something is one of the huge list of elseifs. I found that there are 2 types. With a parameter and without. To recognize which is which these are examples:

Without:
else if (strTest.Equals("system.alarmpos"))

With:
else if (strTest.Left(16).Equals("system.hasalarm("))


Hoever it doesn't work! I think my conclusion is not correct. Please help me! Many thanx.
I assume you're referring to the translation from string:int - a datastructure could be used for some of it (though unless you're going to use a hash or map on the "thing you're looking for" it would amount to exactly the same amount of processing), but for others it would not suffice (eg where further processing is done on the string based on the first bit of it). I'm sure improvements could be made regardless, so if you want to get stuck in, please feel free. Smile

So system.hasalarm(name_of_alarm) should give you whether an alarm exists or not. I don't know whether there's another one that returns the time to go or not - don't have time to read through the code right now.

Cheers,
Jonathan