Crude video file detection implemented
authorteknolog
Mon, 26 Apr 2010 23:08:41 +0100
changeset 123 50edf2be6f0d
parent 122 dd31cab34e27
child 124 3d36a7fc2131
Crude video file detection implemented
engine/inc/PodcastUtils.h
engine/src/FeedParser.cpp
engine/src/PodcastUtils.cpp
--- a/engine/inc/PodcastUtils.h	Mon Apr 26 22:11:45 2010 +0100
+++ b/engine/inc/PodcastUtils.h	Mon Apr 26 23:08:41 2010 +0100
@@ -32,7 +32,13 @@
 
 _LIT(KURLPrefix, "http://");
 _LIT(KItpcPrefix, "itpc://");
-_LIT(KPcastPrefix, "pcast://");			
+_LIT(KPcastPrefix, "pcast://");
+
+_LIT(KVideoFormat1, ".wmv");
+_LIT(KVideoFormat2, ".avi");
+_LIT(KVideoFormat3, ".mp4");
+
+
 
 class PodcastUtils
 	{
@@ -46,6 +52,7 @@
 	IMPORT_C static void SQLEncode(TDes &aString);
 	IMPORT_C static void XMLEncode(TDes &aString);
 	IMPORT_C static void RemoveAllFormatting(TDes & aString);
+	IMPORT_C static TBool IsVideoShow(TDesC &aUrl);
 };
 
 #endif /* PODCASTUTILS_H_ */
--- a/engine/src/FeedParser.cpp	Mon Apr 26 22:11:45 2010 +0100
+++ b/engine/src/FeedParser.cpp	Mon Apr 26 23:08:41 2010 +0100
@@ -25,6 +25,7 @@
 #include <utf.h>
 #include <tinternetdate.h>
 #include "debug.h"
+#include "podcastutils.h"
 
 using namespace Xml;
 const TInt KMaxParseBuffer = 1024;
@@ -176,6 +177,10 @@
 					HBufC* val16 = HBufC::NewLC(KMaxParseBuffer);
 					val16->Des().Copy(attr.Value().DesC());
 					iActiveShow->SetUrlL(*val16);
+					
+					if (PodcastUtils::IsVideoShow(*val16)) {
+						iActiveShow->SetShowType(EVideoPodcast);
+					}
 					CleanupStack::PopAndDestroy(val16);
 				// length=...
 				} else if (attr16.Compare(KTagLength) == 0) {
@@ -369,6 +374,10 @@
 		case EStateItemLink:
 			if (iActiveShow->Url().Length() == 0) {
 				iActiveShow->SetUrlL(iBuffer);
+				
+				if (PodcastUtils::IsVideoShow(iBuffer)) {
+					iActiveShow->SetShowType(EVideoPodcast);
+				}
 			}
 			iFeedState = EStateItem;
 			break;
--- a/engine/src/PodcastUtils.cpp	Mon Apr 26 22:11:45 2010 +0100
+++ b/engine/src/PodcastUtils.cpp	Mon Apr 26 23:08:41 2010 +0100
@@ -306,3 +306,15 @@
 	ReplaceString(aString, _L(">"), _L("&gt;"));
 	ReplaceString(aString, _L("&"), _L("&amp;"));
 	}
+
+EXPORT_C TBool PodcastUtils::IsVideoShow(TDesC &aUrl)
+	{
+	if (aUrl.Find(KVideoFormat1) != KErrNotFound ||
+			aUrl.Find(KVideoFormat2) != KErrNotFound ||
+			aUrl.Find(KVideoFormat3) != KErrNotFound)
+		{
+		return ETrue;
+		}
+
+	return EFalse;
+	}