merged with 1.1
[mir.git] / source / mircoders / media / MediaHandlerMp3.java
index 582556a..a1e5c1b 100755 (executable)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
  *\r
  * This file is part of Mir.\r
  *\r
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
  *\r
  * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
+ * the code of this program with  any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two.  You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries.  If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
  */\r
-\r
 package  mircoders.media;\r
 \r
 import java.io.StringReader;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Vector;\r
 \r
 import mir.entity.Entity;\r
 import mir.log.LoggerWrapper;\r
+import mir.media.MediaExc;\r
+import mir.media.MediaFailure;\r
 import mir.media.MirMedia;\r
-import mir.media.MirMediaException;\r
 import mir.misc.FileUtil;\r
 import mir.misc.StringUtil;\r
-import freemarker.template.SimpleHash;\r
-import freemarker.template.SimpleList;\r
 \r
 /**\r
  * Please note: this media handler produces\r
@@ -66,7 +67,7 @@ import freemarker.template.SimpleList;
  *\r
  * @see mir.media.MirMedia\r
  * @author mh <mh@nadir.org>\r
- * @version $Id: MediaHandlerMp3.java,v 1.12 2003/03/05 19:23:16 idfx Exp $\r
+ * @version $Id: MediaHandlerMp3.java,v 1.16 2003/09/03 18:29:04 zapata Exp $\r
  */\r
 \r
 public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia\r
@@ -77,7 +78,7 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
     logger = new LoggerWrapper("Media.Audio.Mp3");\r
   }\r
 \r
-  public void produce(Entity ent, Entity mediaTypeEnt) throws MirMediaException {\r
+  public void produce(Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {\r
 \r
     // first check if the file exists\r
     super.produce(ent, mediaTypeEnt);\r
@@ -100,12 +101,13 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
     }\r
     catch (Throwable e) {\r
       logger.error("MediaHandlerMp3.produce: " + e.toString());\r
-      throw new MirMediaException(e.toString());\r
+\r
+      throw new MediaFailure(e);\r
     }\r
   }\r
 \r
-  public SimpleList getURL(Entity ent, Entity mediaTypeEnt) {\r
-    SimpleList theList = new SimpleList();\r
+  public List getURL(Entity ent, Entity mediaTypeEnt) {\r
+    List theList = new Vector();\r
 \r
     //String stringSize = ent.getValue("size");\r
     //int size = Integer.parseInt(stringSize, 10)/1024;\r
@@ -116,13 +118,13 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
 \r
     // @todo the texts ("title") below urgently need to be sanely localizaeble\r
     // somehow\r
-    SimpleHash m3uHash = new SimpleHash();\r
+    Map m3uHash = new HashMap();\r
     m3uHash.put("publish_path", basePath + ".m3u");\r
     m3uHash.put("publish_server", ent.getValue("publish_server"));\r
     m3uHash.put("title", "stream URL");\r
     theList.add(m3uHash);\r
 \r
-    SimpleHash plsHash = new SimpleHash();\r
+    Map plsHash = new HashMap();\r
     plsHash.put("publish_path", basePath + ".pls");\r
     plsHash.put("publish_server", ent.getValue("publish_server"));\r
     plsHash.put("title", "playlist URL");\r