diff options
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java index bb9e0a7..29215e4 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java @@ -1,21 +1,27 @@ package de.bjusystems.vdrmanager.data; - public class Channel { private final int number; private final String name; + private final String provider; public Channel(final String channelData) { - - final String[] words = channelData.split(":"); + String[] words = channelData.split(":"); this.number = Integer.valueOf(words[0].substring(1)); - this.name = words[1]; + if (words.length > 2) { + this.name = words[1]; + this.provider = words[2]; + } else { + this.name = words[1]; + this.provider = "Unknown"; + } } public Channel() { this.number = 0; this.name = "Unknown"; + this.provider = "Unknown"; } public boolean isGroupSeparator() { @@ -30,12 +36,18 @@ public class Channel { return name; } + public String getProvider() { + return provider; + } + @Override public String toString() { final StringBuilder text = new StringBuilder(); text.append(number); text.append(" - "); text.append(name); + text.append(" : "); + text.append(provider); return text.toString(); } } |