* improved logging for cmdline music mode
This commit is contained in:
parent
0d0b13ad61
commit
6ee9ff101d
|
@ -506,11 +506,14 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
|
||||
|
||||
public List<File> renameMusic(Collection<File> files, RenameAction renameAction, ConflictAction conflictAction, File outputDir, ExpressionFormat format, MusicIdentificationService service) throws Exception {
|
||||
CLILogger.config(format("Rename music using [%s]", service.getName()));
|
||||
List<File> audioFiles = filter(files, AUDIO_FILES);
|
||||
|
||||
// map old files to new paths by applying formatting and validating filenames
|
||||
Map<File, File> renameMap = new LinkedHashMap<File, File>();
|
||||
|
||||
// check audio files against acoustid
|
||||
for (Entry<File, AudioTrack> match : service.lookup(filter(files, AUDIO_FILES)).entrySet()) {
|
||||
for (Entry<File, AudioTrack> match : service.lookup(audioFiles).entrySet()) {
|
||||
File file = match.getKey();
|
||||
AudioTrack music = match.getValue();
|
||||
String newName = (format != null) ? format.format(new MediaBindingBean(music, file)) : validateFileName(music.toString());
|
||||
|
@ -518,6 +521,15 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
renameMap.put(file, getDestinationFile(file, newName, outputDir));
|
||||
}
|
||||
|
||||
// error logging
|
||||
if (renameMap.size() != audioFiles.size()) {
|
||||
for (File f : audioFiles) {
|
||||
if (!renameMap.containsKey(f)) {
|
||||
CLILogger.warning("Failed to lookup audio file: " + f.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rename movies
|
||||
Analytics.trackEvent("CLI", "Rename", "AudioTrack", renameMap.size());
|
||||
return renameAll(renameMap, renameAction, conflictAction);
|
||||
|
|
Loading…
Reference in New Issue