From 43bde1e62a4beff674b8288c76dbbbdbd657e3d3 Mon Sep 17 00:00:00 2001 From: Rogee Date: Fri, 6 Dec 2024 14:19:57 +0800 Subject: [PATCH] feat: complete media discovery --- backend/common/media_store/store.go | 4 ++-- backend/modules/tasks/discover/discover_medias.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/common/media_store/store.go b/backend/common/media_store/store.go index 9cc1cce..119f4c8 100644 --- a/backend/common/media_store/store.go +++ b/backend/common/media_store/store.go @@ -70,9 +70,9 @@ func (s Store) Hashes() []string { } // Exists -func (s Store) Exists(name string) bool { +func (s Store) HashExists(hash string) bool { for _, m := range s { - if m.Name == name { + if m.Hash == hash { return true } } diff --git a/backend/modules/tasks/discover/discover_medias.go b/backend/modules/tasks/discover/discover_medias.go index 2a5c8bc..5e78870 100644 --- a/backend/modules/tasks/discover/discover_medias.go +++ b/backend/modules/tasks/discover/discover_medias.go @@ -58,7 +58,7 @@ func (d *DiscoverMedias) RunE(from, to string) error { return errors.Wrapf(err, "get file md5: %s", video) } - if store.Exists(md5) { + if store.HashExists(md5) { continue } @@ -242,7 +242,7 @@ func (d *DiscoverMedias) runCleanup(to string) { } for _, dir := range dirs { - if store.Exists(dir) { + if store.HashExists(dir) { continue }