From 43d7efcd76ae55e905d2aa158956101c19672aa6 Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 17 Apr 2022 02:39:13 -0400 Subject: schema: add Entry.TitleContains --- schema/schema.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 +// Copyright © 2022 siddharth 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)) +} -- cgit v1.2.3