[vlma-devel] commit: Add a function in the core to set the stream URL of a streamChannel . (Adrien Maglo )

git version control git at videolan.org
Tue May 20 14:38:04 CEST 2008


vlma | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue May 20 14:15:02 2008 +0200| [f0b85b4beb08c6376cc2ac900434e9fa991aa1c7]

Add a function in the core to set the stream URL of a streamChannel.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=f0b85b4beb08c6376cc2ac900434e9fa991aa1c7
---

 vlma-api/src/main/java/org/videolan/vlma/Data.java |    7 ++++
 .../src/main/java/org/videolan/vlma/DataImpl.java  |   30 +++++++++++++------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/Data.java b/vlma-api/src/main/java/org/videolan/vlma/Data.java
index 986c9c1..29f3515 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/Data.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/Data.java
@@ -342,6 +342,13 @@ public interface Data {
      */
     public void setFilesChannelServer(int filesChannel, String server);
 
+    /** Adds the stream URL to the StreamChannels
+    *
+    * @param streamChannel the StreamChannel
+    * @param URL the URL
+    */
+    public void setStreamChannelStreamURL(int streamChannel, String URL);
+
     /**
      * Updates the program associated to a media.
      *
diff --git a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
index bd0ea7c..f084192 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
@@ -68,6 +68,7 @@ import org.videolan.vlma.model.exception.SatelliteDoesNotExistException;
 import org.videolan.vlma.model.exception.ServerAlreadyExistsException;
 import org.videolan.vlma.model.exception.ServerDoesNotExistException;
 import org.videolan.vlma.model.media.FilesChannel;
+import org.videolan.vlma.model.media.StreamChannel;
 import org.videolan.vlma.model.media.Media;
 import org.videolan.vlma.model.media.SatChannel;
 import org.videolan.vlma.model.media.Satellite;
@@ -362,18 +363,22 @@ public class DataImpl implements Data {
 
     synchronized public Media getMedia(int media) {
         for (Media m : medias) {
-            if (m.getClass().equals(SatChannel.class)) {
-                if (((SatChannel) m).hashCode() == media) {
-                    return m;
-                }
-            } else if (m.getClass().equals(TNTChannel.class)) {
-                if (((TNTChannel) m).hashCode() == media) {
-                    return m;
-                }
-            } else if (m.getClass().equals(FilesChannel.class) && ((FilesChannel) m).hashCode() == media) {
+            if (m.getClass().equals(SatChannel.class) &&
+                    ((SatChannel) m).hashCode() == media) {
+                return m;
+            }
+            else if (m.getClass().equals(TNTChannel.class) &&
+                ((TNTChannel) m).hashCode() == media) {
+                return m;
+            }
+            else if (m.getClass().equals(FilesChannel.class) &&
+                    ((FilesChannel) m).hashCode() == media) {
+                return m;
+            }
+            else if (m.getClass().equals(StreamChannel.class) &&
+                    ((StreamChannel) m).hashCode() == media) {
                 return m;
             }
-
         }
         throw new MediaDoesNotExistException("Media " + media + " doesn't exist");
     }
@@ -431,6 +436,11 @@ public class DataImpl implements Data {
         ((FilesChannel)m).setServer(getServer(server));
     }
 
+    synchronized public void setStreamChannelStreamURL(int streamChannel, String URL)
+        throws MediaDoesNotExistException {
+        Media m = getMedia(streamChannel);
+        ((StreamChannel)m).setStreamURL(URL);
+    }
 
     /**
      * Extract data from a HTML row where, in each cell, several <br />



More information about the vlma-devel mailing list