import java.util.*;
+import freemarker.template.SimpleList;
+
import mir.entity.*;
/**
* @see mir.entity.Entity
* @see mir.misc.StringUtil
*/
- public abstract String getURL (Entity ent, Entity mediaTypeEnt)
+ public abstract SimpleList getURL (Entity ent, Entity mediaTypeEnt)
throws MirMediaException;
/**
String returnValue=null;
if (key!=null) {
- if (key.equals("url"))
- returnValue=getUrl();
+ if (key.equals("big_icon"))
+ returnValue=getBigIcon();
else if (key.equals("list"))
returnValue=getListView();
else
public TemplateModel get(java.lang.String key) throws TemplateModelException
{
+ if (key.equals("url"))
+ return getUrl();
+
return new SimpleScalar(getValue(key));
}
- private String getUrl()
+ private String getBigIcon()
+ {
+ MirMedia mediaHandler=null;
+ Entity mediaType=null;
+
+ try {
+ mediaType = getMediaType();
+ mediaHandler = MediaHelper.getHandler( mediaType );
+ return mediaHandler.getBigIcon();
+ } catch (Exception ex) {
+ theLog.printWarning("-- getBigIcon: could not fetch data "
+ + this.getClass().toString()+" "+ ex.toString());
+ }
+ return null;
+ }
+
+ private SimpleList getUrl()
{
MirMedia mediaHandler=null;
Entity mediaType=null;
import java.util.*;
import java.io.*;
+import freemarker.template.SimpleList;
+
import mir.media.*;
import mir.entity.*;
import mir.misc.*;
return "Generic media";
}
- public String getURL(Entity ent, Entity mediaTypeEnt)
+ public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
{
- String stringSize = ent.getValue("size");
- if (stringSize == null)
- return null;
- int size = Integer.parseInt(stringSize, 10)/1024;
- String title = ent.getValue("title")+
- " - "+mediaTypeEnt.getValue("name")+" "+
- size+" KB";
- return StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+
- ent.getValue("publish_path"), title, imageRoot, getBigIcon());
+ SimpleList theList = new SimpleList();
+ theList.add(ent);
+ return theList;
}
public String getListView(Entity ent, Entity mediaTypeEnt)
//String title = ent.getValue("title")+
// " - "+mediaTypeEnt.getValue("name")+" "+
// ent.getValue("size")+" Bytes";
- return StringUtil.createIMGLinks(imageHost+
- getBigIcon(), null, null, null);
+ return getBigIcon();
}
public boolean isVideo()
import java.util.*;
import java.lang.reflect.*;
+import freemarker.template.SimpleList;
+
import mir.media.*;
import mir.misc.*;
import mir.entity.*;
return icon_data;
}
- public String getURL(Entity ent, Entity mediaTypeEnt)
- {
- String title = ent.getValue("title");
- return StringUtil.createIMGLinks(ent.getValue("publish_server")+
- ent.getValue("publish_path"), title, ent.getValue("img_height"),
- ent.getValue("img_width"));
- }
-
public String getListView(Entity ent, Entity mediaTypeEnt)
{
//String title = ent.getValue("title");
null, ent.getValue("icon_height"), ent.getValue("icon_width"));
}
+ public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
+ {
+ SimpleList theList = new SimpleList();
+ theList.add(ent);
+ return theList;
+ }
+
public String getStoragePath()
{
return MirConfig.getProp("Producer.Image.Path");
import java.util.*;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleHash;
+
import mir.media.*;
import mir.entity.*;
import mir.misc.*;
}
}
- public String getURL(Entity ent, Entity mediaTypeEnt)
+ public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
{
- String stringSize = ent.getValue("size");
- if (stringSize == null)
- return null;
- int size = Integer.parseInt(stringSize, 10)/1024;
- String rawTitle = ent.getValue("title")+
- " - "+mediaTypeEnt.getValue("name")+" "+
- size+" KB "+"download";
- String m3uTitle = ent.getValue("title")+
- " - "+mediaTypeEnt.getValue("name")+" "+
- "streaming URL";
- String plsTitle = ent.getValue("title")+
- " - "+mediaTypeEnt.getValue("name")+" "+
- "playlist URL";
-
- String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"), ".mp3$","");
-
- String m3uURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+basePath+".m3u", m3uTitle, imageRoot, getBigIcon());
- String plsURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+basePath+".pls", plsTitle, imageRoot, getBigIcon());
- String rawURL = StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+ent.getValue("publish_path"), rawTitle, imageRoot, getBigIcon());
-
- return m3uURL+"\n<p>"+plsURL+"\n<p>"+rawURL;
-
- }
+ 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"),
+ ".mp3$","");
+
+ // @todo the texts ("title") below urgently need to be sanely localizaeble
+ // somehow
+ SimpleHash m3uHash = new SimpleHash();
+ m3uHash.put("publish_path", basePath+".m3u");
+ m3uHash.put("publish_server", ent.getValue("publish_server"));
+ m3uHash.put("title", "stream URL");
+ theList.add(m3uHash);
+
+ SimpleHash plsHash = new SimpleHash();
+ plsHash.put("publish_path", basePath+".pls");
+ plsHash.put("publish_server", ent.getValue("publish_server"));
+ plsHash.put("title", "playlist URL");
+ theList.add(plsHash);
+
+ return theList;
+
+ }
}
import java.util.*;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleHash;
+
import mir.media.*;
import mir.entity.*;
import mir.misc.*;
}
}
- public String getURL(Entity ent, Entity mediaTypeEnt)
+ public String getStoragePath()
{
- int size = Integer.parseInt(ent.getValue("size"), 10)/1024;
- String title = ent.getValue("title")+" - "+mediaTypeEnt.getValue("name")+
- " "+size+" KB";
- return StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+
- ent.getValue("publish_path"), title, imageRoot, getBigIcon());
- }
-
- public String getStoragePath() {
return MirConfig.getProp("Producer.RealMedia.Path");
}
import java.util.*;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleHash;
+
import mir.media.*;
import mir.entity.*;
import mir.misc.*;
}
}
- public String getURL(Entity ent, Entity mediaTypeEnt)
+ public String getStoragePath()
{
- int size = Integer.parseInt(ent.getValue("size"), 10)/1024;
- String title = ent.getValue("title")+" - "+mediaTypeEnt.getValue("name")+
- " "+size+" KB";
- return StringUtil.createURLLinks(ent.getValue("publish_server")+"/"+
- ent.getValue("publish_path"), title, imageRoot, getBigIcon());
- }
-
- public String getStoragePath() {
return MirConfig.getProp("Producer.RealMedia.Path");
}
<h2>${data.content.title}</h2>
<h4><i>${data.content.creator}, ${data.content.webdb_create_formatted}</i></h4>
<p><b>${data.content.description_parsed}</b>
- <!-- media -->
- <list data.content.to_media_audio as media>
- <p>
- ${media["url"]}
- </p>
+ <!-- media -->
+ <list data.content.to_media_audio as media>
+ <list media["url"] as audio>
+ <p>
+ <img src="/img/${media["big_icon"]}" border="0" alt="">
+ <a href="${audio["publish_server"]}${audio["publish_path"]}">
+ ${audio["title"]}</a>
+ </p>
</list>
- <list data.content.to_media_video as media>
- <p>
- ${media["url"]}
- </p>
- </list>
- <list data.content.to_media_other as media>
- <p>
- ${media["url"]}
- </p>
- </list>
- <list data.content.to_media_images as media>
- <p> I
- ${media["url"]}
- </p>
- </list>
- <!-- media -->
- <p>${data.content.content_data_parsed}</p>
- <if content.creator_main_url || content.creator_email>
+ </list>
+ <list data.content.to_media_video as media>
+ <list media["url"] as video>
+ <p>
+ <img src="/img/${media["big_icon"]}" border="0" alt="">
+ <a href="${video["publish_server"]}${video["publish_path"]}">
+ ${video["title"]}</a>
+ </p>
+ </list>
+ </list>
+ <list data.content.to_media_other as media>
+ <list media["url"] as other>
+ <p>
+ <img src="/img/${media["big_icon"]}" border="0" alt="">
+ <a href="${other["publish_server"]}${other["publish_path"]}">
+ ${other["title"]}</a>
+ </p>
+ </list>
+ </list>
+ <list data.content.to_media_images as media>
+ <list media["url"] as image>
+ <p>
+ <img src="${image["publish_server"]}${image["publish_path"]}"
+ border="0" width="${image["img_width"]}"
+ height="${image["img_width"]}" alt="${image["title"]}">
+ <br><i>${image["title"]}</i>
+ </p>
+ </list>
+ </list>
+ <!-- media -->
+ <p>${data.content.content_data_parsed}</p>
+ <if content.creator_main_url || content.creator_email>
<table width="100%" bgcolor="#FFFFFF">
<tr>
<td>