-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore images unless changed, default segment count when nil #1170
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,12 @@ class EpisodeImage < ApplicationRecord | |
|
||
belongs_to :episode, touch: true, optional: true | ||
|
||
validates :height, :width, numericality: {greater_than_or_equal_to: 1400, less_than_or_equal_to: 3000}, if: :status_complete? | ||
validates :width, comparison: {equal_to: :height}, if: :status_complete? | ||
validates :height, :width, numericality: {greater_than_or_equal_to: 1400, less_than_or_equal_to: 3000}, if: :should_validate? | ||
validates :width, comparison: {equal_to: :height}, if: :should_validate? | ||
|
||
def should_validate? | ||
status_complete? && (height_changed? || width_changed?) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any case for moving this to the shared I see 1829 invalid episode images in prod ... as recently created as Feb 2023. Bit surprised by that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. image format on this one wasn't an issue, just the dimensions; probably we enforced a more lax value in the past. |
||
end | ||
|
||
def destination_path | ||
"#{episode.path}/#{image_path}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me a bit more nervous. There's already logic in the episode media to set this field, and to handle nil segment_counts (I've definitely seen those in the wild).
Was this also an issue with the ep referenced in the ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, as I recall it had a 0 segment count, even though it had audio