mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
fix: lint
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
05d841e9dd
commit
8bd0112c79
@ -195,12 +195,12 @@ func (s *playlists) parseM3U(ctx context.Context, pls *model.Playlist, folder *m
|
|||||||
}
|
}
|
||||||
filteredLines = append(filteredLines, line)
|
filteredLines = append(filteredLines, line)
|
||||||
}
|
}
|
||||||
paths, err := s.normalizePaths(ctx, pls, folder, filteredLines)
|
pathsWithLibrary, err := s.normalizePaths(ctx, pls, folder, filteredLines)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(ctx, "Error normalizing paths in playlist", "playlist", pls.Name, err)
|
log.Warn(ctx, "Error normalizing paths in playlist", "playlist", pls.Name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
found, err := mediaFileRepository.FindByPaths(paths)
|
found, err := mediaFileRepository.FindByPaths(pathsWithLibrary)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(ctx, "Error reading files from DB", "playlist", pls.Name, err)
|
log.Warn(ctx, "Error reading files from DB", "playlist", pls.Name, err)
|
||||||
continue
|
continue
|
||||||
@ -212,16 +212,11 @@ func (s *playlists) parseM3U(ctx context.Context, pls *model.Playlist, folder *m
|
|||||||
key := fmt.Sprintf("%d:%s", found[idx].LibraryID, normalizePathForComparison(found[idx].Path))
|
key := fmt.Sprintf("%d:%s", found[idx].LibraryID, normalizePathForComparison(found[idx].Path))
|
||||||
existing[key] = idx
|
existing[key] = idx
|
||||||
}
|
}
|
||||||
for _, path := range paths {
|
for _, path := range pathsWithLibrary {
|
||||||
// Parse the library-qualified path
|
// Parse the library-qualified path
|
||||||
normalizedPath := path
|
parts := strings.SplitN(path, ":", 2)
|
||||||
if parts := strings.SplitN(path, ":", 2); len(parts) == 2 {
|
// Path is already qualified: "libraryID:path"
|
||||||
// Path is already qualified: "libraryID:path"
|
normalizedPath := parts[0] + ":" + normalizePathForComparison(parts[1])
|
||||||
normalizedPath = parts[0] + ":" + normalizePathForComparison(parts[1])
|
|
||||||
} else {
|
|
||||||
// Unqualified path (backward compatibility)
|
|
||||||
normalizedPath = normalizePathForComparison(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
idx, ok := existing[normalizedPath]
|
idx, ok := existing[normalizedPath]
|
||||||
if ok {
|
if ok {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user