Make renaming example for lrc files more generic

This commit is contained in:
Martchus 2020-11-25 01:34:51 +01:00
parent 0adf85b1f1
commit b0cd798ec1
1 changed files with 13 additions and 12 deletions

View File

@ -96,20 +96,21 @@ if (fileInfo.currentName.indexOf(".") === 0
return return
} }
// treat *.lrc files like their corresponding *.mp3 files // treat *.lrc files like their corresponding audio files
var keepSuffix var keepSuffix;
if (fileInfo.currentSuffix === "lrc") { if (fileInfo.currentSuffix === "lrc") {
// deduce path of corresponding *.mp3 file keepSuffix = fileInfo.currentSuffix; // keep the lrc suffix later
var correspondingMp3File = fileInfo.currentPathWithoutExtension + ".mp3" for(let extension of ["mp3", "flac", "m4a"]) {
// keep the lrc suffix later fileInfo = tageditor.parseFileInfo(fileInfo.currentPathWithoutExtension + "." + extension);
keepSuffix = fileInfo.currentSuffix tag = fileInfo.tag;
// use the file info from the corresponding *.mp3 file if (!fileInfo.ioErrorOccured) {
fileInfo = tageditor.parseFileInfo(correspondingMp3File) break;
if (fileInfo.ioErrorOccured) { }
tageditor.skip("skipped, " + correspondingMp3File + " not present") }
return if (fileInfo.ioErrorOccured) {
tageditor.skip("skipping, corresponding audio file not present");
return;
} }
tag = fileInfo.tag
} }
// skip files which don't contain audio or video tracks // skip files which don't contain audio or video tracks