Skip to content

Commit

Permalink
#460 Update logging message for cue sheet file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji committed Jun 25, 2024
1 parent d63fef4 commit f2ce8ff
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ private List<MediaFile> 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());
Expand Down Expand Up @@ -1190,8 +1190,6 @@ private List<MediaFile> 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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f2ce8ff

Please sign in to comment.