Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 49 additions & 9 deletions widgets/football-fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{{ $lastHomeScore := "?" }}
{{ $lastAwayScore := "?" }}
{{ $lastDate := "N/A" }}
{{ $lastMatchday := "?" }}

{{ range $matches }}
{{ $matchData := .Value }} {{/* Get underlying map/object */}}
Expand Down Expand Up @@ -62,12 +63,17 @@

{{ $dateVal := index $matchData "utcDate" }}
{{ if $dateVal }}{{ $lastDate = $dateVal | printf "%s" }}{{ else }}{{ $lastDate = "N/A" }}{{ end }}

{{ $matchDayVal := index $matchData "matchday" }}
{{ if $matchDayVal }}{{ $lastMatchday = $matchDayVal | printf "%.0f" }}{{ else }}{{ $lastMatchday = "?" }}{{ end }}
{{ end }}
{{ end }}

{{/* --- Display Last Match --- */}}
{{ if $lastFound }}
<div class="color-primary" style="font-size: 1.1em;">
{{ if eq $lastHomeTeam "FC Internazionale" }}{{ $lastHomeTeam = "Inter FC" }}{{ end }}
{{ if eq $lastAwayTeam "FC Internazionale" }}{{ $lastHomeTeam = "Inter FC" }}{{ end }}
{{ $lastHomeTeam }} {{ $lastHomeScore }} - {{ $lastAwayScore }} {{ $lastAwayTeam }}
</div>
{{ $dateStr := $lastDate }}
Expand All @@ -78,14 +84,24 @@
{{ $hour := slice $dateStr 11 13 }}
{{ $minute := slice $dateStr 14 16 }}
{{ $timedhour := slice $dateStr 11 13 }}

{{/*Adjust the time to the one that reflects yours timezone. Delete/Add if you need*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }} {{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but I can't find other solution */}}
{{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but i can't find other solution */}}
{{/* Offset for legal (DST) hours*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "14" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "17" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "20" }}{{ $timedhour = "21" }}{{ end }}
{{/* Offset for solar (Standard Time) hours*/}}
{{ if eq $hour "10" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "13" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "16" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "18" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "21" }}{{ end }}

<div style="font-size: 13px;">
{{ $day }}-{{ $month }}-{{ $year }} {{ $timedhour }}:{{ $minute }}
Round {{ $lastMatchday }} - {{ $day }}-{{ $month }}-{{ $year }} {{ $timedhour }}:{{ $minute }}
</div>
{{ else if $dateStr }}
{{/* Fallback if date string is not in expected format */}}
Expand Down Expand Up @@ -145,8 +161,8 @@
{{/* --- Display Live Match --- */}}
{{ if $liveFound }}
<div class="color-primary" style="font-size: 1.1em;">
{{ if eq $liveHomeTeam "FC Internazionale Milano" }}{{ $liveHomeTeam = "Inter FC" }}{{ end }}
{{ if eq $liveAwayTeam "FC Internazionale Milano" }}{{ $liveHomeTeam = "Inter FC" }}{{ end }}
{{ if eq $liveHomeTeam "FC Internazionale" }}{{ $liveHomeTeam = "Inter FC" }}{{ end }}
{{ if eq $liveAwayTeam "FC Internazionale" }}{{ $liveHomeTeam = "Inter FC" }}{{ end }}
{{ $liveHomeTeam }} {{ $liveHomeScore }} - {{ $liveAwayScore }} {{ $liveAwayTeam }}
</div>
{{ $dateStr := $liveDate }}
Expand All @@ -157,12 +173,22 @@
{{ $hour := slice $dateStr 11 13 }}
{{ $minute := slice $dateStr 14 16 }}
{{ $timedhour := slice $dateStr 11 13 }}

{{/*Adjust the time to the one that reflects yours timezone. Delete/Add if you need*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }} {{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but i can't find other solution */}}
{{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but i can't find other solution */}}
{{/* Offset for legal (DST) hours*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "14" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "17" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "20" }}{{ $timedhour = "21" }}{{ end }}
{{/* Offset for solar (Standard Time) hours*/}}
{{ if eq $hour "10" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "13" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "16" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "18" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "21" }}{{ end }}

<div style="font-size: 13px;">
<p class="color-highlight">
<span>Live, started</span>
Expand All @@ -189,6 +215,7 @@
{{ $nextFound := false }}
{{ $nextHomeTeam := "N/A" }}
{{ $nextAwayTeam := "N/A" }}
{{ $nextMatchday := "?" }}
{{ $nextDate := "N/A" }}
{{ range $matches }}
{{ $matchData := .Value }}
Expand All @@ -205,6 +232,9 @@
{{ if $awayTeamObj }}{{ $nextAwayTeam = index $awayTeamObj "name" | printf "%s" }}{{ else }}{{ $nextAwayTeam = "N/A" }}{{ end }}
{{ $dateVal := index $matchData "utcDate" }}
{{ if $dateVal }}{{ $nextDate = $dateVal | printf "%s" }}{{ else }}{{ $nextDate = "N/A" }}{{ end }}

{{ $matchDayVal := index $matchData "matchday" }}
{{ if $matchDayVal }}{{ $nextMatchday = $matchDayVal | printf "%.0f" }}{{ else }}{{ $nextMatchday = "?" }}{{ end }}
{{ end }}
{{ end }}
{{ end }}
Expand All @@ -225,14 +255,24 @@
{{ $hour := slice $dateStr 11 13 }}
{{ $minute := slice $dateStr 14 16 }}
{{ $timedhour := slice $dateStr 11 13 }}

{{/*Adjust the time to the one that reflects yours timezone. Delete/Add if you need*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }} {{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but i can't find other solution */}}
{{/* Eg. a match in my timezone start at 12. But in UTC time is 11. Ik is very rudimental but i can't find other solution */}}
{{/* Offset for legal (DST) hours*/}}
{{ if eq $hour "11" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "14" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "17" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "20" }}{{ $timedhour = "21" }}{{ end }}
{{/* Offset for solar (Standard Time) hours*/}}
{{ if eq $hour "10" }}{{ $timedhour = "12" }}{{ end }}
{{ if eq $hour "13" }}{{ $timedhour = "15" }}{{ end }}
{{ if eq $hour "16" }}{{ $timedhour = "18" }}{{ end }}
{{ if eq $hour "18" }}{{ $timedhour = "20" }}{{ end }}
{{ if eq $hour "19" }}{{ $timedhour = "21" }}{{ end }}

<div style="font-size: 13px;">
{{ $day }}-{{ $month }}-{{ $year }} {{ $timedhour }}:{{ $minute }}
Round {{ $nextMatchday }} - {{ $day }}-{{ $month }}-{{ $year }} {{ $timedhour }}:{{ $minute }}
<p class="color-primary">
<span>Live</span>
{{ $datetime := $dateStr}}
Expand All @@ -251,7 +291,7 @@
<div class="color-subdue" style="font-size: 1.1em;">No upcoming matches found</div>
{{ end }}
</div>
</div>
</div>
```

## Environment variables
Expand All @@ -261,4 +301,4 @@

## Remarks

To have matches with your local time, you need to change this parameters `{{ if eq $hour "20" }}{{ $timedhour = "21" }}{{ end }}`. Where `$hour` is the UTC time and `$timedhour` is the hour reflecting your timezone. You need to apply to LAST, LIVE and NEXT match (I can't find other solution)
To have matches with your local time, you need to change this parameters `{{ if eq $hour "20" }}{{ $timedhour = "21" }}{{ end }}`. Where `$hour` is the UTC time and `$timedhour` is the hour reflecting your timezone. You need to apply to LAST, LIVE and NEXT match (I can't find other solution, right now in the code is showing Europe/Rome timezone)
2 changes: 1 addition & 1 deletion widgets/football-fixtures/meta.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
title: Football Fixtures
description: show the last match and the next match of your favourite football team using football-data api
author: cristiandiiorio
author: cristiandiiorio, updated by M4th12
Binary file modified widgets/football-fixtures/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.