From: <gre...@us...> - 2007-07-18 21:32:24
|
Revision: 738 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=738&view=rev Author: gregmac45 Date: 2007-07-18 14:32:23 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Added Site logos and icons Thumbnaill code improvement Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 21:30:12 UTC (rev 737) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 21:32:23 UTC (rev 738) @@ -22,6 +22,8 @@ protected GUIButtonControl btnViewAs = null; [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; + [SkinControlAttribute(1)] + protected GUIImage logoImage = null; //private ILog moLog; protected View currentView = View.List; private Dictionary<String, Site> moSiteList = new Dictionary<String, Site>(); @@ -190,12 +192,14 @@ { //_log.Info("onPageLoad state home"); GUIPropertyManager.SetProperty("#header.label","Online Videos"); + //GUIPropertyManager. DisplaySites(); } else if (_CurrentState == State.categories) { - GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); - DisplayCategories(); + GUIPropertyManager.SetProperty("#header.label", "Online Videos"); + + DisplayCategories(); } else { @@ -203,7 +207,7 @@ DisplayVideos(false); facadeView.SelectedListItemIndex = miSelectedIndex; } - base.OnPageLoad(); + //base.OnPageLoad(); } protected override void OnShowContextMenu() { @@ -239,14 +243,14 @@ SaveVideo(loListItem); break; case 2: - Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); + //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:"); + //Log.Info("VideoList before:"); foreach(VideoInfo video in moCurrentVideoList){ Log.Info(video.Title); } moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); - Log.Info("VideoList after:"); + //Log.Info("VideoList after:"); foreach(VideoInfo video in moCurrentVideoList){ Log.Info(video.Title); } @@ -285,14 +289,14 @@ } protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { - Log.Info("Onclicked action type:{0}",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); + GUIPropertyManager.SetProperty("#header.label", "Online Videos"); DisplayCategories(); _CurrentState = State.categories; } @@ -481,17 +485,18 @@ { loListItem = new GUIListItem(loSite.name); loListItem.Path = loSite.id; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + //loListItem.IsFolder = true; + //MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; facadeView.Add(loListItem); } - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); + GUIPropertyManager.SetProperty("#header.image",""); } private void DisplayCategories() { // facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); - + GUIControl.ClearControl(GetID, facadeView.GetID); + GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); GUIListItem loListItem; loListItem = new GUIListItem(".."); loListItem.IsFolder = true; @@ -578,9 +583,10 @@ //GUIListItem loListItem; List<String> loImageUrlList = new List<string>(); - + int liIdx = 0; foreach (VideoInfo loVideoInfo in loListItems) { + liIdx++; loVideoInfo.Description = cleanString(loVideoInfo.Description); if (FilterOut(loVideoInfo.Title) || FilterOut(loVideoInfo.Description)) { @@ -588,7 +594,12 @@ } loListItem = new GUIListItem(loVideoInfo.Title); loListItem.Path = loVideoInfo.VideoUrl; - facadeView.Add(loListItem); + loListItem.ItemId = liIdx; + loListItem.RetrieveArt = false; + loListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + + facadeView.Add(loListItem); + //loListItem.RetrieveArt = true; loImageUrlList.Add(loVideoInfo.ImageUrl); if (fbRefresh) { @@ -597,7 +608,22 @@ } //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 +""); - + ImageDownloader.getImages(loImageUrlList,msThumbLocation,facadeView); +// Log.Info("Getting images"); +// BackgroundWorker worker = new BackgroundWorker(); +// +// worker.DoWork += new DoWorkEventHandler(downloadImages); +// worker.RunWorkerAsync(); +/* + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + */ + /* BackgroundWorker worker = new BackgroundWorker(); Object[] loParms = new Object[4]; loParms[0] = facadeView; @@ -616,9 +642,27 @@ } facadeView.SelectedListItemIndex = miSelectedIndex; } + */ } + /* + public void downloadImages(object sender, DoWorkEventArgs e) + { + + for(int i=1;i<facadeView.Count;i++){ + GUIListItem item = facadeView[i]; + item.RetrieveArt = true; + GUIWindowManager.Process(); + } + } + */ + void OnRetrieveCoverArt(GUIListItem item) + { + if(ImageDownloader._imageLocationList.Count>item.ItemId-1){ + item.ThumbnailImage = ImageDownloader._imageLocationList[item.ItemId-1]; + } + } private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-07-18 22:27:30
|
Revision: 741 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=741&view=rev Author: gregmac45 Date: 2007-07-18 15:27:29 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Set default view to icons instead of List Dynamic screen title added Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 21:38:00 UTC (rev 740) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 22:27:29 UTC (rev 741) @@ -25,10 +25,11 @@ [SkinControlAttribute(1)] protected GUIImage logoImage = null; //private ILog moLog; - protected View currentView = View.List; + protected View currentView = View.Icons; private Dictionary<String, Site> moSiteList = new Dictionary<String, Site>(); private String msSelectedSiteId; - private String msSelectedCategory; + private String msSelectedCategoryValue; + private String msSelectedCategoryName; private State _CurrentState = State.home; private String msDownloadDir = Directory.GetCurrentDirectory()+"\\"; private List<VideoInfo> moCurrentVideoList = new List<VideoInfo>(); @@ -190,23 +191,20 @@ { if (_CurrentState == State.home) { - //_log.Info("onPageLoad state home"); - GUIPropertyManager.SetProperty("#header.label","Online Videos"); - //GUIPropertyManager. DisplaySites(); + currentView = View.List; + ChangeFacadeView(); } else if (_CurrentState == State.categories) { - GUIPropertyManager.SetProperty("#header.label", "Online Videos"); - DisplayCategories(); } else { - GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); DisplayVideos(false); facadeView.SelectedListItemIndex = miSelectedIndex; } + UpdateViewSate(); //base.OnPageLoad(); } protected override void OnShowContextMenu() @@ -227,7 +225,7 @@ dlgSel.Add("Related Videos"); // Related Videos } if(isSiteFavoriteEnabled()){ - if(msSelectedCategory.StartsWith("fav:") ==false){ + if(msSelectedCategoryValue.StartsWith("fav:") ==false){ dlgSel.Add("Add to favorites"); } else{ @@ -259,7 +257,7 @@ case 3: SiteUtilBase siteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); Site loSite = moSiteList [msSelectedSiteId]; - if(msSelectedCategory.StartsWith("fav:") == false){ + if(msSelectedCategoryValue.StartsWith("fav:") == false){ siteUtil.addFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); }else{ siteUtil.removeFavorite(moCurrentVideoList[liSelected].VideoUrl,loSite.username,loSite.password); @@ -296,7 +294,7 @@ if (_CurrentState == State.home) { msSelectedSiteId = facadeView.SelectedListItem.Path; - GUIPropertyManager.SetProperty("#header.label", "Online Videos"); + //GUIPropertyManager.SetProperty("#header.label", "Online Videos"); DisplayCategories(); _CurrentState = State.categories; } @@ -309,7 +307,8 @@ } else { - msSelectedCategory = facadeView.SelectedListItem.Path; + msSelectedCategoryValue = facadeView.SelectedListItem.Path; + msSelectedCategoryName = facadeView.SelectedListItem.Label; DisplayVideos(true); _CurrentState = State.videos; } @@ -329,70 +328,16 @@ Play(moCurrentVideoList[facadeView.SelectedListItemIndex -1]); } } + UpdateViewSate(); } else if (control == btnViewAs) { + ChangeFacadeView(); //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; - case View.FilmStrip: - currentView = View.List; - //if (!AllowView(CurrentView) || facadeView.ListView == null) - // shouldContinue = true; - //else - facadeView.View = GUIFacadeControl.ViewMode.List; - break; - } - //} while (shouldContinue); - //SelectCurrentItem(); - GUIControl.FocusControl(GetID, controlId); - - string strLine = String.Empty; - View view = currentView; - switch (view) - { - case View.List: - strLine = GUILocalizeStrings.Get(101); - break; - case View.Icons: - strLine = GUILocalizeStrings.Get(100); - break; - case View.LargeIcons: - strLine = GUILocalizeStrings.Get(417); - break; - case View.FilmStrip: - strLine = GUILocalizeStrings.Get(733); - break; - } - GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); - - return; - }//if (control == btnViewAs) + } base.OnClicked(controlId, control, actionType); } #region new methods @@ -481,13 +426,21 @@ GUIControl.ClearControl(GetID, facadeView.GetID); GUIListItem loListItem; + String image; foreach (Site loSite in moSiteList.Values) { + loListItem = new GUIListItem(loSite.name); loListItem.Path = loSite.id; - //loListItem.IsFolder = true; - //MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; + image = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; + if(System.IO.File.Exists(image)){ + loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; + }else{ + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + } + + facadeView.Add(loListItem); } GUIPropertyManager.SetProperty("#header.image",""); @@ -496,7 +449,7 @@ { // facadeView.Clear(); GUIControl.ClearControl(GetID, facadeView.GetID); - GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + GUIListItem loListItem; loListItem = new GUIListItem(".."); loListItem.IsFolder = true; @@ -551,6 +504,7 @@ { List<VideoInfo> loListItems; GUIListItem loListItem; + GUIControl.ClearControl(GetID, facadeView.GetID); loListItem = new GUIListItem(".."); loListItem.IsFolder = true; @@ -561,7 +515,7 @@ { SiteUtilBase loSiteUtil = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - if (msSelectedCategory.Contains("{0}")) + if (msSelectedCategoryValue.Contains("{0}")) { String lsSearchStr = String.Empty; GetUserInputString(ref lsSearchStr); @@ -570,9 +524,9 @@ return; } lsSearchStr = lsSearchStr.Replace(" ", "+"); - msSelectedCategory = String.Format(msSelectedCategory, lsSearchStr); + msSelectedCategoryValue = String.Format(msSelectedCategoryValue, lsSearchStr); } - loListItems = loSiteUtil.getVideoList(msSelectedCategory); + loListItems = loSiteUtil.getVideoList(msSelectedCategoryValue); moCurrentVideoList.Clear(); } else @@ -760,6 +714,82 @@ } return fsStr; } + private void UpdateViewSate(){ + switch(_CurrentState){ + case State.home: + GUIPropertyManager.SetProperty("#header.label","OnlineVideos"); + GUIPropertyManager.SetProperty("#header.image",""); + break; + case State.categories: + GUIPropertyManager.SetProperty("#header.label","Categories"); + GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + break; + case State.videos: + GUIPropertyManager.SetProperty("#header.label",msSelectedCategoryName); + GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); + + break; + } + } + private void ChangeFacadeView(){ + 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; + case View.FilmStrip: + currentView = View.List; + //if (!AllowView(CurrentView) || facadeView.ListView == null) + // shouldContinue = true; + //else + facadeView.View = GUIFacadeControl.ViewMode.List; + break; + } + //} while (shouldContinue); + //SelectCurrentItem(); + GUIControl.FocusControl(GetID, facadeView.GetID); + + string strLine = String.Empty; + View view = currentView; + switch (view) + { + case View.List: + strLine = GUILocalizeStrings.Get(101); + break; + case View.Icons: + strLine = GUILocalizeStrings.Get(100); + break; + case View.LargeIcons: + strLine = GUILocalizeStrings.Get(417); + break; + case View.FilmStrip: + strLine = GUILocalizeStrings.Get(733); + break; + } + GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); + + + + } #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-07-19 00:18:55
|
Revision: 744 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=744&view=rev Author: gregmac45 Date: 2007-07-18 17:18:53 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Added hover image Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-19 00:18:08 UTC (rev 743) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-19 00:18:53 UTC (rev 744) @@ -179,7 +179,7 @@ strButtonImageFocus = String.Empty; - strPictureImage = String.Empty; + strPictureImage = "hover_onlinevideos.png"; return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-07-24 00:06:33
|
Revision: 755 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=755&view=rev Author: gregmac45 Date: 2007-07-23 17:06:29 -0700 (Mon, 23 Jul 2007) Log Message: ----------- create the thumbnail directory specified in the config xml if it doesn't exist using MediaPortal/Thumbs/OnlineVideos if no thumbnail directory is specified in the config xml Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-23 13:27:22 UTC (rev 754) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-24 00:06:29 UTC (rev 755) @@ -356,6 +356,13 @@ } XmlNode thumbNode = doc.SelectSingleNode("//settings/thumbLocation"); msThumbLocation = thumbNode.InnerText; + if(String.IsNullOrEmpty(msThumbLocation)){ + msThumbLocation = + System.IO.Directory.GetCurrentDirectory()+"/Thumbs/OnlineVideos/"; + } + if(System.IO.Directory.Exists(msThumbLocation)==false){ + System.IO.Directory.CreateDirectory(msThumbLocation); + } //lsFilterArray //Log.Write("filter value {0}",filter.InnerText); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |