Unwatched fix

This commit is contained in:
Matt Burchett 2018-11-20 11:46:42 -06:00
parent d016327e43
commit b75e47db83
2 changed files with 6 additions and 9 deletions

View File

@ -83,7 +83,7 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string)
epoch := util.SubtractedEpoch(days) epoch := util.SubtractedEpoch(days)
for _, i := range data { for _, i := range data {
if i.LastPlayed < epoch { if int64(i.LastPlayed) <= epoch && int64(i.LastPlayed) != 0 {
titles = append(titles, i.Title) titles = append(titles, i.Title)
strirk, err := strconv.Atoi(i.RatingKey) strirk, err := strconv.Atoi(i.RatingKey)
if err != nil { if err != nil {
@ -91,12 +91,8 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string)
} }
ids = append(ids, strirk) ids = append(ids, strirk)
} }
if i.LastPlayed < 0 { if i.LastPlayed <= 0 {
stri, err := strconv.Atoi(i.AddedAt) if i.AddedAt <= epoch {
if err != nil {
log.Fatal(err)
}
if int64(stri) < epoch {
titles = append(titles, i.Title) titles = append(titles, i.Title)
strirk, err := strconv.Atoi(i.RatingKey) strirk, err := strconv.Atoi(i.RatingKey)
if err != nil { if err != nil {
@ -107,5 +103,6 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string)
} }
} }
sort.Strings(titles) sort.Strings(titles)
fmt.Printf("%v\n", titles)
return ids, titles return ids, titles
} }

View File

@ -48,13 +48,13 @@ type PlexPyMediaInfo struct {
VideoResolution string `json:"video_resolution"` VideoResolution string `json:"video_resolution"`
GrandparentRatingKey string `json:"grandparent_rating_key"` GrandparentRatingKey string `json:"grandparent_rating_key"`
AudioChannels string `json:"audio_channels"` AudioChannels string `json:"audio_channels"`
LastPlayed int64 `json:"last_played"` LastPlayed int64 `json:"last_played,omitempty"`
SectionID int `json:"section_id"` SectionID int `json:"section_id"`
PlayCount int `json:"play_count"` PlayCount int `json:"play_count"`
Bitrate string `json:"bitrate"` Bitrate string `json:"bitrate"`
VideoFramerate string `json:"video_framerate"` VideoFramerate string `json:"video_framerate"`
MediaIndex string `json:"media_index"` MediaIndex string `json:"media_index"`
AddedAt string `json:"added_at"` AddedAt int64 `json:"added_at,string"`
VideoCodec string `json:"video_codec"` VideoCodec string `json:"video_codec"`
ParentMediaIndex string `json:"parent_media_index"` ParentMediaIndex string `json:"parent_media_index"`
} `json:"data"` } `json:"data"`