- name: Accueil columns: - size: small widgets: - type: calendar - type: rss title: Journal du serveur style: vertical-list limit: 10 collapse-after: 5 feeds: - url: http://rss/index.xml - size: full widgets: - type: search title: Recherche Whoogle search-engine: https://whoogle.tellserv.fr/search?q={QUERY} placeholder: Recherche sur Internet… new-tab: false autofocus: false - type: docker-containers title: Conteneurs en cours limit: 10 hide-by-default: true $include: includes/containers.yml - size: small widgets: - type: weather title: Météo à Domfront location: Domfront, France units: metric hour-format: 24h - type: server-stats title: Ressources serveur show-network: true servers: - type: local hide-mountpoints-by-default: true mountpoints: "/mnt/storage": name: Stockage principal hide: false - type: custom-api title: Minecraft url: https://api.mcstatus.io/v2/status/java/minecraft.tellserv.fr cache: 30s template: |
{{ if .JSON.Bool "online" }} {{ else }} {{ end }}
{{ .JSON.String "host" }} {{ if .JSON.Bool "online" }} {{ else }} {{ end }}
- type: custom-api title: Bibliothèques Plex cache: 5m options: base-url: https://plex.tellserv.fr api-key: ${secret:plex-token} template: | {{ $baseURL := .Options.StringOr "base-url" "" }} {{ $apiKey := .Options.StringOr "api-key" "" }} {{ define "errorMsg" }}
Erreur

{{ . }}

{{ end }} {{ if or (eq $baseURL "") (eq $apiKey "") }} {{ template "errorMsg" "Paramètres manquants : base-url ou api-key" }} {{ else }} {{ $sectionsURL := printf "%s/library/sections" $baseURL }} {{ $sectionsCall := newRequest $sectionsURL | withHeader "Accept" "application/json" | withHeader "X-Plex-Token" $apiKey | getResponse }} {{ if $sectionsCall.JSON.Exists "MediaContainer.Directory" }} {{ $sections := $sectionsCall.JSON.Array "MediaContainer.Directory" }}
{{ range $section := $sections }} {{ $sectionID := $section.String "key" }} {{ $title := $section.String "title" }} {{ $type := $section.String "type" }} {{ $color := "#666" }} {{ if eq $type "movie" }} {{ $color = "#e57373" }} {{ else if eq $type "show" }} {{ $color = "#7986cb" }} {{ else if eq $type "artist" }} {{ $color = "#81c784" }} {{ end }} {{ $countURL := printf "%s/library/sections/%s/all" $baseURL $sectionID }} {{ $countCall := newRequest $countURL | withParameter "X-Plex-Token" $apiKey | withHeader "Accept" "application/json" | getResponse }} {{ if $countCall.JSON.Exists "MediaContainer.size" }} {{ $count := $countCall.JSON.Int "MediaContainer.size" }}
{{ $title }}
{{ $count }}
{{ end }} {{ end }}
{{ else }} {{ template "errorMsg" "Impossible de récupérer les bibliothèques Plex" }} {{ end }} {{ end }}