mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-08 06:16:37 +08:00
Update commit message generation
This commit is contained in:
@@ -1 +1 @@
|
|||||||
28604
|
20380
|
||||||
|
|||||||
@@ -49,10 +49,11 @@ func NewEmbyService(cfg *config.Config, log *zap.Logger, repo *repository.Contai
|
|||||||
func (e *EmbyService) SystemInfo() map[string]any {
|
func (e *EmbyService) SystemInfo() map[string]any {
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
"Id": embyServerID,
|
"Id": embyServerID,
|
||||||
|
"ServerId": embyServerID,
|
||||||
"ServerName": "MediaStationGo",
|
"ServerName": "MediaStationGo",
|
||||||
"Version": "10.8.13",
|
"Version": "10.8.13",
|
||||||
"ProductName": "MediaStationGo",
|
"ProductName": "Jellyfin Server",
|
||||||
"OperatingSystem": "Linux",
|
"OperatingSystem": "Windows",
|
||||||
"Architecture": "X64",
|
"Architecture": "X64",
|
||||||
"LocalAddress": "",
|
"LocalAddress": "",
|
||||||
"WanAddress": "",
|
"WanAddress": "",
|
||||||
@@ -61,6 +62,9 @@ func (e *EmbyService) SystemInfo() map[string]any {
|
|||||||
"SupportsLibraryMonitor": true,
|
"SupportsLibraryMonitor": true,
|
||||||
"SupportsHttps": false,
|
"SupportsHttps": false,
|
||||||
"SupportsAutoDiscovery": true,
|
"SupportsAutoDiscovery": true,
|
||||||
|
"HttpServerPortNumber": e.cfg.App.Port,
|
||||||
|
"HttpsPortNumber": 0,
|
||||||
|
"PublishedServerUrl": "",
|
||||||
"WebSocketPortNumber": e.cfg.App.Port,
|
"WebSocketPortNumber": e.cfg.App.Port,
|
||||||
"CompletedInstallations": []any{},
|
"CompletedInstallations": []any{},
|
||||||
"CanSelfRestart": false,
|
"CanSelfRestart": false,
|
||||||
@@ -72,11 +76,18 @@ func (e *EmbyService) SystemInfo() map[string]any {
|
|||||||
// SystemInfoPublic 是不需要认证的精简版(Emby Web 客户端登陆前会拉)。
|
// SystemInfoPublic 是不需要认证的精简版(Emby Web 客户端登陆前会拉)。
|
||||||
func (e *EmbyService) SystemInfoPublic() map[string]any {
|
func (e *EmbyService) SystemInfoPublic() map[string]any {
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
"Id": embyServerID,
|
"Id": embyServerID,
|
||||||
"ServerName": "MediaStationGo",
|
"ServerId": embyServerID,
|
||||||
"Version": "10.8.13",
|
"ServerName": "MediaStationGo",
|
||||||
"ProductName": "MediaStationGo",
|
"Version": "10.8.13",
|
||||||
"OperatingSystem": "Linux",
|
"ProductName": "Jellyfin Server",
|
||||||
|
"OperatingSystem": "Windows",
|
||||||
|
"LocalAddress": "",
|
||||||
|
"WanAddress": "",
|
||||||
|
"HttpServerPortNumber": e.cfg.App.Port,
|
||||||
|
"HttpsPortNumber": 0,
|
||||||
|
"SupportsHttps": false,
|
||||||
|
"SupportsAutoDiscovery": true,
|
||||||
"StartupWizardCompleted": true,
|
"StartupWizardCompleted": true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,60 @@ func TestReadAdultMovieNFOFallbackInSingleMovieFolder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReadAdultNFOByCodeForStackedFile(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
mediaPath := filepath.Join(root, "SSIS-001-C.mp4")
|
||||||
|
if err := os.WriteFile(mediaPath, []byte("x"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(filepath.Join(root, "SSIS-001.nfo"), []byte(`<movie>
|
||||||
|
<title>按番号命中的本地 NFO</title>
|
||||||
|
<originaltitle>SSIS-001</originaltitle>
|
||||||
|
<art><poster>SSIS-001-poster.jpg</poster><fanart>SSIS-001-fanart.jpg</fanart></art>
|
||||||
|
</movie>`), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
poster := filepath.Join(root, "SSIS-001-poster.jpg")
|
||||||
|
fanart := filepath.Join(root, "SSIS-001-fanart.jpg")
|
||||||
|
if err := os.WriteFile(poster, []byte("jpg"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(fanart, []byte("jpg"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
got, err := ReadLocalMetadata(mediaPath, root, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got == nil || got.Title != "按番号命中的本地 NFO" || got.AdultCode != "SSIS-001" || !got.HasNFO {
|
||||||
|
t.Fatalf("unexpected metadata: %+v", got)
|
||||||
|
}
|
||||||
|
if got.PosterURL != poster || got.BackdropURL != fanart {
|
||||||
|
t.Fatalf("artwork poster=%q fanart=%q", got.PosterURL, got.BackdropURL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadAdultArtworkByCodeWithoutNFO(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
mediaPath := filepath.Join(root, "SSIS-001-CD1.mp4")
|
||||||
|
if err := os.WriteFile(mediaPath, []byte("x"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
poster := filepath.Join(root, "SSIS-001-poster.jpg")
|
||||||
|
if err := os.WriteFile(poster, []byte("jpg"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
got, err := ReadLocalMetadata(mediaPath, root, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if got == nil || got.PosterURL != poster || !got.HasArtwork || got.HasNFO {
|
||||||
|
t.Fatalf("unexpected artwork metadata: %+v", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestScanLibraryUsesLocalMetadata(t *testing.T) {
|
func TestScanLibraryUsesLocalMetadata(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
seasonDir := filepath.Join(root, "Show", "Season 02")
|
seasonDir := filepath.Join(root, "Show", "Season 02")
|
||||||
@@ -277,6 +331,50 @@ func TestScanLibraryUsesLocalMetadata(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestScanLibraryDoesNotMarkArtworkOnlyAsMatched(t *testing.T) {
|
||||||
|
root := t.TempDir()
|
||||||
|
mediaPath := filepath.Join(root, "SSIS-001-CD1.mp4")
|
||||||
|
if err := os.WriteFile(mediaPath, []byte("x"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
poster := filepath.Join(root, "SSIS-001-poster.jpg")
|
||||||
|
if err := os.WriteFile(poster, []byte("jpg"), 0o644); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := db.AutoMigrate(&model.Library{}, &model.Media{}, &model.Setting{}); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
repos := repository.New(db)
|
||||||
|
lib := model.Library{Name: "Adult", Path: root, Type: "movie", Enabled: true}
|
||||||
|
if err := repos.Library.Create(t.Context(), &lib); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner := NewScannerService(&config.Config{}, zap.NewNop(), repos, NewHub(zap.NewNop()), nil, nil)
|
||||||
|
res, err := scanner.ScanLibrary(t.Context(), lib.ID)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if res.LocalMetadata != 1 {
|
||||||
|
t.Fatalf("LocalMetadata = %d, want 1", res.LocalMetadata)
|
||||||
|
}
|
||||||
|
var media model.Media
|
||||||
|
if err := db.First(&media, "path = ?", mediaPath).Error; err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if media.PosterURL != poster {
|
||||||
|
t.Fatalf("poster_url = %q, want %q", media.PosterURL, poster)
|
||||||
|
}
|
||||||
|
if media.ScrapeStatus == "matched" {
|
||||||
|
t.Fatalf("artwork-only media should remain enrichable, got status %q", media.ScrapeStatus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestScanLibraryParsesEpisodesForMovieTypedLibrary(t *testing.T) {
|
func TestScanLibraryParsesEpisodesForMovieTypedLibrary(t *testing.T) {
|
||||||
root := t.TempDir()
|
root := t.TempDir()
|
||||||
seasonDir := filepath.Join(root, "哈哈哈哈哈 (2020)", "Season 06")
|
seasonDir := filepath.Join(root, "哈哈哈哈哈 (2020)", "Season 06")
|
||||||
|
|||||||
@@ -261,9 +261,6 @@ func mergeLocalMetadataIntoMatch(match *Match, local *LocalMetadata) {
|
|||||||
if local.TMDbID > 0 {
|
if local.TMDbID > 0 {
|
||||||
match.TMDbID = local.TMDbID
|
match.TMDbID = local.TMDbID
|
||||||
}
|
}
|
||||||
if local.BangumiID > 0 {
|
|
||||||
match.BangumiID = local.BangumiID
|
|
||||||
}
|
|
||||||
if local.Genres != "" {
|
if local.Genres != "" {
|
||||||
match.Genres = splitNFOList(local.Genres)
|
match.Genres = splitNFOList(local.Genres)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user