From b75e47db83a4e68c86eb0e063086a507090d0016 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Tue, 20 Nov 2018 11:46:42 -0600 Subject: [PATCH 1/2] Unwatched fix --- pkg/locator/locator.go | 11 ++++------- pkg/model/locator_model.go | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pkg/locator/locator.go b/pkg/locator/locator.go index 5c87d98..de42d06 100644 --- a/pkg/locator/locator.go +++ b/pkg/locator/locator.go @@ -83,7 +83,7 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string) epoch := util.SubtractedEpoch(days) for _, i := range data { - if i.LastPlayed < epoch { + if int64(i.LastPlayed) <= epoch && int64(i.LastPlayed) != 0 { titles = append(titles, i.Title) strirk, err := strconv.Atoi(i.RatingKey) if err != nil { @@ -91,12 +91,8 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string) } ids = append(ids, strirk) } - if i.LastPlayed < 0 { - stri, err := strconv.Atoi(i.AddedAt) - if err != nil { - log.Fatal(err) - } - if int64(stri) < epoch { + if i.LastPlayed <= 0 { + if i.AddedAt <= epoch { titles = append(titles, i.Title) strirk, err := strconv.Atoi(i.RatingKey) if err != nil { @@ -107,5 +103,6 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string) } } sort.Strings(titles) + fmt.Printf("%v\n", titles) return ids, titles } diff --git a/pkg/model/locator_model.go b/pkg/model/locator_model.go index 0de47a7..b8a0e44 100644 --- a/pkg/model/locator_model.go +++ b/pkg/model/locator_model.go @@ -48,13 +48,13 @@ type PlexPyMediaInfo struct { VideoResolution string `json:"video_resolution"` GrandparentRatingKey string `json:"grandparent_rating_key"` AudioChannels string `json:"audio_channels"` - LastPlayed int64 `json:"last_played"` + LastPlayed int64 `json:"last_played,omitempty"` SectionID int `json:"section_id"` PlayCount int `json:"play_count"` Bitrate string `json:"bitrate"` VideoFramerate string `json:"video_framerate"` MediaIndex string `json:"media_index"` - AddedAt string `json:"added_at"` + AddedAt int64 `json:"added_at,string"` VideoCodec string `json:"video_codec"` ParentMediaIndex string `json:"parent_media_index"` } `json:"data"` -- 2.45.2 From ba03f92b26c223c894ad55b03b27bef43c5e65b6 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Tue, 20 Nov 2018 11:47:44 -0600 Subject: [PATCH 2/2] Oops --- pkg/locator/locator.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/locator/locator.go b/pkg/locator/locator.go index de42d06..ec17c05 100644 --- a/pkg/locator/locator.go +++ b/pkg/locator/locator.go @@ -103,6 +103,5 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string) } } sort.Strings(titles) - fmt.Printf("%v\n", titles) return ids, titles } -- 2.45.2