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 java.io.IOException;
24 import java.util.ArrayList;
25 import java.util.Map;
26 
27 import net.sourceforge.atunes.model.ILocalAudioObject;
28 
29 /**
30  * The Class SetTrackNumberProcess.
31  */
32 public class SetTrackNumberProcess extends AbstractChangeTagProcess {
33 
34     /** The files and tracks. */
35     private Map<ILocalAudioObject, Integer> filesAndTracks;
36 
37     /**
38      * @param filesAndTracks
39      */
setFilesAndTracks(Map<ILocalAudioObject, Integer> filesAndTracks)40     public void setFilesAndTracks(Map<ILocalAudioObject, Integer> filesAndTracks) {
41     	setFilesToChange(new ArrayList<ILocalAudioObject>(filesAndTracks.keySet()));
42 		this.filesAndTracks = filesAndTracks;
43 	}
44 
45     @Override
changeTag(ILocalAudioObject file)46     protected void changeTag(ILocalAudioObject file) throws IOException {
47         getTagHandler().setTrackNumber(file, filesAndTracks.get(file));
48     }
49 }
50