mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-28 03:06:38 +08:00
b0fe40142a
* Rebrand MMTL to MeBox across codebase and assets Rename the project display name, Go module path, environment variable prefix (MEBOX_*), Docker image references, and UI branding from MMTL/mmtl to MeBox/mebox. Replace logo assets with the new MeBox icon and keep legacy SQLite migration support for existing mmtl.db deployments. Co-authored-by: truewhile <truewhile@users.noreply.github.com> * Fix logo icons: use cube-only crop without truncated text Previous icon generation cropped too much of the source image, including partial MeBox wordmark text that was cut off in square icon containers. Regenerate logo-64/192/512, favicon, and SVG from cube-only region. Co-authored-by: truewhile <truewhile@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: truewhile <truewhile@users.noreply.github.com>
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package service
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"github.com/truewhile/MeBox/internal/config"
|
|
"github.com/truewhile/MeBox/internal/model"
|
|
"github.com/truewhile/MeBox/internal/repository"
|
|
)
|
|
|
|
func TestUpdateMediaMetadataMarksManualMatch(t *testing.T) {
|
|
db := newServiceTestDB(t, &model.Library{}, &model.Media{})
|
|
repos := repository.New(db)
|
|
lib := model.Library{Name: "自采集", Path: "/media/custom", Type: "movie", Enabled: true}
|
|
if err := repos.Library.Create(t.Context(), &lib); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
media := model.Media{Base: model.Base{ID: "custom-media"}, LibraryID: lib.ID, Title: "raw", Path: "/media/custom/raw.mp4", ScrapeStatus: "no_match"}
|
|
if err := repos.DB.Create(&media).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
svc := NewMediaService(&config.Config{}, zap.NewNop(), repos)
|
|
title := "手动标题"
|
|
overview := "手动简介"
|
|
releaseDate := "2026-06-23"
|
|
season := 0
|
|
episode := 1
|
|
tmdbID := 12345
|
|
nsfw := true
|
|
updated, err := svc.UpdateMetadata(t.Context(), media.ID, MediaMetadataUpdate{
|
|
Title: &title,
|
|
Overview: &overview,
|
|
ReleaseDate: &releaseDate,
|
|
SeasonNum: &season,
|
|
EpisodeNum: &episode,
|
|
TMDbID: &tmdbID,
|
|
NSFW: &nsfw,
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("update metadata: %v", err)
|
|
}
|
|
if updated.Title != title || updated.Overview != overview || updated.ScrapeStatus != "matched" {
|
|
t.Fatalf("metadata not saved: %#v", updated)
|
|
}
|
|
if updated.SeasonNum != 0 || updated.EpisodeNum != 1 || updated.TMDbID != tmdbID || !updated.NSFW {
|
|
t.Fatalf("ids/episode metadata not saved: %#v", updated)
|
|
}
|
|
if updated.ReleaseDate != releaseDate {
|
|
t.Fatalf("release date = %q, want %q", updated.ReleaseDate, releaseDate)
|
|
}
|
|
}
|