mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 10:27:45 +02:00
Allow specifying playlists separately
This commit is contained in:
parent
982f3ee2a1
commit
c583057d45
@ -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":
|
||||
|
||||

|
||||
|
||||
##### `playlists`
|
||||
|
||||
A list of playlist IDs:
|
||||
|
||||
```yaml
|
||||
- type: videos
|
||||
playlists:
|
||||
- PL8mG-RkN2uTyZZ00ObwZxxoG_nJbs3qec
|
||||
- PL8mG-RkN2uTxTK4m_Vl2dYR9yE41kRdBg
|
||||
```
|
||||
|
||||
##### `limit`
|
||||
The maximum number of videos to show.
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user