From f2ce8ffd8545e34aa4dc0bbad1301b59a3bf8f94 Mon Sep 17 00:00:00 2001 From: "Y.Tory" <5343692+kagemomiji@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:00:49 +0000 Subject: [PATCH] kagemomiji/airsonic-advanced#460 Update logging message for cue sheet file not found --- .../airsonic/player/service/MediaFileService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java b/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java index 9c3bf239d..34cafb799 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/MediaFileService.java @@ -836,7 +836,7 @@ private List updateChildren(@Nonnull MediaFile parent) { tracks.add(base); return tracks.stream(); } else { - LOG.warn("Cue sheet file {} not found", filePath); + LOG.warn("Could not find base file '{}' for cue sheet {}", filePath, indexPath); return Stream.empty(); } }).collect(Collectors.toList()); @@ -1190,8 +1190,6 @@ private List createIndexedTracks(@Nonnull MediaFile base, @Nullable C double wholeFileLength = base.getDuration(); String basePath = base.getPath(); - String file = cueSheet.getFileData().get(0).getFile(); - LOG.info(file); String parentPath = base.getParentPath(); String performer = cueSheet.getPerformer(); String albumName = cueSheet.getTitle(); @@ -1337,7 +1335,8 @@ public void setMemoryCacheEnabled(boolean memoryCacheEnabled) { private CueSheet getCueSheet(@Nonnull Path cueFile) { try { CueSheet cueSheet = null; - switch (FilenameUtils.getExtension(cueFile.toString()).toLowerCase()) { + String ext = FilenameUtils.getExtension(cueFile.toString()).toLowerCase(); + switch (ext) { case "cue": Charset cs = Charset.forName("UTF-8"); // default to UTF-8 // attempt to detect encoding for cueFile, fallback to UTF-8 @@ -1367,7 +1366,10 @@ private CueSheet getCueSheet(@Nonnull Path cueFile) { } // validation if (cueSheet == null || cueSheet.getFileData() == null || cueSheet.getFileData().size() == 0) { - LOG.warn("Error parsing cuesheet {}", cueFile); + if ("cue".equals(ext)) { + // Warn if no file data found in cue sheet + LOG.warn("Error parsing cuesheet {}", cueFile); + } return null; } return cueSheet;