Skip to content

Commit 3572e14

Browse files
committed
Support cover art quality
1 parent 0ce6e99 commit 3572e14

File tree

5 files changed

+38
-29
lines changed

5 files changed

+38
-29
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ vimeo = [ # Multiple keys will be rotated.
7474
update_period = "12h" # How often query for updates, examples: "60m", "4h", "2h45m"
7575
quality = "high" # or "low"
7676
format = "video" # or "audio"
77-
# custom = { cover_art = "{IMAGE_URL}}", category = "TV", subcategories = ["Documentary", "Tech News"], explicit = true, lang = "en" } # Optional feed customizations
77+
# custom.cover_art_quality use "high" or "low" to special cover image quality from channel cover default is equal with "quality" and disable when custom.cover_art was set.
78+
# custom = { cover_art = "{IMAGE_URL}}", cover_art_quality = "high", category = "TV", subcategories = ["Documentary", "Tech News"], explicit = true, lang = "en" } # Optional feed customizations
7879
# max_height = "720" # Optional maximal height of video, example: 720, 1080, 1440, 2160, ...
7980
# cron_schedule = "@every 12h" # Optional cron expression format. If set then overwrite 'update_period'. See details below
8081
# filters = { title = "regex for title here", not_title = "regex for negative title match", description = "...", not_description = "..." } # Optional Golang regexp format. If set, then only download matching episodes.

pkg/builder/youtube.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (yt *YouTubeBuilder) queryFeed(ctx context.Context, feed *model.Feed, info
235235
feed.Description = fmt.Sprintf("%s (%s)", feed.Title, feed.PubDate)
236236
}
237237

238-
feed.CoverArt = yt.selectThumbnail(thumbnails, feed.Quality, "")
238+
feed.CoverArt = yt.selectThumbnail(thumbnails, feed.CoverArtQuality, "")
239239

240240
return nil
241241
}

pkg/config/config.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ type Filters struct {
5555
}
5656

5757
type Custom struct {
58-
CoverArt string `toml:"cover_art"`
59-
Category string `toml:"category"`
60-
Subcategories []string `toml:"subcategories"`
61-
Explicit bool `toml:"explicit"`
62-
Language string `toml:"lang"`
63-
Author string `toml:"author"`
64-
Title string `toml:"title"`
65-
Description string `toml:"description"`
58+
CoverArt string `toml:"cover_art"`
59+
CoverArtQuality model.Quality `toml:"cover_art_quality"`
60+
Category string `toml:"category"`
61+
Subcategories []string `toml:"subcategories"`
62+
Explicit bool `toml:"explicit"`
63+
Language string `toml:"lang"`
64+
Author string `toml:"author"`
65+
Title string `toml:"title"`
66+
Description string `toml:"description"`
6667
}
6768

6869
type Server struct {
@@ -207,6 +208,10 @@ func (c *Config) applyDefaults(configPath string) {
207208
feed.Quality = model.DefaultQuality
208209
}
209210

211+
if feed.Custom.CoverArtQuality == "" {
212+
feed.Custom.CoverArtQuality = model.DefaultQuality
213+
}
214+
210215
if feed.Format == "" {
211216
feed.Format = model.DefaultFormat
212217
}

pkg/config/config_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ self_update = true
4040
quality = "low"
4141
filters = { title = "regex for title here" }
4242
clean = { keep_last = 10 }
43-
custom = { cover_art = "http://img", category = "TV", subcategories = ["1", "2"], explicit = true, lang = "en" }
43+
custom = { cover_art = "http://img", cover_art_quality = "high", category = "TV", subcategories = ["1", "2"], explicit = true, lang = "en" }
4444
`
4545
path := setup(t, file)
4646
defer os.Remove(path)
@@ -72,6 +72,7 @@ self_update = true
7272
assert.EqualValues(t, 10, feed.Clean.KeepLast)
7373

7474
assert.EqualValues(t, "http://img", feed.Custom.CoverArt)
75+
assert.EqualValues(t, "high", feed.Custom.CoverArtQuality)
7576
assert.EqualValues(t, "TV", feed.Custom.Category)
7677
assert.True(t, feed.Custom.Explicit)
7778
assert.EqualValues(t, "en", feed.Custom.Language)
@@ -128,6 +129,7 @@ data_dir = "/data"
128129
assert.EqualValues(t, feed.UpdatePeriod, Duration{model.DefaultUpdatePeriod})
129130
assert.EqualValues(t, feed.PageSize, 50)
130131
assert.EqualValues(t, feed.Quality, "high")
132+
assert.EqualValues(t, feed.Custom.CoverArtQuality, "high")
131133
assert.EqualValues(t, feed.Format, "video")
132134
}
133135

pkg/model/feed.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,25 @@ type Episode struct {
3535
}
3636

3737
type Feed struct {
38-
ID string `json:"feed_id"`
39-
ItemID string `json:"item_id"`
40-
LinkType Type `json:"link_type"` // Either group, channel or user
41-
Provider Provider `json:"provider"` // Youtube or Vimeo
42-
CreatedAt time.Time `json:"created_at"`
43-
LastAccess time.Time `json:"last_access"`
44-
ExpirationTime time.Time `json:"expiration_time"`
45-
Format Format `json:"format"`
46-
Quality Quality `json:"quality"`
47-
PageSize int `json:"page_size"`
48-
CoverArt string `json:"cover_art"`
49-
Title string `json:"title"`
50-
Description string `json:"description"`
51-
PubDate time.Time `json:"pub_date"`
52-
Author string `json:"author"`
53-
ItemURL string `json:"item_url"` // Platform specific URL
54-
Episodes []*Episode `json:"-"` // Array of episodes
55-
UpdatedAt time.Time `json:"updated_at"`
38+
ID string `json:"feed_id"`
39+
ItemID string `json:"item_id"`
40+
LinkType Type `json:"link_type"` // Either group, channel or user
41+
Provider Provider `json:"provider"` // Youtube or Vimeo
42+
CreatedAt time.Time `json:"created_at"`
43+
LastAccess time.Time `json:"last_access"`
44+
ExpirationTime time.Time `json:"expiration_time"`
45+
Format Format `json:"format"`
46+
Quality Quality `json:"quality"`
47+
CoverArtQuality Quality `json:"cover_art_quality"`
48+
PageSize int `json:"page_size"`
49+
CoverArt string `json:"cover_art"`
50+
Title string `json:"title"`
51+
Description string `json:"description"`
52+
PubDate time.Time `json:"pub_date"`
53+
Author string `json:"author"`
54+
ItemURL string `json:"item_url"` // Platform specific URL
55+
Episodes []*Episode `json:"-"` // Array of episodes
56+
UpdatedAt time.Time `json:"updated_at"`
5657
}
5758

5859
type EpisodeStatus string

0 commit comments

Comments
 (0)