From: <fg...@us...> - 2009-04-23 17:13:43
|
Revision: 1166 http://openutils.svn.sourceforge.net/openutils/?rev=1166&view=rev Author: fgiust Date: 2009-04-23 17:13:28 +0000 (Thu, 23 Apr 2009) Log Message: ----------- handle non-youtube external urls Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/YouTubeVideoTypeHandler.java trunk/openutils-mgnlmedia/src/site/changes/changes.xml Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/YouTubeVideoTypeHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/YouTubeVideoTypeHandler.java 2009-04-23 08:12:57 UTC (rev 1165) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/YouTubeVideoTypeHandler.java 2009-04-23 17:13:28 UTC (rev 1166) @@ -145,16 +145,25 @@ String videoUrl = form.getParameter("videoUrl"); String id = UUID.randomUUID().toString(); URL url; + try { url = new URL(videoUrl); - for (String att : StringUtils.split(url.getQuery(), "&")) + String query = url.getQuery(); + if (query != null) { - if (att.startsWith("v=")) + for (String att : StringUtils.split(url.getQuery(), "&")) { - id = StringUtils.substringAfter(att, "v="); + if (att.startsWith("v=")) + { + id = StringUtils.substringAfter(att, "v="); + } } } + else + { + id = StringUtils.substringAfterLast(videoUrl, "/"); + } } catch (MalformedURLException e) { Modified: trunk/openutils-mgnlmedia/src/site/changes/changes.xml =================================================================== --- trunk/openutils-mgnlmedia/src/site/changes/changes.xml 2009-04-23 08:12:57 UTC (rev 1165) +++ trunk/openutils-mgnlmedia/src/site/changes/changes.xml 2009-04-23 17:13:28 UTC (rev 1166) @@ -8,6 +8,10 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> + <release version="4.0-b4" date="in svn" description=""> + <action type="update" dev="fgiust">YouTubeVideoTypeHandler modified in order to work with generic external urls (not + only youtube)</action> + </release> <release version="4.0-b3" date="2009-04-23" description=""> <action type="update" dev="fgiust">Update openutils-mgnltasks dependency to 4.0</action> <action type="add" dev="fgiust">Support for resize without crop to a fixed size with borders. Background color can This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |