summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2013-02-15 00:12:31 +0100
committerlado <herrlado@gmail.com>2013-02-15 00:12:31 +0100
commit7a3c58db8cd012d2017eb37e59f9630192b86377 (patch)
tree98fbe4bc8e63f1fa1561294511fd96744d40f00f
parentc1397b21b2952184d1262f94cde4d183f9408584 (diff)
downloadvdr-manager-7a3c58db8cd012d2017eb37e59f9630192b86377.tar.gz
vdr-manager-7a3c58db8cd012d2017eb37e59f9630192b86377.tar.bz2
Feature #1225
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java99
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java24
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java51
3 files changed, 104 insertions, 70 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index 84cc0d4..85394ba 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -13,9 +13,9 @@ import de.bjusystems.vdrmanager.data.db.DBAccess;
/**
* Class for all preferences
- *
+ *
* @author bju, lado
- *
+ *
*/
public class Preferences {
@@ -41,12 +41,12 @@ public class Preferences {
public int getCurrentVdrContext(Context context){
return getInteger(context, R.string.current_vdr_id_key, -1);
}
-
+
/** user defined epg search times */
private String epgSearchTimes;
/**
* format times AM/PM or 24H
- *
+ *
* @since 0.2
*/
private boolean use24hFormat;
@@ -137,7 +137,7 @@ public class Preferences {
/**
* Whether to send Packets to the custom broadcast address. It is used, if
* the address ist not empty
- *
+ *
* @return
* @since 0.2
*/
@@ -147,7 +147,7 @@ public class Preferences {
/**
* Getter for use24hFormat
- *
+ *
* @since 0.2
* @return
*/
@@ -157,7 +157,7 @@ public class Preferences {
/**
* Checks for connect using SSL
- *
+ *
* @return true, if use SSL connections
*/
public boolean isSecure() {
@@ -166,7 +166,7 @@ public class Preferences {
/**
* Retrieves the channel filtering mode
- *
+ *
* @return true, if channels will be filtered
*/
public boolean isFilterChannels() {
@@ -175,7 +175,7 @@ public class Preferences {
/**
* Last channel to receive
- *
+ *
* @return channel number
*/
public String getChannels() {
@@ -184,7 +184,7 @@ public class Preferences {
/**
* Gets the SVDRP host or IP address
- *
+ *
* @return SVDRP host
*/
public String getSvdrpHost() {
@@ -193,7 +193,7 @@ public class Preferences {
/**
* Gets the SVDRP port
- *
+ *
* @return SVDRP port
*/
public int getSvdrpPort() {
@@ -202,7 +202,7 @@ public class Preferences {
/**
* Gets the SVDRP password
- *
+ *
* @return SVDRO password
*/
public String getPassword() {
@@ -215,7 +215,7 @@ public class Preferences {
/**
* Checks for enables remote wakeup
- *
+ *
* @return true, if remote wakeup is enabled
*/
public boolean isWakeupEnabled() {
@@ -224,7 +224,7 @@ public class Preferences {
/**
* Gets the URL for the wakeup request
- *
+ *
* @return wakeup url
*/
public String getWakeupUrl() {
@@ -233,7 +233,7 @@ public class Preferences {
/**
* Gets the user for the wakeup url
- *
+ *
* @return user name
*/
public String getWakeupUser() {
@@ -242,7 +242,7 @@ public class Preferences {
/**
* Gets the password for the wakeup url
- *
+ *
* @return password
*/
public String getWakeupPassword() {
@@ -251,7 +251,7 @@ public class Preferences {
/**
* Checks for enabled alive check
- *
+ *
* @return true, if enabled
*/
public boolean isAliveCheckEnabled() {
@@ -268,7 +268,7 @@ public class Preferences {
/**
* Gets the time between alive checks
- *
+ *
* @return time in seconds
*/
public int getAliveCheckInterval() {
@@ -277,7 +277,7 @@ public class Preferences {
/**
* Gets the buffer before the event start
- *
+ *
* @return pre event buffer
*/
public int getTimerPreMargin() {
@@ -286,7 +286,7 @@ public class Preferences {
/**
* Gets the buffer after the event stop
- *
+ *
* @return post event buffer
*/
public int getTimerPostMargin() {
@@ -295,7 +295,7 @@ public class Preferences {
/**
* Gets the default priority
- *
+ *
* @return default priority
*/
public int getTimerDefaultPriority() {
@@ -304,7 +304,7 @@ public class Preferences {
/**
* Gets the default lifetime
- *
+ *
* @return default lifetime
*/
public int getTimerDefaultLifetime() {
@@ -313,7 +313,7 @@ public class Preferences {
/**
* Gets the time values for the epg search
- *
+ *
* @return
*/
public String getEpgSearchTimes() {
@@ -322,7 +322,7 @@ public class Preferences {
/**
* gets the MAC Address of the vdr host
- *
+ *
* @return
* @since 0.2
*/
@@ -332,7 +332,7 @@ public class Preferences {
/**
* Gets the selection which wakeup method to use
- *
+ *
* @return
* @since 0.2
*/
@@ -342,7 +342,7 @@ public class Preferences {
/**
* Getter for streaming port
- *
+ *
* @return
* @since 02.
*/
@@ -352,7 +352,7 @@ public class Preferences {
/**
* Getter for selected streaming format
- *
+ *
* @return
* @since 0.2
*/
@@ -362,7 +362,7 @@ public class Preferences {
/**
* Sets the time values for the epg search
- *
+ *
* @param epgSearchTimes
* new time values
*/
@@ -381,7 +381,7 @@ public class Preferences {
/**
* Gets the name for the file which preferences will be saved into
- *
+ *
* @param context
* Context
* @return filename
@@ -392,7 +392,7 @@ public class Preferences {
/**
* Show Channel Numbers in the overviews
- *
+ *
* @since 0.2
* @return
*/
@@ -402,7 +402,7 @@ public class Preferences {
/**
* getter
- *
+ *
* @return
*/
public boolean isEnableRemux() {
@@ -411,7 +411,7 @@ public class Preferences {
/**
* getter
- *
+ *
* @return
*/
public String getRemuxCommand() {
@@ -420,7 +420,7 @@ public class Preferences {
/**
* getter
- *
+ *
* @return
*/
public String getRemuxParameter() {
@@ -429,7 +429,7 @@ public class Preferences {
/**
* getter
- *
+ *
* @return
*/
public boolean isQuiteOnBackButton() {
@@ -438,17 +438,22 @@ public class Preferences {
/**
* Gets the previous loaded preferences
- *
+ *
* @return preferences
*/
public static Preferences getPreferences() {
return thePrefs;
}
+ public String getRecStreamMethod(){
+ return getCurrentVdr().getRecStreamMethod();
+ }
+
+
/**
- *
+ *
* Gets the previous loaded preferences, same as getPreferences();
- *
+ *
* @return
*/
public static Preferences get() {
@@ -501,7 +506,7 @@ public class Preferences {
}
public static boolean initVDR(final Context context) {
-
+
if (current != null) {
return true;
}
@@ -513,8 +518,8 @@ public class Preferences {
vdr = DBAccess.get(context).getVdrDAO().queryForId(id);
}
- setCurrentVdr(context, vdr);
-
+ setCurrentVdr(context, vdr);
+
if (vdr != null) {
return true;
}
@@ -525,7 +530,7 @@ public class Preferences {
setCurrentVdr(context, vdr);
return true;
}
-
+
return initFromOldVersion(context);
//Intent intent = new Intent();
//intent.setClass(context, VdrListActivity.class);
@@ -537,7 +542,7 @@ public class Preferences {
/**
* Loads all preferences
- *
+ *
* @param context
* Context
* @return Preferences
@@ -633,7 +638,7 @@ public class Preferences {
/**
* Gets the persistent preferences
- *
+ *
* @param context
* Context
* @return preferences
@@ -645,7 +650,7 @@ public class Preferences {
/**
* Helper for retrieving integer values from preferences
- *
+ *
* @param context
* Context
* @param resId
@@ -665,7 +670,7 @@ public class Preferences {
/**
* Helper for retrieving boolean values from preferences
- *
+ *
* @param context
* Context
* @param resId
@@ -682,7 +687,7 @@ public class Preferences {
/**
* Helper for retrieving string values from preferences
- *
+ *
* @param context
* Context
* @param resId
@@ -712,7 +717,7 @@ public class Preferences {
/**
* Set locale read from preferences to context.
- *
+ *
* @param context
* {@link Context}
*/
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
index 26c3ca4..94a60f7 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
@@ -9,7 +9,7 @@ import de.bjusystems.vdrmanager.app.C;
import static de.bjusystems.vdrmanager.gui.Utils.mapSpecialChars;
public class Recording extends Event{
-
+
public Recording(String line) {
final String[] words = StringUtils.splitPreserveAllTokens(line, C.DATA_SEPARATOR);
int idx = 0;
@@ -28,16 +28,30 @@ public class Recording extends Event{
if(idx < words.length){
realDuration = Long.parseLong(words[idx++]) * 1000;
}
+
+ if(idx < words.length){
+ devInode = mapSpecialChars(words[idx++]);
+ }
}
-
+
private String fileName;
private int fileSize;
-
+
private int index;
-
+
private long realDuration = -1;
+ private String devInode = null;
+
+ public String getDevInode() {
+ return devInode;
+ }
+
+ public void setDevInode(String devInode) {
+ this.devInode = devInode;
+ }
+
/**
* in millis
* @return
@@ -45,7 +59,7 @@ public class Recording extends Event{
public long getRealDuration() {
return realDuration;
}
-
+
public long getDuration(){
if(realDuration != -1){
return realDuration;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index 842de8a..bd3dc7a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -27,6 +27,7 @@ import android.util.Pair;
import android.view.Gravity;
import android.widget.Toast;
import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.StringUtils;
import de.bjusystems.vdrmanager.app.C;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Event;
@@ -249,9 +250,6 @@ public class Utils {
return minuts;
}
-
-
-
public static void shareEvent(Activity activity, Event event) {
final Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
@@ -275,8 +273,7 @@ public class Utils {
activity.getString(R.string.share_chooser)));
}
-
- public static void addCalendarEvent(Activity activity, Event event){
+ public static void addCalendarEvent(Activity activity, Event event) {
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", event.getTitle());
@@ -286,7 +283,6 @@ public class Utils {
activity.startActivity(intent);
}
-
public static String mapSpecialChars(String src) {
if (src == null) {
return "";
@@ -323,21 +319,40 @@ public class Utils {
return false;
}
- public static void streamRecording(Activity ctx, Recording rec) {
+ private static String getRecordingStream(Activity ctx, Recording rec) {
+
+ String m = Preferences.get().getRecStreamMethod();
StringBuilder url = new StringBuilder();
- url.append("http://")
- .append(Preferences.get().getSvdrpHost())
- //
- .append(":")
- .append(Integer.valueOf(Preferences.get().getLivePort()))
- //
- .append("/recstream.html?recid=recording_")
- .append(Utils.md5(rec.getFileName()));
- // http://192.168.1.119:8008/b0cdedeed2d36508dfd924f0876a851b
- String urlstring = url.toString();
+
+ if (StringUtils.equals(m, "vdr-live")) {
+ url.append("http://")
+ .append(Preferences.get().getSvdrpHost())
+ //
+ .append(":")
+ .append(Integer.valueOf(Preferences.get().getLivePort()))
+ //
+ .append("/recstream.html?recid=recording_")
+ .append(Utils.md5(rec.getFileName()));
+ // http://192.168.1.119:8008/b0cdedeed2d36508dfd924f0876a851b
+ String urlstring = url.toString();
+ return urlstring;
+ } else if (StringUtils.equals(m, "vdr-streamdev")) {
+ url.append("http://")
+ .append(Preferences.get().getSvdrpHost())
+ //
+ .append(":")
+ .append(Integer.valueOf(Preferences.get().getStreamPort()))
+ //
+ .append("/").append(rec.getDevInode());
+ }
+ return url.toString();
+ }
+
+ public static void streamRecording(Activity ctx, Recording rec) {
+ String urlstring = getRecordingStream(ctx, rec);
Log.d(TAG, "try stream: " + urlstring);
- Utils.startStream(ctx, url.toString());
+ Utils.startStream(ctx, urlstring);
}
public static void switchTo(final Context ctx, final Channel channel) {