From: <gre...@us...> - 2007-04-14 00:36:09
|
Revision: 318 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=318&view=rev Author: gregmac45 Date: 2007-04-13 17:36:06 -0700 (Fri, 13 Apr 2007) Log Message: ----------- Initial Import Added Paths: ----------- trunk/plugins/OnlineVideoSettings.xml trunk/plugins/Skin/ trunk/plugins/Skin/BlueTwo/ trunk/plugins/Skin/BlueTwo/myonlinevideos.xml trunk/plugins/Source/ trunk/plugins/Source/AbcUtil.cs trunk/plugins/Source/AssemblyInfo.cs trunk/plugins/Source/BlipTvUtil.cs trunk/plugins/Source/BreakUtil.cs trunk/plugins/Source/CbsUtil.cs trunk/plugins/Source/DailyMotionUtil.cs trunk/plugins/Source/DownloadedVideoUtil.cs trunk/plugins/Source/FlashVideoScreen.cs trunk/plugins/Source/GUIOnlineVideos.cs trunk/plugins/Source/GameTrailersUtil.cs trunk/plugins/Source/GoogleVideoUtil.cs trunk/plugins/Source/GrouperUtil.cs trunk/plugins/Source/GubaUtil.cs trunk/plugins/Source/ImageDowloader.cs trunk/plugins/Source/ItunesTrailerUtil.cs trunk/plugins/Source/ItunesUtils/ trunk/plugins/Source/ItunesUtils/AppleTrailers.cs trunk/plugins/Source/ItunesUtils/GUIQTTrailers.cs trunk/plugins/Source/ItunesUtils/HDHelper.cs trunk/plugins/Source/ItunesUtils/HttpReader.cs trunk/plugins/Source/ItunesUtils/ItmsContent.cs trunk/plugins/Source/ItunesUtils/ItmsHelper.cs trunk/plugins/Source/ItunesUtils/RegexParsers.cs trunk/plugins/Source/ItunesUtils/TrailerIndex.cs trunk/plugins/Source/ItunesUtils/TrailerInfo.cs trunk/plugins/Source/ItunesUtils/TrailerInfoCollection.cs trunk/plugins/Source/ItunesUtils/TrailerStream.cs trunk/plugins/Source/ItunesUtils/TrailerStreamCollection.cs trunk/plugins/Source/Main.cs trunk/plugins/Source/MetaCafeUtil.cs trunk/plugins/Source/OnlineVideos.csproj trunk/plugins/Source/OnlineVideos.csproj.user trunk/plugins/Source/OnlineVideos.sln trunk/plugins/Source/OnlineVideos.suo trunk/plugins/Source/Properties/ trunk/plugins/Source/Properties/AssemblyInfo.cs trunk/plugins/Source/Runner.csproj trunk/plugins/Source/SiteUtilBase.cs trunk/plugins/Source/SiteUtilFactory.cs trunk/plugins/Source/SoapBoxUtil.cs trunk/plugins/Source/VideoJugUtil.cs trunk/plugins/Source/VidiLifeUtil.cs trunk/plugins/Source/YouTubeUtil.cs trunk/plugins/Source/bin/ trunk/plugins/Source/bin/Debug/ trunk/plugins/Source/obj/ trunk/plugins/Source/obj/Debug/ Added: trunk/plugins/OnlineVideoSettings.xml =================================================================== --- trunk/plugins/OnlineVideoSettings.xml (rev 0) +++ trunk/plugins/OnlineVideoSettings.xml 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,191 @@ +<settings> +<filter></filter><!-- comma delimited example: <filter>dog,cat,snake</filter> --> +<thumbLocation>C:\OnlineVideoThumbnails\</thumbLocation> +<sites> +<site> +<name>YouTube</name> +<id>1</id> +<!-- set the user if you wish to able to see youtube favorites --> +<user></user> +<!-- set the password if you wish to add/delete favorites to youtube --> +<password></password> +<!-- set the confirmAge to yes if you wish to confirm your age to view certain videos --> +<confirmAge>no</confirmAge> +<rss name="Top Rated"><![CDATA[http://youtube.com/rss/global/top_rated.rss]]></rss> +<rss name="Recently Added"><![CDATA[http://youtube.com/rss/global/recently_added.rss]]></rss> +<rss name="Recently Featured"><![CDATA[http://youtube.com/rss/global/recently_featured.rss]]></rss> +<rss name="Top Favorites"><![CDATA[http://youtube.com/rss/global/top_favorites.rss]]></rss> +<rss name="Top Viewed"><![CDATA[http://youtube.com/rss/global/top_viewed.rss]]></rss> +<rss name="Top Viewed:Today"><![CDATA[http://youtube.com/rss/global/top_viewed_today.rss]]></rss> +<rss name="Top Viewed:This Week"><![CDATA[http://youtube.com/rss/global/top_viewed_week.rss]]></rss> +<rss name="Top Viewed:This Month"><![CDATA[http://youtube.com/rss/global/top_viewed_month.rss]]></rss> +<rss name="Most Discussed:Today"><![CDATA[http://youtube.com/rss/global/most_discussed_today.rss]]></rss> +<rss name="Most Discussed:This Week"><![CDATA[http://youtube.com/rss/global/most_discussed_week.rss]]></rss> +<rss name="Most Discussed:This Month"><![CDATA[http://youtube.com/rss/global/most_discussed_month.rss]]></rss> +<rss name="Search"><![CDATA[http://www.youtube.com/rss/tag/{0}.rss]]></rss> +</site> +<site> +<name>Google Video</name> +<id>2</id> +<rss name="Popular"><![CDATA[http://video.google.com/videofeed?type=popular&num=100&output=rss]]></rss> +<rss name="Random"><![CDATA[http://video.google.com/videofeed?type=random&num=100&output=rss]]></rss> +<rss name="Comedy"><![CDATA[http://video.google.com/videofeed?type=search&q=genre:comedy&so=1&num=50]]></rss> +<rss name="Music Video"><![CDATA[http://video.google.com/videofeed?type=search&q=type:music_video&so=1&num=50]]></rss> +<rss name="Movie Trailer"><![CDATA[http://video.google.com/videofeed?type=search&q=type:movie_trailer&so=1&num=50]]></rss> +<rss name="TV Show"><![CDATA[http://video.google.com/videofeed?type=search&q=type:tvshow&so=1&num=50]]></rss> +<rss name="Sports"><![CDATA[http://video.google.com/videofeed?type=search&q=type:sports%20OR%20genre:sports&so=1&num=50]]></rss> +<rss name="Educational"><![CDATA[http://video.google.com/videofeed?type=search&q=genre:educational&so=1&num=50]]></rss> +<rss name="Google Picks"><![CDATA[http://video.google.com/videofeed?type=search&q=type:gpick&so=1&num=50]]></rss> +<rss name="Search"><![CDATA[http://video.google.com/videofeed?type=search&q={0}&so=1&num=50]]></rss> +</site> +<site> +<name>Grouper</name> +<id>3</id> +<rss name="Featured"><![CDATA[http://grouper.com/rss/media.ashx?o=0&t=1&fx=&fp=1]]></rss> +<rss name="Newest"><![CDATA[http://www.grouper.com/rss/media.ashx?o=0&fx=]]></rss> +<rss name="Most Viewed"><![CDATA[http://www.grouper.com/rss/media.ashx?o=1&t=1&fx=]]></rss> +<rss name="Most Discussed"><![CDATA[http://www.grouper.com/rss/media.ashx?o=4&t=1&fx=]]></rss> +<rss name="Highest Rated"><![CDATA[http://www.grouper.com/rss/media.ashx?o=3&fx=]]></rss> +<rss name="Most Viral"><![CDATA[http://www.grouper.com/rss/media.ashx?o=6&fx=]]></rss> +</site> +<!-- NOT WORKING CURRENTLY. Videos don't always play. +<site> +<name>Guba</name> +<id>4</id> +<rss name="Action"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=562&o=0&set=5]]></rss> +<rss name="Animation"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=457&o=0&set=5]]></rss> +<rss name="Classics"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=807&o=0&set=5]]></rss> +<rss name="Comedy"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=456&o=0&set=5]]></rss> +<rss name="Documentary"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=460&o=0&set=5]]></rss> +<rss name="Drama"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=459&o=0&set=5]]></rss> +<rss name="Educational"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=513&o=0&set=5]]></rss> +<rss name="Family"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=514&o=0&set=5]]></rss> +<rss name="Foreign"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=463&o=0&set=5]]></rss> +<rss name="Independent"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=515&o=0&set=5]]></rss> +<rss name="Miscellaneous"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=458&o=0&set=5]]></rss> +<rss name="Music Videos"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=462&o=0&set=5]]></rss> +<rss name="Romance"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=516&o=0&set=5]]></rss> +<rss name="Sports"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=461&o=0&set=5]]></rss> +<rss name="TV Shows"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=806&o=0&set=5]]></rss> +<rss name="Thriller"><![CDATA[http://www.guba.com/rss_feed/rss.pcast?type=itunes&category_id=517&o=0&set=5]]></rss> +</site> +--> +<site> +<name>MetaCafe</name> +<id>5</id> +<rss name="New Videos"><![CDATA[http://www.metacafe.com/rss/new_videos.rss]]></rss> +</site> +<site> +<name>DailyMotion</name> +<id>6</id> +<rss name="Font Page"><![CDATA[http://www.dailymotion.com/rss]]></rss> +<rss name="Ads"><![CDATA[http://www.dailymotion.com/rss/cluster/ads]]></rss> +<rss name="Animals"><![CDATA[http://www.dailymotion.com/rss/cluster/animals]]></rss> +<rss name="Fun"><![CDATA[http://www.dailymotion.com/rss/cluster/fun]]></rss> +<rss name="Auto"><![CDATA[http://www.dailymotion.com/rss/cluster/auto]]></rss> +<rss name="Street"><![CDATA[http://www.dailymotion.com/rss/cluster/street]]></rss> +<rss name="Creation"><![CDATA[http://www.dailymotion.com/rss/cluster/creation]]></rss> +<rss name="Short Films"><![CDATA[http://www.dailymotion.com/rss/cluster/shortfilms]]></rss> +<rss name="Business"><![CDATA[http://www.dailymotion.com/rss/cluster/business]]></rss> +<rss name="Tech"><![CDATA[http://www.dailymotion.com/rss/cluster/tech]]></rss> +<rss name="Sport"><![CDATA[http://www.dailymotion.com/rss/cluster/sport]]></rss> +<rss name="Extreme"><![CDATA[http://www.dailymotion.com/rss/cluster/extreme]]></rss> +<rss name="Events"><![CDATA[http://www.dailymotion.com/rss/cluster/events]]></rss> +<rss name="Family"><![CDATA[http://www.dailymotion.com/rss/cluster/family]]></rss> +<rss name="Music"><![CDATA[http://www.dailymotion.com/rss/cluster/music]]></rss> +<rss name="News"><![CDATA[http://www.dailymotion.com/rss/cluster/news]]></rss> +<rss name="Parties"><![CDATA[http://www.dailymotion.com/rss/cluster/parties]]></rss> +<rss name="School"><![CDATA[http://www.dailymotion.com/rss/cluster/school]]></rss> +<rss name="Travel"><![CDATA[http://www.dailymotion.com/rss/cluster/travel]]></rss> +<rss name="Video Games"><![CDATA[http://www.dailymotion.com/rss/cluster/videogames]]></rss> +<rss name="Blog"><![CDATA[http://www.dailymotion.com/rss/cluster/blog]]></rss> +<rss name="3D"><![CDATA[http://www.dailymotion.com/rss/cluster/3D]]></rss> +<rss name="Dating"><![CDATA[http://www.dailymotion.com/rss/cluster/dating]]></rss> +<rss name="Search"><![CDATA[http://www.dailymotion.com/rss/relevance/search/{0}]]></rss> +</site> +<!-- +<site> +<name>ABC Online</name> +<id>8</id> +<rss name="videos" dynamic="yes"><![CDATA[http://ll.static.abc.com/streaming/s/catalog?aff=&isIE=true]]></rss> +</site> +--> +<site> +<name>BlipTV</name> +<id>9</id> +<rss name="videos"><![CDATA[http://blip.tv/?1=1&search=soccer;page=1;s=posts&skin=rss]]></rss> +</site> +<!-- +<site> +<name>CBS Innertube</name> +<id>10</id> +<rss name="videos" dynamic="yes"><![CDATA[http://www.cbs.com/xml2/browseMenu/76.xml]]></rss> +</site> +--> +<site> +<name>GameTrailers</name> +<id>11</id> +<rss name="videos"><![CDATA[http://www.gametrailers.com/rss/newest.xml]]></rss> +</site> +<!-- +<site> +<name>MSN SoapBox</name> +<id>12</id> +<rss name="videos"><![CDATA[http://soapbox.msn.com/rss.aspx?listId=mostpopular&categoryId=8118b646-92c6-4051-a1eb-40ef4ee49ec1]]></rss> +</site> +--> +<site> +<name>Video Jug</name> +<id>13</id> +<rss name="videos"><![CDATA[http://www.videojug.com/rss]]></rss> +</site> +<site> +<name>VidiLife</name> +<id>14</id> +<rss name="videos"><![CDATA[http://rss.vidilife.com/rss.aspx]]></rss> +</site> +<site> +<name>Apple Trailers</name> +<id>15</id> +<rss name="New Trailers"><![CDATA[http://www.apple.com/moviesxml/h/view1_all.xml]]></rss> +<rss name="Action and Adventure"><![CDATA[http://movies.apple.com/moviesxml/g/action_and_adventure_1.xml]]></rss> +<rss name="Comedy"><![CDATA[http://movies.apple.com/moviesxml/g/comedy_1.xml]]></rss> +<rss name="Documentary"><![CDATA[http://movies.apple.com/moviesxml/g/documentary_1.xml]]></rss> +<rss name="Drama"><![CDATA[http://movies.apple.com/moviesxml/g/drama_1.xml]]></rss> +<rss name="Family"><![CDATA[http://movies.apple.com/moviesxml/g/family_1.xml]]></rss> +<rss name="Foreign"><![CDATA[http://movies.apple.com/moviesxml/g/fantasy_1.xml]]></rss> +<rss name="Horror"><![CDATA[http://movies.apple.com/moviesxml/g/horror_1.xml]]></rss> +<rss name="Musical"><![CDATA[http://movies.apple.com/moviesxml/g/musical_1.xml]]></rss> +<rss name="Romance"><![CDATA[http://movies.apple.com/moviesxml/g/romance_1.xml]]></rss> +<rss name="Sience Fiction"><![CDATA[http://movies.apple.com/moviesxml/g/science_fiction_1.xml]]></rss> +<rss name="Thriller"><![CDATA[http://movies.apple.com/moviesxml/g/thriller_1.xml]]></rss> +<rss name="20th Century Fox"><![CDATA[http://movies.apple.com/moviesxml/s/fox/index_1.xml]]></rss> +<rss name="DreamWorks S.K.G"><![CDATA[http://movies.apple.com/moviesxml/s/dreamworks/index_1.xml]]></rss> +<rss name="Focus Features / Rogue Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/focus_features/index_1.xml]]></rss> +<rss name="Fox Searchlight Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/fox_searchlight/index_1.xml]]></rss> +<rss name="Independent"><![CDATA[http://movies.apple.com/moviesxml/s/independent/index_1.xml]]></rss> +<rss name="Lionsgate"><![CDATA[http://movies.apple.com/moviesxml/s/lions_gate/index_1.xml]]></rss> +<rss name="MGM Studios"><![CDATA[http://movies.apple.com/moviesxml/s/mgm/index_1.xml]]></rss> +<rss name="Magnolia Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/magnolia/index_1.xml]]></rss> +<rss name="Miramax Films"><![CDATA[http://movies.apple.com/moviesxml/s/miramax/index_1.xml]]></rss> +<rss name="New Line Cinema"><![CDATA[http://movies.apple.com/moviesxml/s/newline/index_1.xml]]></rss> +<rss name="Paramount Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/paramount/index_1.xml]]></rss> +<rss name="Paramount Vantage"><![CDATA[http://movies.apple.com/moviesxml/s/paramount_vantage/index_1.xml]]></rss> +<rss name="Picturehouse"><![CDATA[http://movies.apple.com/moviesxml/s/picturehouse/index_1.xml]]></rss> +<rss name="Rogue Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/rogue_pictures/index_1.xml]]></rss> +<rss name="Sony Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/sony_pictures/index_1.xml]]></rss> +<rss name="Sony Pictures Classics"><![CDATA[http://movies.apple.com/moviesxml/s/sony/index_1.xml]]></rss> +<rss name="Touchstone Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/touchstone/index_1.xml]]></rss> +<rss name="Universal Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/universal/index_1.xml]]></rss> +<rss name="Walt Disney Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/disney/index_1.xml]]></rss> +<rss name="Warner Bros. Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/wb/index_1.xml]]></rss> +<rss name="Warner Independent Pictures"><![CDATA[http://movies.apple.com/moviesxml/s/warner_independent_pictures/index_1.xml]]></rss> +<rss name="Weinstein"><![CDATA[http://movies.apple.com/moviesxml/s/weinstein/index_1.xml]]></rss> +</site> +<site> +<id>99</id> +<name>Downloaded Videos</name> +<rss name="Downloads"><![CDATA[C:\FlashVideos\]]></rss> +</site> +</sites> +</settings> \ No newline at end of file Added: trunk/plugins/Skin/BlueTwo/myonlinevideos.xml =================================================================== --- trunk/plugins/Skin/BlueTwo/myonlinevideos.xml (rev 0) +++ trunk/plugins/Skin/BlueTwo/myonlinevideos.xml 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,22 @@ +<window> + <id>4755</id> + <defaultcontrol>50</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <define>#header.label:MyOnlineVideos</define> + <controls> + <import>common.window.xml</import> + <import>common.facade.xml</import> + <control> + <type>button</type> + <description>View button</description> + <id>2</id> + <posX>60</posX> + <posY>97</posY> + <onleft>4</onleft> + <onright>50</onright> + <onup>3</onup> + <ondown>2</ondown> + <label>101</label> + </control> + </controls> +</window> \ No newline at end of file Added: trunk/plugins/Source/AbcUtil.cs =================================================================== --- trunk/plugins/Source/AbcUtil.cs (rev 0) +++ trunk/plugins/Source/AbcUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,131 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class AbcUtil:SiteUtilBase + { + //private String msXmlLink; + public override List<GUIOnlineVideos.VideoInfo> getSiteFavorites() + { + throw new Exception("The method or operation is not implemented."); + } + public override bool isSiteFavoritesEnabled() + { + return false; + } + + public override String getUrl(String fsId) + { + + return fsId ; + } + + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.mediaDescription; + video.ImageUrl = rssItem.mediaThumbnail; + video.Title = rssItem.title; + foreach(MediaContent content in rssItem.contentList){ + if(content.type.Contains("flv")){ + video.VideoUrl = content.url; + break; + } + } + loVideoList.Add(video); + } + return loVideoList; + } + /* + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create("http://ll.static.abc.com/streaming/s/catalog?aff=&isIE=true")); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + XmlNode StreamServerNode = doc.SelectSingleNode("//config/streamServer"); + String lsStreamServer = "RTMP://"+StreamServerNode.InnerText; + Console.WriteLine("Stream Server ={0} ",lsStreamServer); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//streaming/catalog/channel", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//streaming/catalog/channel[title='Six Degrees']/episode"); + //Console.WriteLine(nodeList.Count); + + + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + //XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + node = chileNode.SelectSingleNode("description"); + loRssItem.Description = node.InnerText; + + node = chileNode.SelectSingleNode("screenShot", expr); + if (node != null) + { + //ac = node.Attributes; + loRssItem.ImageUrl = node.InnerText; + } + + + XmlNodeList SegNodeList = chileNode.SelectNodes("segment/HighStreamURL", expr); + loRssItem.VideoUrl = ""; + foreach(XmlNode SegNode in SegNodeList ) + { + //ac = node.Attributes; + loRssItem.VideoUrl = loRssItem.VideoUrl+lsStreamServer+SegNode.InnerText+","; + } + //Console.WriteLine(loRssItem.VideoUrl.ToString()); + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + + */ + + } +} Added: trunk/plugins/Source/AssemblyInfo.cs =================================================================== --- trunk/plugins/Source/AssemblyInfo.cs (rev 0) +++ trunk/plugins/Source/AssemblyInfo.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("Runner")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Runner")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] Added: trunk/plugins/Source/BlipTvUtil.cs =================================================================== --- trunk/plugins/Source/BlipTvUtil.cs (rev 0) +++ trunk/plugins/Source/BlipTvUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,115 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class BlipTvUtil:SiteUtilBase + { + + + public override String getUrl(String fsId) + { + + return fsId + "&txe=.flv"; + } + + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.mediaDescription; + video.ImageUrl = rssItem.mediaThumbnail; + video.Title = rssItem.title; + foreach(MediaContent content in rssItem.contentList){ + if(content.type.Contains("flv")){ + video.VideoUrl = content.url; + break; + } + } + loVideoList.Add(video); + } + return loVideoList; + } + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create(fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + node = chileNode.SelectSingleNode("description"); + loRssItem.Description = node.InnerText; + + node = chileNode.SelectSingleNode("media:thumbnail", expr); + if (node != null) + { + ac = node.Attributes; + loRssItem.ImageUrl = ac["url"].InnerText; + } + + + node = chileNode.SelectSingleNode("media:group/media:content[@type=\"video/x-flv\"]", expr); + if (node != null) + { + ac = node.Attributes; + loRssItem.VideoUrl = ac["url"].InnerText; + } + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + + + + + + } +} Added: trunk/plugins/Source/BreakUtil.cs =================================================================== --- trunk/plugins/Source/BreakUtil.cs (rev 0) +++ trunk/plugins/Source/BreakUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,115 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class BreakUtil:SiteUtilBase + { + + public override String getUrl(String fsId) + { + String lsHtml = getHTMLData(fsId); + //Log.Write("html to parse to get url = \n{0}",lsHtml); + Regex loPathRegex = new Regex("sGlobalFileName='([^']*)';[^;]*;sGlobalContentFilePath='([^']*)'"); + Regex loUrlRegex = new Regex("so.addVariable\\('sVidLoc', '([^']*)"); + + String lsUrl = loUrlRegex.Match(lsHtml).Groups[1].Value; + Match loMatch = loPathRegex.Match(lsHtml); + String lsFileName = loMatch.Groups[1].Value; + String lsPathName = loMatch.Groups[2].Value; + lsUrl = lsUrl+lsPathName+"/"+lsFileName+".flv"; + Log.Write("break flv url = {0}",lsUrl); + return lsUrl; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.description; + video.ImageUrl = rssItem.enclosure; + video.Title = rssItem.title; + //foreach(MediaContent content in rssItem.contentList){ + // if(content.type.Contains("flv")){ + video.VideoUrl = rssItem.link; + // break; + // } + loVideoList.Add(video); + } + return loVideoList; + } + /* + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create(fsUrl)); + //XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + //expr.AddNamespace("", "http://search.yahoo.com/mrss"); + //Console.WriteLine(doc.InnerXml); + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item"); + if(root==null){ + Console.WriteLine(root); + + } + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = node.InnerText; + + node = chileNode.SelectSingleNode("link"); + loRssItem.VideoUrl = node.InnerText; + + node = chileNode.SelectSingleNode("description"); + loRssItem.Description = node.InnerText; + + node = chileNode.SelectSingleNode("enclosure"); + if (node != null) + { + ac = node.Attributes; + loRssItem.ImageUrl = ac["url"].InnerText; + } + loRssItems.Add(loRssItem); + + + } + + return loRssItems; + } + */ + + + + } +} Added: trunk/plugins/Source/CbsUtil.cs =================================================================== --- trunk/plugins/Source/CbsUtil.cs (rev 0) +++ trunk/plugins/Source/CbsUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,125 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class CbsUtil:SiteUtilBase + { + + + + public override String getUrl(String fsId) + { + return "http://video.cgi.cbs.com/vplayer3/play.pl?id="+fsId; + + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + return getRssData(fsUrl); + } + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create("http://www.cbs.com/innertube/xmlProxy.php?type=videoList&id="+fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//videoList/list/video", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//videoList/list/video"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode childNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + ac = childNode.Attributes; + + //XmlNode node = chileNode.SelectSingleNode("title"); + loRssItem.Title = ac["show"].InnerText; + loRssItem.Description = ac["summary"].InnerText; + loRssItem.ImageUrl = "http://www.cbs.com"+ac["image"].InnerText; + loRssItem.VideoUrl = ac["videoID"].InnerText; + + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + public List<GUIOnlineVideos.VideoInfo> getCategories(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + //XPathDocument doc = new XPathDocument(fsUrl); + + doc.Load(XmlReader.Create(fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//browseMenu/primary/secondary", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//browseMenu/primary/secondary"); + //RssItem loRssItem = new RssItem(); + //loRssItem. + //This loops through each node found in the nodeList and adds the + //Node data to the DataTable. + XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo loRssItem; + //GUIListItem loListItem; + foreach (XmlNode chileNode in nodeList) + { + loRssItem = new GUIOnlineVideos.VideoInfo(); + + XmlNode node = chileNode.SelectSingleNode("name"); + loRssItem.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + node = chileNode.SelectSingleNode("id"); + loRssItem.VideoUrl = node.InnerText; + + //node = chileNode.SelectSingleNode("media:group/media:thumbnail", expr); + //get the description and images for the categories + + + loRssItems.Add(loRssItem); + + + } + return loRssItems; + } + + + } +} Added: trunk/plugins/Source/DailyMotionUtil.cs =================================================================== --- trunk/plugins/Source/DailyMotionUtil.cs (rev 0) +++ trunk/plugins/Source/DailyMotionUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,112 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class DailyMotionUtil:SiteUtilBase + { + + + public override String getUrl(String fsId) + { + + return fsId; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<RssItem> loRssItemList = getRssDataItems(fsUrl); + List<GUIOnlineVideos.VideoInfo> loVideoList = new List<GUIOnlineVideos.VideoInfo>(); + GUIOnlineVideos.VideoInfo video; + foreach(RssItem rssItem in loRssItemList){ + video = new GUIOnlineVideos.VideoInfo(); + video.Description = rssItem.description; + video.ImageUrl = rssItem.mediaThumbnail; + video.Title = rssItem.title; + foreach(MediaContent content in rssItem.contentList){ + if(content.type.Contains("flv")){ + video.VideoUrl = content.url; + break; + } + } + loVideoList.Add(video); + } + return loVideoList; + } + public List<GUIOnlineVideos.VideoInfo> getRssData(String fsUrl) + { + + XmlDocument doc = new XmlDocument(); + + doc.Load(XmlReader.Create(fsUrl)); + XmlNamespaceManager expr = new XmlNamespaceManager(doc.NameTable); + expr.AddNamespace("media", "http://search.yahoo.com/mrss"); + + //Create the root XmlNode and generate an XmlNodeList from it. + XmlNode root = doc.SelectSingleNode("//rss/channel/item", expr); + XmlNodeList nodeList; + nodeList = root.SelectNodes("//rss/channel/item"); + + XmlAttributeCollection ac; + List<GUIOnlineVideos.VideoInfo> loRssItems = new List<GUIOnlineVideos.VideoInfo>(); + //RssItem loRssItem; + //GUIListItem loListItem; + GUIOnlineVideos.VideoInfo loVideoInfo; + foreach (XmlNode chileNode in nodeList) + { + //loRssItem = new RssItem(); + loVideoInfo = new GUIOnlineVideos.VideoInfo(); + XmlNode node = chileNode.SelectSingleNode("title"); + //loRssItem.title = node.InnerText; + loVideoInfo.Title = node.InnerText; + + //node = chileNode.SelectSingleNode("link"); + //loRssItem.link = node.InnerText; + + + node = chileNode.SelectSingleNode("description"); + //loRssItem.description = node.InnerText; + loVideoInfo.Description = node.InnerText; + + node = chileNode.SelectSingleNode("media:thumbnail", expr); + if (node != null) + { + ac = node.Attributes; + //loRssItem.imageUrl = ac["url"].InnerText; + loVideoInfo.ImageUrl = ac["url"].InnerText; + } + + + node = chileNode.SelectSingleNode("media:group/media:content[@type=\"video/x-flv\"]", expr); + if (node != null) + { + ac = node.Attributes; + //loRssItem.videoUrl = ac["url"].InnerText; + loVideoInfo.VideoUrl = ac["url"].InnerText; + + } + + //Log.Write(loRssItem.ToString()); + //loListItem = new GUIListItem(loRssItem.title); + //loListItem.Path = loRssItem.videoUrl; + loRssItems.Add(loVideoInfo); + + + } + return loRssItems; + } + } +} Added: trunk/plugins/Source/DownloadedVideoUtil.cs =================================================================== --- trunk/plugins/Source/DownloadedVideoUtil.cs (rev 0) +++ trunk/plugins/Source/DownloadedVideoUtil.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,48 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.IO; +using System.Text; +using MediaPortal.Player; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View ; +using MediaPortal.Dialogs; +using MediaPortal.Util; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace OnlineVideos +{ + public class DownloadedVideoUtil:SiteUtilBase + { + + + public override String getUrl(String fsId) + { + + return fsId; + } + public override List<GUIOnlineVideos.VideoInfo> getVideoList(string fsUrl) + { + List<GUIOnlineVideos.VideoInfo>loVideoInfoList = new List<GUIOnlineVideos.VideoInfo>(); + string[]loVideoList = Directory.GetFiles(fsUrl,"*.flv"); + + GUIOnlineVideos.VideoInfo loVideoInfo; + foreach (String lsVideo in loVideoList) + { + loVideoInfo = new GUIOnlineVideos.VideoInfo(); + loVideoInfo.VideoUrl = lsVideo; + + loVideoInfo.Title = Utils.GetFilename(lsVideo); + loVideoInfoList.Add(loVideoInfo); + } + return loVideoInfoList; + } + + } +} Added: trunk/plugins/Source/FlashVideoScreen.cs =================================================================== --- trunk/plugins/Source/FlashVideoScreen.cs (rev 0) +++ trunk/plugins/Source/FlashVideoScreen.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,303 @@ +using System; +using MediaPortal.GUI.Library; +using System.Text.RegularExpressions; +using System.Net; +using System.Text; +using MediaPortal.Player; +using MediaPortal.Playlists; +using System.Collections.Generic; +//using MediaPortal.Utils.Services; +using MediaPortal.GUI.View; +using MediaPortal.Dialogs; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Threading; + + + +namespace GoogleVideos +{ + public class FlashVideoScreen : GUIWindow + { + + [SkinControlAttribute(2)] + protected GUIButtonControl btnBack = null; + [SkinControlAttribute(3)] + protected GUIButtonControl btnPlay = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnPause = null; + [SkinControlAttribute(5)] + protected GUIButtonControl btnStop = null; + [SkinControlAttribute(6)] + protected GUIButtonControl btnForward = null; + [SkinControlAttribute(7)] + protected GUIButtonControl btnBackward = null; + + [SkinControlAttribute(20)] + protected GUIProgressControl progress = null; + + //private Log moLog; + private String _CurrentFile = String.Empty; + private String _CurrentDescription = String.Empty; + //private List<OnlineVideo> moVideoList = new List<OnlineVideo>(); + + + public FlashVideoScreen() + { + //ServiceProvider loServices = GlobalServiceProvider.Instance; + //moLog = loServices.Get<ILog>(); + } + /* + public string PluginName() + { + + return "GoogleVideo"; + + } + + // Returns the description of the plugin is shown in the plugin menu + + public string Description() + { + + return "Google Video Plugin"; + + } + + // Returns the author of the plugin which is shown in the plugin menu + + public string Author() + { + + return "GregMac45"; + + } + + // show the setup dialog + + public void ShowPlugin() + { + + //MessageBox.Show("Nothing to configure, this is just an example"); + + } + + // Indicates whether plugin can be enabled/disabled + + public bool CanEnable() + { + + return true; + + } + * */ + + // get ID of windowplugin belonging to this setup + + public int GetWindowId() + { + + return GetID; + + } + + // Indicates if plugin is enabled by default; + + public bool DefaultEnabled() + { + + return true; + + } + + // indicates if a plugin has its own setup screen + + //public bool HasSetup() + //{ + + // return false; + + //} + public override int GetID + { + + get + { + + return 4760; + + } + + set + { + + } + + } + + public override bool Init() + { + + return Load(GUIGraphicsContext.Skin + @"\flashvideoscreen.xml"); + + } + /* + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + + strButtonText = PluginName(); + + strButtonImage = String.Empty; + + strButtonImageFocus = String.Empty; + + strPictureImage = String.Empty; + + return true; + + } + * */ + protected override void OnPageLoad() + { + base.OnPageLoad(); + //if(g_Player.Playing){ + // _CurrentFile = g_Player.CurrentFile; + // } + } + protected override void OnPreviousWindow() + { + g_Player.Stop(); + base.OnPreviousWindow(); + } + public override bool OnMessage(GUIMessage message) + { + + if (message.Message == GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED) + { + bool lbPlayFullscreen = false; + //_log.Info("Playback message received from sender:{0}", message.SenderControlId); + if (message.SenderControlId == 4750) + { + if(message.Object!=null){ + String [] loParms = (String []) message.Object; + if(loParms[0].Equals("1")){ + lbPlayFullscreen = true; + } + Log.Info("object:{0}",message.Object); + } + + //label = source + //label2 = title + //label3= description + //label4 = link + //_log.Info("label = {0}", message.Label); + _CurrentFile = message.Label4; + //if (_CurrentFile.EndsWith(".flv") == false) + //{ + + //} + //_log.Info("label2 = {0}", message.Label2); + _CurrentDescription = message.Label3; + + GUIPropertyManager.SetProperty("#TV.View.description", _CurrentDescription); + GUIPropertyManager.SetProperty("#TV.View.title", message.Label2); + //GUIPropertyManager.SetProperty("#TV.View.channel", message.Label); + if(_CurrentFile.IndexOf(',')>0){ + PlayListPlayer loPlayer = PlayListPlayer.SingletonPlayer; + char[] seps = { ',' }; + String[] values = _CurrentFile.Split(seps); + //_CurrentFile.Split(seps); + + PlayList loPlayList = loPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO); + foreach(String url in values){ + loPlayList.Add(new PlayListItem("",url)); + } + loPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO; + loPlayer.Play(0); + }else{ + g_Player.Play(_CurrentFile); + } + if(lbPlayFullscreen){ + GUIGraphicsContext.IsFullScreenVideo = true; + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); + } + //g_Player.StepNow(); + //g_Player.StepNow(); + //g_Player.StepNow(); + } + } + return base.OnMessage(message); + } + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + base.OnClicked(controlId, control, actionType); + + + if (control == btnBack) + { + g_Player.Stop(); + GUIWindowManager.ShowPreviousWindow(); + } + else if (control == btnPause) + { + g_Player.Pause(); + } + else if (control == btnStop) + { + g_Player.Stop(); + } + else if (control == btnForward) + { + g_Player.SeekRelativePercentage(10); + } + else if (control == btnBackward) + { + g_Player.SeekRelativePercentage(-10); + } + else if (control == btnPlay) + { + if (_CurrentFile != String.Empty) + { + if (g_Player.Paused) + { + g_Player.Pause(); + } + if (g_Player.Playing == false) + { + if(_CurrentFile.IndexOf(",")>0){ + PlayListPlayer.SingletonPlayer.Play(0); + }else{ + g_Player.Play(_CurrentFile); + } + + } + + } + } + + } + public override void Process() + { + if (g_Player.Playing) + { + //_log.Info("Screen requesting current duration"); + double iTotalSecs = g_Player.Duration; + //_log.Info("Screen received duration:{0}", iTotalSecs); + if (iTotalSecs > 0) + { + //_log.Info("Screen requesting current position"); + double iCurSecs = g_Player.CurrentPosition; + //_log.Info("Screen received position:{0}", iCurSecs); + double fPercent = ((double)iCurSecs) / ((double)iTotalSecs); + fPercent *= 100.0d; + //_log.Info("progress percent:{0}", fPercent); + + GUIPropertyManager.SetProperty("#TV.View.Percentage", ((int)fPercent).ToString()); + //_log.Info("progress percent:{0}", GUIPropertyManager.GetProperty("#TV.View.Percentage")); + } + } + base.Process(); + } + } +} Added: trunk/plugins/Source/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/Source/GUIOnlineVideos.cs (rev 0) +++ trunk/plugins/Source/GUIOnlineVideos.cs 2007-04-14 00:36:06 UTC (rev 318) @@ -0,0 +1,721 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.XPath; +using System.ComponentModel; +using System.Net; +using System.Web; +using System.IO; +using System.Text.RegularExpressions; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +//using MediaPortal.Utils.Services; +using MediaPortal.Utils; +using MediaPortal.Player; + +namespace OnlineVideos +{ + public class GUIOnlineVideos : GUIWindow, ISetupForm + { + [SkinControlAttribute(2)] + protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeView = null; + //private ILog moLog; + protected View currentView = View.List; + private Dictionary<String, Site> moSiteList = new Dictionary<String, Site>(); + private String msSelectedSiteId; + private String msSelectedCategory; + private State _CurrentState = State.home; + private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; + private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); + private String []msFilterArray; + private String msThumbLocation; + private int miSelectedIndex = 0; + private bool mbPlayFullscreen = true; + public enum State + { + home = 0, + categories = 1, + videos = 2 + } + public enum View + { + List = 0, + Icons = 1, + LargeIcons = 2, + FilmStrip = 3 + } + public class Site + { + public String name; + public String id; + public string username; + public string password; + public bool confirmAge; + public Dictionary<String, RssLink> RssList = new Dictionary<String, RssLink>(); + } + public class RssLink + { + public String name; + public Boolean isDynamic = false; + public String url; + } + public class VideoInfo + { + public String Title; + public String Description; + public String VideoUrl; + public String ImageUrl; + public int Length; + public String Tags; + public Object Other; + public VideoInfo() + { + Length = -1; + } + } + + public GUIOnlineVideos() + { + //ServiceProvider loServices = GlobalServiceProvider.Instance; + //moLog = loServices.Get<ILog>(); + } + public string PluginName() + { + + return "Online Videos"; + + } + + // Returns the description of the plugin is shown in the plugin menu + + public string Description() + { + + return "Youtube Plugin"; + + } + + // Returns the author of the plugin which is shown in the plugin menu + + public string Author() + { + + return "GregMac45"; + + } + + // show the setup dialog + + public void ShowPlugin() + { + + //MessageBox.Show("Nothing to configure, this is just an example"); + + } + + // Indicates whether plugin can be enabled/disabled + + public bool CanEnable() + { + + return true; + + } + + // get ID of windowplugin belonging to this setup + + public int GetWindowId() + { + + return GetID; + + } + + // Indicates if plugin is enabled by default; + + public bool DefaultEnabled() + { + + return true; + + } + + // indicates if a plugin has its own setup screen + + public bool HasSetup() + { + + return false; + + } + public override int GetID + { + get + { + return 4755; + } + set + { + } + } + + public override bool Init() + { + LoadSettings(); + return Load(GUIGraphicsContext.Skin + @"\myonlinevideos.xml"); + + } + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = PluginName(); + + strButtonImage = String.Empty; + + strButtonImageFocus = String.Empty; + + strPictureImage = String.Empty; + + return true; + } + public bool ShowDefaultHome() + { + return true; + } + protected override void OnPageLoad() + { + if (_CurrentState == State.home) + { + //_log.Info("onPageLoad state home"); + GUIPropertyManager.SetProperty("#header.label","Online Videos"); + DisplaySites(); + } + else if (_CurrentState == State.categories) + { + GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); + DisplayCategories(); + } + else + { + GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); + DisplayVideos(false); + facadeView.SelectedListItemIndex = miSelectedIndex; + } + base.OnPageLoad(); + } + protected override void OnShowContextMenu() + { + int liSelected = facadeView.SelectedListItemIndex-1; + if (liSelected < 0 || msSelectedSiteId=="99" || _CurrentState!=State.videos) + { + return; + } + + GUIListItem loListItem = facadeView.SelectedListItem; + GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + dlgSel.Reset(); + if (dlgSel != null) + { + dlgSel.Add("Save"); // Save + if(msSelectedSiteId=="1"){ + dlgSel.Add("Related Videos"); // Related Videos + } + if(isSiteFavoriteEnabled()){ + if(msSelectedCategory.StartsWith("fav:") ==false){ + dlgSel.Add("Add to favorites"); + } + else{ + dlgSel.Add("Remove from favorites"); + } + } + } + dlgSel.DoModal(GetID); + int liSelectedIdx = dlgSel.SelectedId; + Log.Info("Selected id {0}",liSelectedIdx); + switch(liSelectedIdx){ + case 1: + SaveVideo(loListItem); + break; + case 2: + Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); + SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + Log.Info("VideoList before:"); + foreach(VideoInfo video in moCurrentVideoList){ + Log.Info(video.Title); + } + moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); + Log.Info("VideoList after:"); + foreach(VideoInfo video in moCurrentVideoList){ + Log.Info(video.Title); + } + DisplayVideos(false); + break; + case 3: + SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); + Site loSite = moSiteList [msSelectedSiteId]; + if(msSelectedCategory.StartsWith("fav:") == false){ + siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + }else{ + siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); + } + break; + } + base.OnShowContextMenu(); + } + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + if (_CurrentState == State.videos) + { + DisplayCategories(); + _CurrentState = State.categories; + return; + } + else if (_CurrentState == State.categories) + { + DisplaySites(); + _CurrentState = State.home; + return; + } + } + base.OnAction(action); + } + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + Log.Info("Onclicked action type:{0}",actionType); + if (control == facadeView) + { + + if (_CurrentState == State.home) + { + msSelectedSiteId = facadeView.SelectedListItem.Path; + GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); + DisplayCategories(); + _CurrentState = State.categories; + } + else if (_CurrentState == State.categories) + { + if (facadeView.SelectedListItemIndex == 0) + { + DisplaySites(); + _CurrentState = State.home; + } + else + { + msSelectedCategory = facadeView.SelectedListItem.Path; + DisplayVideos(true); + _CurrentState = State.videos; + } + } + else if (_CurrentState == State.videos) + { + ImageDownloader._stopDownload = true; + if (facadeView.SelectedListItemIndex == 0) + { + DisplayCategories(); + _CurrentState = State.categories; + } + else + { + miSelectedIndex = facadeView.SelectedListItemIndex; + //play the video + Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); + } + } + } + else if (control == btnViewAs) + { + //bool shouldContinue = false; + //do + //{ + //shouldContinue = false; + switch (currentView) + { + case View.List: + currentView = View.Icons; + //if (!AllowView(CurrentView) || facadeView.ThumbnailView == null) + // shouldContinue = true; + //else + facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + break; + case View.Icons: + currentView = View.LargeIcons; + //if (!AllowView(CurrentView) || facadeView.ThumbnailView == null) + // shouldContinue = true; + //else + facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + //facadeView. + break; + case View.LargeIcons: + currentView = View.FilmStrip; + //if (!AllowView(CurrentView) || facadeView.FilmstripView == null) + // shouldContinue = true; + //else + facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + break; + ... [truncated message content] |