Suggestion: Themes based on calendar date
#1
Hi there -- I have a suggestion for this skin (since I like it so much!) Big Grin.

How about the ability to have a theme (fanart, background, logo, etc.) dependent upon the date. So for someone's birthday, it can be triggered on the day. There could be an option to have it x number of days before/after a specific date also, say for Valentines, Halloween, Christmas, New Years, etc. The appropriate files (images, ...) can be stored in a folder (so many can be setup in advance) with a specific name for that "event" -- say the starting date and ending date.

Just a thought! It would add a very personal nature to the skin. Big Grin
Reply
#2
it's a nice idea but it would be rather complex (if possible at all) to code something like that.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
ronie Wrote:it's a nice idea but it would be rather complex (if possible at all) to code something like that.

I haven't any experience with skinning, but I can certainly code. If you can quickly elaborate on the complex portion, maybe I'll have some ideas! Lemme know! Smile
Reply
#4
HappyGoLucky Wrote:I haven't any experience with skinning, but I can certainly code. If you can quickly elaborate on the complex portion, maybe I'll have some ideas! Lemme know! Smile

date matching will be tricky. the date format in xbmc depends on your selected language/region.

it can be either one of those (there may be more):
Tuesday, December 29, 2009
Tuesday, 29 December 2009

and of course they will be localized for non-english users.

so let's say someone's birthday is on january the first.
this means you have to search the date string for 'january 1' and '1 january'
but this will also give false positives, it'll match '11 january' / 'january 11' as well.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Why not keep simple like:
YYYYMMDD
Where YYYY=0000 is a special year thats means "every year"

I think this format is easier to manage.
Reply
#6
as i tried (and probably failed :-) ) to explain, there is no simple YYYYMMDD date format in xbmc.

just look at the date at the top-right in Transparency!, that's all that is available.


.....hmm.....checking the wiki....instead of matching the date label, maybe you could use this boolean instead:
Quote:system.date(startDate,endDate)
Returns true if the current system date is >= startDate and < endDate. endDate is optional. Date must be specified in the format MM-DD.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#7
ronie Wrote:as i tried (and probably failed :-) ) to explain, there is no simple YYYYMMDD date format in xbmc.

just look at the date at the top-right in Transparency!, that's all that is available.


.....hmm.....checking the wiki....instead of matching the date label, maybe you could use this boolean instead:

Yup, that boolean should work and would be easy to code against. The year, which is not part of that date format, is probably irrelevant for the purpose we're trying to achieve.

That said, I'm not sure what the "event" would be to actually signal it's time to do a date check to allow the skin to change over. If the skin was just sitting there with no user interaction, could it receive and respond to a "day-change" event to change at midnight? If it's fine to just change when the user next interacts with the UI, that should be much simpler. It'd be nice though if you don't have to actively check the date on each pass or call to one of your heavily used functions -- although that's a good start, and the entry point would remain the same.
Reply
#8
if you use the boolean inside a visible condition, it will be evaluated continuously (every single frame), so no user interaction will be necessary.
Code:
<visible>system.date(startDate,endDate)</visible>


but the 'startDate' end 'endDate' values will have to be hardcoded in the skin.
this is no problem for fixed dates like valentine and christmas, but for custom birthdays it is.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#9
ronie Wrote:if you use the boolean inside a visible condition, it will be evaluated continuously (every single frame), so no user interaction will be necessary.
Code:
<visible>system.date(startDate,endDate)</visible>


Oh, that's convenient, albeit possibly expensive.

but the 'startDate' end 'endDate' values will have to be hardcoded in the skin.
this is no problem for fixed dates like valentine and christmas, but for custom birthdays it is.

Can you read from a local XML file? Or check for the existence of a folder? Or can you dynamically "include" a file with code in your skin? Just trying to think of ways to get, what would essentially be user settings, into your code to be evaluated.
Reply
#10
HappyGoLucky Wrote:Can you read from a local XML file? Or check for the existence of a folder?

nope
HappyGoLucky Wrote:Or can you dynamically "include" a file with code in your skin?
yes, you can use
<include condition="foo">Custom.xml</include>
note, conditional includes are only evaluated on page load, so not continuously.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#11
What are the fun skinnable holidays? Christmas, Halloween, Easter, maybe July 4th and Valentines day...Plus it's fun to see the theme for a month rather than one day. I think it would be better to check for month rather than day.

I like this idea but I foresee alot of code...

Wouldn't you have to copy every <label> and <image> you change and use a bunch of <visible> tag's to hide the former and show the holiday version of each tag?
Reply
#12
mcborzu Wrote:I like this idea but I foresee alot of code...

me too. ;-)
mcborzu Wrote:Wouldn't you have to copy every <label> and <image> you change and use a bunch of <visible> tag's to hide the former and show the holiday version of each tag?

yes, you'll have to duplicate every image you want to be 'themed'.

...just thinking out loud...would it be possible to 'prefix' the existing images?
like <texture>$INFO[Skin.String(CurrentHoliday]/somebackground.jpg</texture>
where $INFO[Skin.String(CurrentHoliday)] would return the foldername of the current holiday and be empty on all other occasions.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#13
ronie Wrote:me too. ;-)


yes, you'll have to duplicate every image you want to be 'themed'.

...just thinking out loud...would it be possible to 'prefix' the existing images?
like <texture>$INFO[Skin.String(CurrentHoliday]/somebackground.jpg</texture>
where $INFO[Skin.String(CurrentHoliday)] would return the foldername of the current holiday and be empty on all other occasions.

What if String(CurrentHoliday) can return a "default" value that represents the default skin -- that is, the default skin, as it currently is, is just another holiday? That way, there is no overriding a theme to make it a special day -- it'll work from the ground up. But yes, the folder names should be derived from the variable -- either directly, or a prefix/suffix, etc., but the filenames should all be identical. I'm thinking to create a new holiday, you just copy the "default" folder, give it a new name (maybe the date range), and replace files in there as necessary.
Reply
#14
ronie Wrote:nope

yes, you can use
<include condition="foo">Custom.xml</include>
note, conditional includes are only evaluated on page load, so not continuously.

If we agree that the UI does not have to change at midnight per se, the conditional include file can contain the path(s) to the new images, and the name of the XML can be derived from the date.

Can you gracefully trap if an include file does not exist? That is, attempt to include one, and if it fails, include a different (default) one? I'm thinking not. Sad
Reply
#15
HappyGoLucky Wrote:What if String(CurrentHoliday) can return a "default" value that represents the default skin

it should be empty to represent the current skin. ;-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
Suggestion: Themes based on calendar date0