diff options
author | siddharth <s@ricketyspace.net> | 2022-04-17 02:39:13 -0400 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2022-04-17 02:39:13 -0400 |
commit | 43d7efcd76ae55e905d2aa158956101c19672aa6 (patch) | |
tree | 134bfa3ce3365a73d7661d8a736b97e97de9acf5 | |
parent | 3b7f9b7e47b1210ecd6ff465243cbb7e5e070228 (diff) |
schema: add Entry.TitleContains
-rw-r--r-- | schema/schema.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/schema/schema.go b/schema/schema.go index 55e215a..c114fb1 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -1,10 +1,11 @@ // SPDX-License-Identifier: ISC -// Copyright © 2021 siddharth <s@ricketyspace.net> +// Copyright © 2022 siddharth <s@ricketyspace.net> package schema import ( "encoding/xml" + "strings" "time" ) @@ -59,3 +60,7 @@ type YouTubeFeed struct { XMLName xml.Name `xml:"feed"` Entries []YouTubeEntry `xml:"entry"` } + +func (e Entry) TitleContains(contains string) bool { + return strings.Contains(strings.ToLower(e.Title), strings.ToLower(contains)) +} |