public class MediaHandlerRealAudio extends MediaHandlerAudio implements
MirMedia
{
- public void produce (Entity ent, Entity mediaTypeEnt )
- throws MirMediaException {
-
- // first see if the file exists
- super.produce(ent, mediaTypeEnt);
-
- String baseName = ent.getId();
- String date = ent.getValue("date");
- String datePath = StringUtil.webdbDate2path(date);
- String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
- String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
-
- String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
- String RealMediaFile = datePath+ent.getId()+".ram";
- try {
- //write an rm (ram?. -mh) file
- FileUtil.write(super.getStoragePath()+"/"+RealMediaFile,
- RealMediaPointer.getBytes());
- } catch (Exception e) {
- theLog.printError(e.toString());
- throw new MirMediaException(e.toString());
- }
- }
-
- public String getStoragePath()
- {
- return MirConfig.getProp("Producer.RealMedia.Path");
- }
-
- public String getDescr()
- {
- return "RealMedia Audio";
+ public void produce (Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
+
+ // first see if the file exists
+ super.produce(ent, mediaTypeEnt);
+
+ String baseName = ent.getId();
+ String date = ent.getValue("date");
+ String datePath = StringUtil.webdbDate2path(date);
+ String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
+ String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
+
+ String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
+ String RealMediaFile = datePath+ent.getId()+".ram";
+ try {
+ //write an rm (ram?. -mh) file
+ FileUtil.write(super.getStoragePath()+"/"+RealMediaFile,
+ RealMediaPointer.getBytes());
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
+ }
+
+ public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
+ {
+ SimpleList theList = new SimpleList();
+
+ //String stringSize = ent.getValue("size");
+ //int size = Integer.parseInt(stringSize, 10)/1024;
+ theList.add(ent);
+
+ String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"),
+ ".ra$","");
+
+ // @todo the texts ("title") below urgently need to be sanely localizaeble
+ // somehow
+ SimpleHash ramHash = new SimpleHash();
+ ramHash.put("publish_path", basePath+".ram");
+ ramHash.put("publish_server", ent.getValue("publish_server"));
+ ramHash.put("title", "stream URL");
+ theList.add(ramHash);
+
+ return theList;
+
+ }
+
+ public String getStoragePath()
+ {
+ return MirConfig.getProp("Producer.RealMedia.Path");
+ }
+
+ public String getDescr()
+ {
+ return "RealMedia Audio";
+ }
}
public class MediaHandlerRealVideo extends MediaHandlerVideo implements
MirMedia
{
- public void produce (Entity ent, Entity mediaTypeEnt )
- throws MirMediaException {
-
- // first see if the file exists
- super.produce(ent, mediaTypeEnt);
-
- String baseName = ent.getId();
- String date = ent.getValue("date");
- String datePath = StringUtil.webdbDate2path(date);
- String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
- String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
-
- String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
- String RealMediaFile = datePath+ent.getId()+".ram";
- try {
- //write an rm (ram?. -mh) file
- FileUtil.write(super.getStoragePath()+"/"+RealMediaFile,
- RealMediaPointer.getBytes());
- } catch (Exception e) {
- theLog.printError(e.toString());
- throw new MirMediaException(e.toString());
- }
- }
-
- public String getStoragePath()
- {
- return MirConfig.getProp("Producer.RealMedia.Path");
- }
-
- public String getDescr()
- {
- return "RealMedia Video";
+ public void produce (Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
+
+ // first see if the file exists
+ super.produce(ent, mediaTypeEnt);
+
+ String baseName = ent.getId();
+ String date = ent.getValue("date");
+ String datePath = StringUtil.webdbDate2path(date);
+ String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
+ String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
+
+ String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
+ String RealMediaFile = datePath+ent.getId()+".ram";
+ try {
+ //write an rm (ram?. -mh) file
+ FileUtil.write(super.getStoragePath()+"/"+RealMediaFile,
+ RealMediaPointer.getBytes());
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
+ }
+
+ public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
+ {
+ SimpleList theList = new SimpleList();
+
+ //String stringSize = ent.getValue("size");
+ //int size = Integer.parseInt(stringSize, 10)/1024;
+ theList.add(ent);
+
+ String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"),
+ ".rm$","");
+
+ // @todo the texts ("title") below urgently need to be sanely localizaeble
+ // somehow
+ SimpleHash ramHash = new SimpleHash();
+ ramHash.put("publish_path", basePath+".ram");
+ ramHash.put("publish_server", ent.getValue("publish_server"));
+ ramHash.put("title", "stream URL");
+ theList.add(ramHash);
+
+ return theList;
+
+ }
+
+ public String getStoragePath()
+ {
+ return MirConfig.getProp("Producer.RealMedia.Path");
+ }
+
+ public String getDescr()
+ {
+ return "RealMedia Video";
+ }
}