From b56bb3e0be136a9465589df74dd443b2bc063f90 Mon Sep 17 00:00:00 2001 From: ulrich Date: Fri, 09 Apr 2021 17:22:54 +0000 Subject: [PATCH] Abspielen in Arbeit --- src/de/uhilger/mediaz/api/ListFileHandler.java | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/de/uhilger/mediaz/api/ListFileHandler.java b/src/de/uhilger/mediaz/api/ListFileHandler.java index acd3243..3b01afe 100644 --- a/src/de/uhilger/mediaz/api/ListFileHandler.java +++ b/src/de/uhilger/mediaz/api/ListFileHandler.java @@ -25,13 +25,12 @@ 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; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -86,6 +85,7 @@ StorageFile sf = new StorageFile(); String fname = file.getName(); sf.setName(fname); + sf.setTitelAnzName(fname); if(file.isDirectory()) { sf.setTyp(StorageFile.TYP_FOLDER); } else { @@ -95,6 +95,7 @@ Object o = extMap.get(ext); if(o instanceof String) { sf.setTyp(o.toString()); + getTrack(file, sf); } else { sf.setTyp(StorageFile.TYP_FILE); } @@ -113,5 +114,16 @@ } } + 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()); + } + } } -- Gitblit v1.9.3