| | |
| | | import de.uhilger.mediaz.store.FileStorage; |
| | | import de.uhilger.mediaz.store.Storage; |
| | | import de.uhilger.mediaz.store.StorageFile; |
| | | import de.uhilger.mediaz.store.Track; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | |
| | | StorageFile sf = new StorageFile(); |
| | | String fname = file.getName(); |
| | | sf.setName(fname); |
| | | sf.setTitelAnzName(fname); |
| | | if(file.isDirectory()) { |
| | | sf.setTyp(StorageFile.TYP_FOLDER); |
| | | } else { |
| | |
| | | Object o = extMap.get(ext); |
| | | if(o instanceof String) { |
| | | sf.setTyp(o.toString()); |
| | | getTrack(file, sf); |
| | | } else { |
| | | sf.setTyp(StorageFile.TYP_FILE); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private void getTrack(File file, StorageFile sf) { |
| | | if(sf.getTyp().equalsIgnoreCase(StorageFile.TYP_AUDIO)) { |
| | | Track track = new Track(file); |
| | | sf.setInterpret(track.getArtist()); |
| | | String trackTitel = track.getTitle(); |
| | | if(trackTitel != null && trackTitel.length() > 0) { |
| | | sf.setTitelAnzName(trackTitel); |
| | | } |
| | | sf.setAlbum(track.getAlbum()); |
| | | } |
| | | } |
| | | |
| | | } |