summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2014-07-21 22:27:50 +0200
committerlado <herrlado@gmail.com>2014-07-21 22:37:54 +0200
commit2228571dc552f469e85a0e02cde72ffb6f83c06b (patch)
tree6569b0d3e383b752fa3f2d06594188a0d9021cbb
parent99e029bd637a3c961bc466d5e6745d1b5c83e0ab (diff)
downloadvdr-manager-2228571dc552f469e85a0e02cde72ffb6f83c06b.tar.gz
vdr-manager-2228571dc552f469e85a0e02cde72ffb6f83c06b.tar.bz2
vdr-plugin-vdrmanager-0.12
-rw-r--r--vdrmanager/AndroidManifest.xml4
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java81
2 files changed, 79 insertions, 6 deletions
diff --git a/vdrmanager/AndroidManifest.xml b/vdrmanager/AndroidManifest.xml
index a199013..656e210 100644
--- a/vdrmanager/AndroidManifest.xml
+++ b/vdrmanager/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.bjusystems.vdrmanager"
- android:versionCode="1291"
- android:versionName="12.9" >
+ android:versionCode="12110"
+ android:versionName="12.11" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
index c999bba..d1ae085 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
@@ -4,9 +4,9 @@ import static de.bjusystems.vdrmanager.gui.Utils.mapSpecialChars;
import java.util.Date;
-import android.text.TextUtils;
import de.bjusystems.vdrmanager.StringUtils;
import de.bjusystems.vdrmanager.app.C;
+import de.bjusystems.vdrmanager.gui.Utils;
public class Recording extends Event {
@@ -15,7 +15,7 @@ public class Recording extends Event {
public static final String FOLDERDELIMCHAR = "~";
public Recording(String line) {
- final String[] words = StringUtils.splitPreserveAllTokens(line,
+ String[] words = StringUtils.splitPreserveAllTokens(line,
C.DATA_SEPARATOR);
int idx = 0;
index = Integer.valueOf(words[idx++]);
@@ -26,7 +26,81 @@ public class Recording extends Event {
shortText = mapSpecialChars(words[idx++]);
description = mapSpecialChars(words[idx++]);
fileName = mapSpecialChars(words[idx++]);
- fileSize = Integer.valueOf(words[idx++]);
+ try {
+ fileSize = Integer.valueOf(words[idx++]);
+ } catch (NumberFormatException ex) {
+
+ /************** TEMPORARY TO FIX THE BUG UNTIL Server's 0.13 */
+
+ int offset = 0;
+ int count = 0;
+ while(offset != -1){
+ offset = line.indexOf(":", offset + 1);
+ count++;
+ if(count == 5){
+ words = StringUtils.splitPreserveAllTokens(line.substring(0, offset) + Utils.unMapSpecialChars(":") + line.substring(offset+1),
+ C.DATA_SEPARATOR);
+ break;
+ }
+ }
+
+ idx = 0;
+ index = Integer.valueOf(words[idx++]);
+ start = new Date(Long.parseLong(words[idx++]) * 1000);
+ stop = new Date(Long.parseLong(words[idx++]) * 1000);
+ channelName = mapSpecialChars(words[idx++]);
+ title = mapSpecialChars(words[idx++]);
+ shortText = mapSpecialChars(words[idx++]);
+ description = mapSpecialChars(words[idx++]);
+ fileName = mapSpecialChars(words[idx++]);
+ fileSize = Integer.valueOf(words[idx++]);
+
+ if (idx < words.length) {
+ channelId = words[idx++];
+ }
+ if (idx < words.length) {
+ realDuration = Long.parseLong(words[idx++]) * 1000;
+ }
+
+ if (idx < words.length) {
+ devInode = mapSpecialChars(words[idx++]);
+ }
+
+ if (idx < words.length) { // timer
+ String data = words[idx++];
+ if (data != null && data.length() > 0) {
+ timerStopTime = new Date(Long.parseLong(data) * 1000L);
+ }
+ }
+
+ if (idx < words.length) { // name
+ String titleRaw = mapSpecialChars(words[idx++]);
+ int idxdel = titleRaw.lastIndexOf(FOLDERDELIMCHAR);
+ if (idxdel == -1) {
+ title = titleRaw;
+ folder = ROOT_FOLDER;
+ } else {
+ title = titleRaw.substring(idxdel + 1);
+ String foldersRaw = titleRaw.substring(0, idxdel);
+ folder = foldersRaw;
+
+ }
+ } else {
+ folder = ROOT_FOLDER;
+ }
+
+ if (idx < words.length) {
+ if (words[idx++].equals("1")) {
+ neww = true;
+ }
+ }
+ if (title.charAt(0) == '%') {
+ cut = true;
+ title = title.substring(1);
+ }
+ return;
+ }
+
if (idx < words.length) {
channelId = words[idx++];
}
@@ -176,7 +250,6 @@ public class Recording extends Event {
return cut;
}
-
public boolean isNeww() {
return neww;
}