media assets: add fix script to refresh metadata.
Add a script to go through every media asset and check the metadata (width, height, duration, filesize, md5, EXIF metadata) and update it if it's changed. This is necessary after upgrading ExifTool because the metadata it returns may have changed.
This commit is contained in:
@@ -78,6 +78,12 @@ class MediaAsset < ApplicationRecord
|
||||
end
|
||||
|
||||
def open_file
|
||||
open_file!
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def open_file!
|
||||
file = storage_service.open(file_path)
|
||||
frame_delays = media_asset.frame_delays if media_asset.is_ugoira?
|
||||
MediaFile.open(file, frame_delays: frame_delays, strict: false)
|
||||
|
||||
Reference in New Issue
Block a user