Skip to content

Commit

Permalink
Storing missing dehydration input events to avoid reprocessing them
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Dec 17, 2024
1 parent 72b3d8a commit 00c4aab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion cli/dehydrate_posters.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ func DehydratePosters(force bool) error {

dehydratedPosters := make(map[string][]string)
dehydratedRepColors := make(map[string][]string)
dehydratedInputMissing := make(map[string][]string)

for _, videoId := range videoIds {

if rdx.HasKey(data.VideoDehydratedInputMissingProperty, videoId) && !force {
dpa.Increment()
continue
}

if rdx.HasKey(data.VideoDehydratedThumbnailProperty, videoId) && !force {
dpa.Increment()
continue
Expand All @@ -53,7 +59,7 @@ func DehydratePosters(force bool) error {
dehydratedPosters[videoId] = append(dehydratedPosters[videoId], dp)
dehydratedRepColors[videoId] = append(dehydratedRepColors[videoId], rc)
} else if errors.Is(err, ErrVideoHasNoPosterThumbnail) {
// do nothing
dehydratedInputMissing[videoId] = append(dehydratedInputMissing[videoId], "true")
} else {
dpa.Error(err)
}
Expand All @@ -69,6 +75,10 @@ func DehydratePosters(force bool) error {
return dpa.EndWithError(err)
}

if err := rdx.BatchReplaceValues(data.VideoDehydratedInputMissingProperty, dehydratedInputMissing); err != nil {
return dpa.EndWithError(err)
}

return nil
}

Expand Down
6 changes: 4 additions & 2 deletions data/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const (
VideoErrorsProperty = "video-errors"
VideoFavoriteProperty = "video-favorite"

VideoDehydratedThumbnailProperty = "video-dehydrated-thumbnail"
VideoDehydratedRepColorProperty = "video-dehydrate-rep-color"
VideoDehydratedThumbnailProperty = "video-dehydrated-thumbnail"
VideoDehydratedRepColorProperty = "video-dehydrated-rep-color"
VideoDehydratedInputMissingProperty = "video-dehydrated-input-missing"

VideoForcedDownloadProperty = "video-forced-download"

Expand Down Expand Up @@ -62,6 +63,7 @@ func VideoProperties() []string {
VideoThumbnailUrlsProperty,
VideoDehydratedThumbnailProperty,
VideoDehydratedRepColorProperty,
VideoDehydratedInputMissingProperty,
VideoExternalChannelIdProperty,
VideoShortDescriptionProperty,
VideoViewCountProperty,
Expand Down

0 comments on commit 00c4aab

Please sign in to comment.