feat: Detect animation in image files for fetch_preview (#574)

* Implement animated metadata TODOs for database and thumbnailing.

Signed-off-by: Assisting <erik@eriklabine.com>

* Run linter for code changes

Signed-off-by: Assisting <erik@eriklabine.com>

---------

Signed-off-by: Assisting <erik@eriklabine.com>
This commit is contained in:
Erik LaBine
2026-03-23 01:07:22 -04:00
committed by GitHub
parent 5191bd16b2
commit 3fa0abf47f
9 changed files with 149 additions and 12 deletions

View File

@@ -45,7 +45,8 @@ auto_derived!(
Image {
width: isize,
height: isize,
// animated: bool // TODO: https://docs.rs/image/latest/image/trait.AnimationDecoder.html for APNG support
#[serde(default)]
animated: bool,
},
/// File is a video with specific dimensions
Video { width: isize, height: isize },

View File

@@ -406,9 +406,14 @@ impl From<crate::Metadata> for Metadata {
match value {
crate::Metadata::File => Metadata::File,
crate::Metadata::Text => Metadata::Text,
crate::Metadata::Image { width, height } => Metadata::Image {
crate::Metadata::Image {
width,
height,
animated,
} => Metadata::Image {
width: width as usize,
height: height as usize,
animated: animated as bool,
},
crate::Metadata::Video { width, height } => Metadata::Video {
width: width as usize,
@@ -424,9 +429,14 @@ impl From<Metadata> for crate::Metadata {
match value {
Metadata::File => crate::Metadata::File,
Metadata::Text => crate::Metadata::Text,
Metadata::Image { width, height } => crate::Metadata::Image {
Metadata::Image {
width,
height,
animated,
} => crate::Metadata::Image {
width: width as isize,
height: height as isize,
animated,
},
Metadata::Video { width, height } => crate::Metadata::Video {
width: width as isize,