1 /* 2 * aTunes 3 * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors 4 * 5 * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors 6 * 7 * http://www.atunes.org 8 * http://sourceforge.net/projects/atunes 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 2 13 * of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 */ 20 21 package net.sourceforge.atunes.kernel.modules.process; 22 23 import net.sourceforge.atunes.model.IFileManager; 24 import net.sourceforge.atunes.model.ILocalAudioObject; 25 import net.sourceforge.atunes.model.IUnknownObjectChecker; 26 27 /** 28 * The Class SetAlbumNamesProcess. 29 */ 30 public class SetAlbumNamesProcess extends AbstractChangeTagProcess { 31 32 private IUnknownObjectChecker unknownObjectChecker; 33 34 private IFileManager fileManager; 35 36 /** 37 * @param fileManager 38 */ setFileManager(IFileManager fileManager)39 public void setFileManager(IFileManager fileManager) { 40 this.fileManager = fileManager; 41 } 42 43 /** 44 * @param unknownObjectChecker 45 */ setUnknownObjectChecker( final IUnknownObjectChecker unknownObjectChecker)46 public void setUnknownObjectChecker( 47 final IUnknownObjectChecker unknownObjectChecker) { 48 this.unknownObjectChecker = unknownObjectChecker; 49 } 50 51 @Override changeTag(final ILocalAudioObject file)52 protected void changeTag(final ILocalAudioObject file) { 53 if (unknownObjectChecker.isUnknownAlbum(file 54 .getAlbum(unknownObjectChecker))) { 55 // Take name from folder 56 String albumName = fileManager.getParentName(file); 57 getTagHandler().setAlbum(file, albumName); 58 } 59 } 60 } 61