diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-18 23:29:15 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-18 23:29:15 +0100 |
| commit | 848d4adc1a6095e92b67d2fe7211c303924e5c04 (patch) | |
| tree | 70392d8860e47546b63480023d2a3fd459dfe54f | |
| parent | da20590943b833abcce72bd6d6de475a83d5df07 (diff) | |
| download | jellything-848d4adc1a6095e92b67d2fe7211c303924e5c04.tar jellything-848d4adc1a6095e92b67d2fe7211c303924e5c04.tar.bz2 jellything-848d4adc1a6095e92b67d2fe7211c303924e5c04.tar.zst | |
acoustid duration limit
| -rw-r--r-- | import/src/plugins/acoustid.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/import/src/plugins/acoustid.rs b/import/src/plugins/acoustid.rs index 58a2657..927fd85 100644 --- a/import/src/plugins/acoustid.rs +++ b/import/src/plugins/acoustid.rs @@ -146,6 +146,7 @@ pub(crate) fn acoustid_fingerprint(cache: &Cache, path: &Path) -> Result<Arc<Fin cache.cache_memory( &format!("media/chromaprint/{}.json", HashKey(path)), move || { + info!("fpcalc {path:?}"); let child = Command::new("fpcalc") .arg("-json") .arg(path) @@ -179,10 +180,17 @@ impl ImportPlugin for AcoustID { ..Default::default() } } - fn media(&self, ct: &PluginContext, node: RowNum, path: &Path, _seg: &Segment) -> Result<()> { + fn media(&self, ct: &PluginContext, node: RowNum, path: &Path, seg: &Segment) -> Result<()> { if !ct.iflags.use_acoustid { return Ok(()); } + + let duration = (seg.info.duration.unwrap_or_default() * seg.info.timestamp_scale as f64) + / 1_000_000_000.; + if duration > 60. * 10. { + return Ok(()); + } + let fp = acoustid_fingerprint(&ct.ic.cache, path)?; if let Some((atid, mbid)) = self.get_atid_mbid(&ct.ic.cache, &fp, &ct.rt)? { |