Skip to content

A self-hosted dashboard that puts all your feeds in one place

Allow specifying playlists separately

Svilen Markovc583057d4528
diff --git a/docs/configuration.md b/docs/configuration.md
index 05ca46a..dcfa355 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -589,6 +589,7 @@ Preview:
| Name | Type | Required | Default |
| ---- | ---- | -------- | ------- |
| channels | array | yes | |
+| playlists | array | no | |
| limit | integer | no | 25 |
| style | string | no | horizontal-cards |
| collapse-after | integer | no | 7 |
@@ -597,13 +598,7 @@ Preview:
| video-url-template | string | no | https://www.youtube.com/watch?v={VIDEO-ID} |
##### `channels`
-A list of channel or playlist IDs. To specify a playlist, use the `playlist:` prefix like such:
-
-```yaml
-channels:
- - playlist:PL8mG-RkN2uTyZZ00ObwZxxoG_nJbs3qec
- - playlist:PL8mG-RkN2uTxTK4m_Vl2dYR9yE41kRdBg
-```
+A list of channels IDs.
One way of getting the ID of a channel is going to the channel's page and clicking on its description:
@@ -613,6 +608,17 @@ Then scroll down and click on "Share channel", then "Copy channel ID":
![](images/videos-copy-channel-id-example.png)
+##### `playlists`
+
+A list of playlist IDs:
+
+```yaml
+- type: videos
+ playlists:
+ - PL8mG-RkN2uTyZZ00ObwZxxoG_nJbs3qec
+ - PL8mG-RkN2uTxTK4m_Vl2dYR9yE41kRdBg
+```
+
##### `limit`
The maximum number of videos to show.
diff --git a/internal/glance/widget-videos.go b/internal/glance/widget-videos.go
index bd36bee..c67fbbe 100644
--- a/internal/glance/widget-videos.go
+++ b/internal/glance/widget-videos.go
@@ -28,6 +28,7 @@ type videosWidget struct {
CollapseAfter int `yaml:"collapse-after"`
CollapseAfterRows int `yaml:"collapse-after-rows"`
Channels []string `yaml:"channels"`
+ Playlists []string `yaml:"playlists"`
Limit int `yaml:"limit"`
IncludeShorts bool `yaml:"include-shorts"`
}
@@ -47,6 +48,17 @@ func (widget *videosWidget) initialize() error {
widget.CollapseAfter = 7
}
+ // A bit cheeky, but from a user's perspective it makes more sense when channels and
+ // playlists are separate things rather than specifying a list of channels and some of
+ // them awkwardly have a "playlist:" prefix
+ if len(widget.Playlists) > 0 {
+ widget.Channels = append(widget.Channels, make([]string, len(widget.Playlists))...)
+
+ for i := range widget.Playlists {
+ widget.Channels[len(widget.Channels)-1+i] = "playlist:" + widget.Playlists[i]
+ }
+ }
+
return nil
}