summaryrefslogtreecommitdiff
path: root/vdrmanager/src/de
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager/src/de')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/BaseEvent.java25
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java3
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/EventListItem.java87
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java22
6 files changed, 80 insertions, 60 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/BaseEvent.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/BaseEvent.java
index 43789ca..b044b1a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/BaseEvent.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/BaseEvent.java
@@ -6,7 +6,6 @@ import android.text.TextUtils;
public abstract class BaseEvent implements Event {
- protected Event event;
protected String channelNumber;
protected String channelName;
protected String title;
@@ -14,15 +13,19 @@ public abstract class BaseEvent implements Event {
protected String description;
protected Date start;
protected Date stop;
-
- public Event getEvent() {
- return event;
+
+ public BaseEvent(){
+
}
- public void setEvent(Event event) {
- this.event = event;
+ public Timer createTimer() {
+ return new Timer(this);
}
-
+
+ public TimerState getTimerState() {
+ return TimerState.None;
+ }
+
public void setChannelNumber(String channelNumber) {
this.channelNumber = channelNumber;
}
@@ -52,7 +55,13 @@ public abstract class BaseEvent implements Event {
}
public BaseEvent(Event event) {
- this.event = event;
+ channelNumber = event.getChannelNumber();
+ channelName = event.getChannelName();
+ title = event.getTitle();
+ shortText = event.getShortText();
+ description = event.getDescription();
+ start = event.getStart();
+ stop = event.getStop();
}
public String getChannelNumber() {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
index d9d07b0..079fcf0 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
@@ -11,10 +11,7 @@ public class Epg extends BaseEvent {
private Timer timer;
public Epg(final String line) {
- super(null);
-
final String[] words = line.split(":");
-
channelNumber = words[0].substring(1);
channelName = words[1];
start = new Date(Long.parseLong(words[2])*1000);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java
index 8bf9270..62805a2 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Event.java
@@ -20,5 +20,5 @@ public interface Event {
String getShortText();
Date getStart();
Date getStop();
- TimerState getTimerState();
+// TimerState getTimerState();
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/EventListItem.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/EventListItem.java
index 18829f5..995a55b 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/EventListItem.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/EventListItem.java
@@ -1,21 +1,47 @@
package de.bjusystems.vdrmanager.data;
-import java.util.Date;
-
import de.bjusystems.vdrmanager.gui.Utils;
+/**
+ * @author lado
+ *
+ * TODO auf Event Interface umstellen und die Aufrufen an event delegieren. Das hier ist nicht gut.
+ */
public class EventListItem extends BaseEvent {
+
+ Event event;
+
+ public Event getEvent() {
+ return event;
+ }
+
+ public void setEvent(Event event) {
+ this.event = event;
+ }
+
private final Recording rec;
private final Timer timer;
private final Epg epg;
private final String header;
+//
+// public EventListItem(final Event event){
+// if(event instanceof Recording){
+// this((Recording)event);
+// } else if (event instanceof Timer){
+// this((Timer)event);
+// } else {
+// this((Epg)event);
+// }
+// throw new IllegalArgumentException("Uknown event type " + event);
+// }
public EventListItem(final Recording rec) {
super(rec);
+ event = rec;
this.header = null;
this.rec = rec;
this.epg = null;
@@ -24,6 +50,7 @@ public class EventListItem extends BaseEvent {
public EventListItem(final Timer timer) {
super(timer);
+ event = timer;
this.header = null;
this.timer = timer;
this.epg = null;
@@ -32,14 +59,22 @@ public class EventListItem extends BaseEvent {
public EventListItem(final Epg epg) {
super(epg);
+ event = epg;
this.header = null;
this.timer = null;
this.epg = epg;
this.rec = null;
}
+
+ @Override
+ public TimerState getTimerState() {
+ if(epg != null){
+ return epg.getTimerState();
+ }
+ return super.getTimerState();
+ }
public EventListItem(final String header) {
- super(null);
this.header = header;
this.timer = null;
this.epg = null;
@@ -54,38 +89,11 @@ public class EventListItem extends BaseEvent {
return timer != null;
}
- public Date getStart() {
- return event != null ? event.getStart() : null;
- }
-
- public Date getStop() {
- return event != null ? event.getStop() : null;
- }
-
- public String getChannelNumber() {
- return event != null ? event.getChannelNumber() : null;
- }
-
- public String getChannelName() {
- return event != null ? event.getChannelName() : null;
- }
-
- public String getTitle() {
- return event != null ? event.getTitle() : null;
- }
-
- public String getDescription() {
- return event != null ? event.getDescription() : null;
- }
public String getHeader() {
return header;
}
- public TimerState getTimerState() {
- return event != null ? event.getTimerState() : TimerState.None;
- }
-
public Timer getTimer() {
return timer;
}
@@ -94,12 +102,12 @@ public class EventListItem extends BaseEvent {
return epg;
}
- public Event getEvent() {
- return event;
- }
-
+// public Event getEvent() {
+// return event;
+// }
+//
public boolean isLive(){
- return Utils.isLive(event);
+ return Utils.isLive(this);
}
@Override
@@ -108,16 +116,13 @@ public class EventListItem extends BaseEvent {
return "Header: " + header;
}
- final EventFormatter formatter = new EventFormatter(event);
+ final EventFormatter formatter = new EventFormatter(this);
final StringBuilder text = new StringBuilder();
text.append(isTimer() ? "Timer: " : "Event: ");
- text.append("Channel: ").append(event.getChannelNumber());
- text.append(" (").append(event.getChannelName()).append("), ");
+ text.append("Channel: ").append(getChannelNumber());
+ text.append(" (").append(getChannelName()).append("), ");
text.append("Zeit: ").append(formatter.getDate()).append(" ").append(formatter.getTime());
return text.toString();
}
- public String getShortText() {
- return event != null ? event.getShortText() : null;
- }
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
index f9eeecb..c0481f7 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
@@ -6,7 +6,6 @@ import java.util.Date;
public class Recording extends BaseEvent{
public Recording(String line) {
- super(null);
final String[] words = line.split(":");
start = new Date(Long.parseLong(words[0])*1000);
stop = new Date(Long.parseLong(words[1]) * 1000);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
index 20a0975..d357d5a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
@@ -4,6 +4,8 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
+import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation;
+
/**
* Class for timer data
* @author bju
@@ -27,7 +29,6 @@ public class Timer extends BaseEvent {
* @param channels list of channels
*/
public Timer(final String timerData) {
- super(null);
final String[] values = timerData.split(":");
@@ -49,12 +50,19 @@ public class Timer extends BaseEvent {
// title and description
this.title = values[8];
+
this.description = values.length > 9 ? values[9] : "";
+
+ this.shortText = values.length > 10 ? values[10] : "";
+
+ if(values.length > 11){
+ this.description = values[11];
+ }
+
+
}
- public Timer(final Epg event) {
- super(event);
-
+ public Timer(final Event event) {
final Preferences prefs = Preferences.getPreferences();
this.number = 0;
@@ -71,7 +79,7 @@ public class Timer extends BaseEvent {
this.description = event.getDescription();
}
- public String toCommandLine() {
+ public String toCommandLine(TimerOperation op) {
final StringBuilder line = new StringBuilder();
@@ -90,7 +98,9 @@ public class Timer extends BaseEvent {
line.append(priority).append(":");
line.append(lifetime).append(":");
line.append(title).append(":");
- line.append(description);
+ if(op != TimerOperation.DELETE){
+ line.append(description);
+ }
return line.toString();
}