mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-11 07:46:37 +08:00
fix library display and docker compose update
This commit is contained in:
@@ -22,7 +22,11 @@ func (s *MediaService) attachLibraryMetadata(ctx context.Context, items []model.
|
||||
}
|
||||
resolver := newMediaDisplayLibraryResolver(ctx, s.repo, libs)
|
||||
for i := range items {
|
||||
var own model.Library
|
||||
var hasOwn bool
|
||||
if lib, ok := byID[items[i].LibraryID]; ok {
|
||||
own = lib
|
||||
hasOwn = true
|
||||
items[i].LibraryName = lib.Name
|
||||
items[i].LibraryPath = lib.Path
|
||||
}
|
||||
@@ -30,6 +34,10 @@ func (s *MediaService) attachLibraryMetadata(ctx context.Context, items []model.
|
||||
items[i].DisplayLibraryID = lib.ID
|
||||
items[i].DisplayLibraryName = lib.Name
|
||||
items[i].DisplayLibraryPath = lib.Path
|
||||
if hasOwn && CloudLibraryAutoCategory(own) {
|
||||
items[i].LibraryName = lib.Name
|
||||
items[i].LibraryPath = lib.Path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,6 +80,11 @@ func (r mediaDisplayLibraryResolver) DisplayLibraryForMedia(media model.Media) (
|
||||
}
|
||||
own, hasOwn := r.byID[media.LibraryID]
|
||||
if hasOwn {
|
||||
if CloudLibraryAutoCategory(own) {
|
||||
if lib, ok := r.rootCloudDisplayLibraryForAutoCategory(own); ok {
|
||||
return lib, true
|
||||
}
|
||||
}
|
||||
if key, ok := CloudLibraryMergeKey(own); ok {
|
||||
if lib, exists := r.displayByMergeKey[key]; exists {
|
||||
return lib, true
|
||||
@@ -82,6 +95,23 @@ func (r mediaDisplayLibraryResolver) DisplayLibraryForMedia(media model.Media) (
|
||||
return model.Library{}, false
|
||||
}
|
||||
|
||||
func (r mediaDisplayLibraryResolver) rootCloudDisplayLibraryForAutoCategory(auto model.Library) (model.Library, bool) {
|
||||
info, ok := ParseCloudLibraryMount(auto.Path)
|
||||
if !ok {
|
||||
return model.Library{}, false
|
||||
}
|
||||
for _, lib := range r.displayLibraries {
|
||||
if !lib.Enabled {
|
||||
continue
|
||||
}
|
||||
candidate, ok := ParseCloudLibraryMount(lib.Path)
|
||||
if ok && candidate.Provider == info.Provider && cloudRootMountNeedsAutoCategory(candidate) {
|
||||
return lib, true
|
||||
}
|
||||
}
|
||||
return model.Library{}, false
|
||||
}
|
||||
|
||||
func (r mediaDisplayLibraryResolver) bestPathDisplayLibrary(media model.Media) (model.Library, bool) {
|
||||
if strings.HasPrefix(strings.ToLower(strings.TrimSpace(media.Path)), "cloud://") {
|
||||
mediaInfo, ok := ParseCloudLibraryMount(media.Path)
|
||||
|
||||
Reference in New Issue
Block a user