From d027b57c66dcdb183683c34101518df1572c1bf8 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Mon, 12 Apr 2021 16:53:30 +0000
Subject: [PATCH] Livestreams erste Fassung fertig
---
src/de/uhilger/mediaz/store/FileStorage.java | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/de/uhilger/mediaz/store/FileStorage.java b/src/de/uhilger/mediaz/store/FileStorage.java
index ef24e9d..ce6b60f 100644
--- a/src/de/uhilger/mediaz/store/FileStorage.java
+++ b/src/de/uhilger/mediaz/store/FileStorage.java
@@ -19,7 +19,6 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
-import de.uhilger.mediaz.App;
import de.uhilger.mediaz.Server;
import de.uhilger.mediaz.entity.Ablageort;
import de.uhilger.mediaz.entity.Abspieler;
@@ -33,6 +32,8 @@
import java.io.IOException;
import java.util.logging.Logger;
import de.uhilger.mediaz.entity.Entity;
+import de.uhilger.mediaz.entity.Livestream;
+import de.uhilger.mediaz.entity.Titel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -58,6 +59,8 @@
public static final String ST_ABLAGEORT = "Ablageort";
public static final String ST_EINSTELLUNG = "Einstellung";
public static final String ST_ABSPIELER = "Abspieler";
+ public static final String ST_ABSPIELLISTE = "Abspielliste";
+ public static final String ST_LIVESTREAM = "Livestream";
private final String fileBase;
@@ -71,11 +74,15 @@
TypeToken<Einstellung> ttEinstellung = new TypeToken<Einstellung>() {};
TypeToken<Abspieler> ttAbspieler = new TypeToken<Abspieler>() {};
TypeToken<Abspielliste> ttAbspielliste = new TypeToken<Abspielliste>() {};
+ TypeToken<Livestream> ttLivestream = new TypeToken<Livestream>() {};
+ TypeToken<Titel> ttTitel = new TypeToken<Titel>() {};
types = new HashMap();
types.put(Ablageort.class.getSimpleName(), ttAblageort);
types.put(Einstellung.class.getSimpleName(), ttEinstellung);
types.put(Abspieler.class.getSimpleName(), ttAbspieler);
types.put(Abspielliste.class.getSimpleName(), ttAbspielliste);
+ types.put(Titel.class.getSimpleName(), ttTitel);
+ types.put(Livestream.class.getSimpleName(), ttLivestream);
}
/**
@@ -127,12 +134,13 @@
public Entity entityFromFile(File file) throws ClassNotFoundException, FileNotFoundException, IOException {
String json = readFromFile(file);
+ logger.finer("json: " + json);
Gson gson = new Gson();
return gson.fromJson(json, typeFromName(typeNameFromPath(file)).getType());
}
private String typeNameFromPath(File file) {
- String[] parts = file.getPath().split(App.getRs(Server.RB_SLASH));
+ String[] parts = file.getPath().split(Server.SLASH);
return parts[parts.length-2];
}
--
Gitblit v1.9.3