|
From: <gre...@us...> - 2007-04-26 15:21:53
|
Revision: 346
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=346&view=rev
Author: gregmac45
Date: 2007-04-26 08:16:31 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/OnlinePhotos/Flickr.cs
trunk/plugins/OnlinePhotos/MyClass.cs
Modified: trunk/plugins/OnlinePhotos/Flickr.cs
===================================================================
--- trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-26 00:24:38 UTC (rev 345)
+++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-26 15:16:31 UTC (rev 346)
@@ -58,12 +58,14 @@
}
public static List<MyPhoto> getPhotosByTag(String tag)
{
- Photos photos = _flickr.PhotosSearch(tag,"");
+ PhotoSearchExtras extras = new PhotoSearchExtras();
+ Photos photos = _flickr.PhotosSearch(
+ tag,TagMode.AllTags,"",extras);
return loadMyPhotoList(photos);
}
public static List<MyPhoto> getPhotosByText(String text)
{
- Photos photos = _flickr.PhotosSearchText(text, "");
+ Photos photos = _flickr.PhotosSearchText(text);
return loadMyPhotoList(photos);
}
private static List<MyPhoto> loadMyPhotoList(Photos photos)
Modified: trunk/plugins/OnlinePhotos/MyClass.cs
===================================================================
--- trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-26 00:24:38 UTC (rev 345)
+++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-26 15:16:31 UTC (rev 346)
@@ -180,15 +180,38 @@
{
//_log.Info("onPageLoad state home");
GUIPropertyManager.SetProperty("#header.label", "Online Photos");
+ DisplayHome();
//DisplaySites();
}
+ else if (_CurrentState == State.categories)
+ {
+ DisplayCurrentPhotos();
+ }
currentView = View.Icons;
ChangeFacadeView();
base.OnPageLoad();
}
-
+ 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)
+ {
+ DisplayHome();
+ _CurrentState = State.home;
+ return;
+ }
+ }
+ base.OnAction(action);
+ }
protected override void OnPageDestroy(int new_windowId)
{
@@ -205,6 +228,41 @@
{
OnSlideShow();
}
+ else if (control == facadeView)
+ {
+ String SelectedSiteId = facadeView.SelectedListItem.Path;
+ switch (SelectedSiteId)
+ {
+ case "1":
+ DisplayInterestingFlickrPhotos();
+ _CurrentState = State.categories;
+ break;
+ case "2":
+ DisplayRecentFlickrPhotos();
+ _CurrentState = State.categories;
+ break;
+ case "3":
+ string q = "";
+ if (GetUserInputString(ref q))
+ {
+
+ DisplayFlickrPhotosWithTags(q);
+ _CurrentState = State.categories;
+
+ }
+ break;
+ case "4":
+ string text = "";
+ if (GetUserInputString(ref text))
+ {
+
+ DisplayFlickrPhotosWithText(text);
+ _CurrentState = State.categories;
+
+ }
+ break;
+ }
+ }
}
public void DisplayInterestingFlickrPhotos()
{
@@ -222,6 +280,21 @@
CurrentPhotoList = MyFlickr.getPhotosByTag(tags);
DisplayCurrentPhotos();
}
+ public void DisplayFlickrPhotosWithText(String text)
+ {
+ CurrentPhotoList = MyFlickr.getPhotosByText(text);
+ DisplayCurrentPhotos();
+ }
+ private bool GetUserInputString(ref string sString)
+ {
+ VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ keyBoard.Reset();
+ keyBoard.IsSearchKeyboard = true;
+ keyBoard.Text = sString;
+ keyBoard.DoModal(GetID); // show it...
+ if (keyBoard.IsConfirmed) sString = keyBoard.Text;
+ return keyBoard.IsConfirmed;
+ }
public void DisplayCurrentPhotos()
{
facadeView.Clear();
@@ -442,7 +515,7 @@
Log.Error(e);
}
}
- private void DisplaySites()
+ private void DisplayHome()
{
//facadeView.Clear();
GUIControl.ClearControl(GetID, facadeView.GetID);
@@ -450,17 +523,32 @@
GUIListItem loListItem;
//foreach (Site loSite in moSiteList.Values)
//{
- loListItem = new GUIListItem("Flickr");
+ loListItem = new GUIListItem("Flickr - Interesting Photos");
loListItem.Path = "1";
loListItem.IsFolder = true;
MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
facadeView.Add(loListItem);
-
- loListItem = new GUIListItem("Picasa Web");
+
+ loListItem = new GUIListItem("Flickr - Recent Photos");
loListItem.Path = "2";
loListItem.IsFolder = true;
MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
facadeView.Add(loListItem);
+
+
+ loListItem = new GUIListItem("Flickr - Search by tag");
+ loListItem.Path = "3";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
+
+ loListItem = new GUIListItem("Flickr - Search by text");
+ loListItem.Path = "4";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
+
+
//}
//GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + "");
}
@@ -516,7 +604,7 @@
GUIListItem item = facadeView[i];
if (!item.IsFolder && !item.IsRemote)
{
- SlideShow.Add(CurrentPhotoList[i].smallUrl);
+ SlideShow.Add(facadeView[i].ThumbnailImage);
}
i++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gre...@us...> - 2007-04-28 00:26:06
|
Revision: 348
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=348&view=rev
Author: gregmac45
Date: 2007-04-27 17:25:53 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/OnlinePhotos/Flickr.cs
trunk/plugins/OnlinePhotos/MyClass.cs
Modified: trunk/plugins/OnlinePhotos/Flickr.cs
===================================================================
--- trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-27 16:26:25 UTC (rev 347)
+++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-28 00:25:53 UTC (rev 348)
@@ -46,6 +46,70 @@
}
+ public static List<MyAlbum> getUserPhotoSets(String username)
+ {
+ List<MyAlbum> myPhotoSets = new List<MyAlbum>();
+ String userID = getUserId(username);
+ if (userID == String.Empty)
+ {
+ return myPhotoSets;
+ }
+ //_flickr.Photo
+ Photosets sets = _flickr.PhotosetsGetList(userID);
+
+
+ foreach (Photoset set in sets.PhotosetCollection)
+ {
+ myPhotoSets.Add(loadPhotoSet(set));
+ }
+ //set.
+ return myPhotoSets;
+
+
+ }
+ public static MyAlbum loadPhotoSet(Photoset set)
+ {
+ MyAlbum album = new MyAlbum();
+ album.id = set.PhotosetId;
+ album.title = set.Title;
+ album.coverThumbnailUrl = set.PhotosetThumbnailUrl;
+ album.photoCollection = loadMyPhotoList(set.PhotoCollection);
+ return album;
+
+ }
+ public static List<MyPhoto> getPhotoSetPhotos(String photoSetId)
+ {
+ Photo[] userPhotosArray = _flickr.PhotosetsGetPhotos(photoSetId);
+ Photos userPhotos = new Photos();
+ foreach (Photo photo in userPhotosArray)
+ {
+ userPhotos.PhotoCollection.Add(photo);
+ }
+ return loadMyPhotoList(userPhotos);
+
+
+ }
+ public static List<MyAlbum> getGroupsByText(String text)
+ {
+ GroupSearchResults results = _flickr.GroupsSearch(text);
+ List<MyAlbum> groups = new List<MyAlbum>();
+ MyAlbum group ;
+ foreach (GroupSearchResult result in results.Groups)
+ {
+ group = new MyAlbum();
+ group.id = result.GroupId;
+ group.title = result.GroupName;
+ groups.Add(group);
+ }
+ return groups;
+ //result.
+ }
+ public static void getGroupPhotos(String groupId){
+ //brasil-brazil
+ _flickr.GroupPoolGetPhotos(groupId);
+ }
+
+
public static List<MyPhoto> getInterestingPhotos(){
PhotoSearchExtras extras = new PhotoSearchExtras();
Photos photos = _flickr.InterestingnessGetList(extras,50,1);
@@ -68,6 +132,15 @@
Photos photos = _flickr.PhotosSearchText(text);
return loadMyPhotoList(photos);
}
+ private static List<MyPhoto> loadMyPhotoList(Photo[] photoArray)
+ {
+ Photos photos = new Photos();
+ foreach(Photo photo in photoArray)
+ {
+ photos.PhotoCollection.Add(photo);
+ }
+ return loadMyPhotoList(photos);
+ }
private static List<MyPhoto> loadMyPhotoList(Photos photos)
{
List<MyPhoto> myPhotoList = new List<MyPhoto>();
Modified: trunk/plugins/OnlinePhotos/MyClass.cs
===================================================================
--- trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-27 16:26:25 UTC (rev 347)
+++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-28 00:25:53 UTC (rev 348)
@@ -42,6 +42,13 @@
public String smallUrl;
public String ThumbName;
}
+ public class MyAlbum
+ {
+ public string id;
+ public string title;
+ public string coverThumbnailUrl;
+ public List<MyPhoto> photoCollection = new List<MyPhoto>();
+ }
/// <summary>
/// Description of MyClass.
@@ -57,6 +64,7 @@
private State _CurrentState = State.home;
protected View currentView = View.List;
protected List<MyPhoto> CurrentPhotoList;
+ protected List<MyAlbum> CurrentAlbumList;
protected bool _imagesDone = true;
public enum State
{
@@ -261,6 +269,22 @@
}
break;
+ case "5":
+ DisplayFlickrUserPhotos("gregmac45");
+ _CurrentState = State.categories;
+
+
+ break;
+ case "6":
+ string gtext = "";
+ if (GetUserInputString(ref gtext))
+ {
+
+ DisplayFlickrGroupsWithText(gtext);
+ _CurrentState = State.categories;
+
+ }
+ break;
}
}
}
@@ -285,6 +309,17 @@
CurrentPhotoList = MyFlickr.getPhotosByText(text);
DisplayCurrentPhotos();
}
+ public void DisplayFlickrGroupsWithText(String text)
+ {
+ CurrentAlbumList = MyFlickr.getGroupsByText(text);
+ DisplayCurrentAlbums();
+ }
+ public void DisplayFlickrUserPhotos(String user)
+ {
+ CurrentPhotoList = MyFlickr.getUserPhotos(user);
+ DisplayCurrentPhotos();
+ }
+
private bool GetUserInputString(ref string sString)
{
VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
@@ -295,6 +330,7 @@
if (keyBoard.IsConfirmed) sString = keyBoard.Text;
return keyBoard.IsConfirmed;
}
+
public void DisplayCurrentPhotos()
{
facadeView.Clear();
@@ -330,6 +366,39 @@
}
}
+ public void DisplayCurrentAlbums()
+ {
+ facadeView.Clear();
+ GUIListItem item;
+ int i = 0;
+ List<String> ImageList = new List<string>();
+ foreach (MyAlbum album in CurrentAlbumList)
+ {
+ item = new GUIListItem(album.title);
+ item.Path = album.id;
+ item.ItemId = i;
+ item.RetrieveArt = false;
+ item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
+ item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
+ ImageList.Add(album.coverThumbnailUrl);
+ facadeView.Add(item);
+ GUIWindowManager.Process();
+ i++;
+
+ }
+ BackgroundWorker worker = new BackgroundWorker();
+
+ worker.DoWork += new DoWorkEventHandler(downloadImages);
+ worker.RunWorkerAsync(ImageList);
+
+ using (WaitCursor cursor = new WaitCursor())
+ {
+ while (_imagesDone == false)
+ {
+ GUIWindowManager.Process();
+ }
+ }
+ }
private String GetThumbnail(String lsUrl)
{
string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl);
@@ -547,8 +616,18 @@
loListItem.IsFolder = true;
MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
facadeView.Add(loListItem);
-
+ loListItem = new GUIListItem("Flickr - My Photos");
+ loListItem.Path = "5";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
+
+ loListItem = new GUIListItem("Flickr - Search Groups");
+ loListItem.Path = "6";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
//}
//GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + "");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gre...@us...> - 2007-05-04 00:46:25
|
Revision: 371
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=371&view=rev
Author: gregmac45
Date: 2007-05-03 17:46:15 -0700 (Thu, 03 May 2007)
Log Message:
-----------
Added Picasa access
Modified Paths:
--------------
trunk/plugins/OnlinePhotos/Flickr.cs
trunk/plugins/OnlinePhotos/MyClass.cs
trunk/plugins/OnlinePhotos/OnlinePhotos.csproj
trunk/plugins/OnlinePhotos/OnlinePhotos.sln
trunk/plugins/OnlinePhotos/OnlinePhotos.suo
Added Paths:
-----------
trunk/plugins/OnlinePhotos/Picasa.cs
trunk/plugins/OnlinePhotos/google-sharp/
trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/GoogleConnection.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/GoogleService.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/MultipartRequest.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/NoCheckCertificatePolicy.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/AlbumAccess.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/CreateAlbumException.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/DeleteAlbumException.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/GDataApi.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaAlbum.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaAlbumCollection.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaPicture.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaPictureCollection.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaWeb.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadPictureException.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadProgressEventArgs.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadProgressEventHandler.cs
trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/XmlUtil.cs
trunk/plugins/OnlinePhotos/google-sharp/PicasaNet.csproj
Modified: trunk/plugins/OnlinePhotos/Flickr.cs
===================================================================
--- trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-03 08:25:35 UTC (rev 370)
+++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -46,6 +46,16 @@
}
+ public static List<MyPhoto> getUserFavoritePhotos(String username){
+ List<MyPhoto> myPhotoList = new List<MyPhoto>();
+ String userID = getUserId(username);
+ if (userID == String.Empty)
+ {
+ return myPhotoList;
+ }
+ Photos userPhotos = _flickr.FavoritesGetPublicList(userID);
+ return loadMyPhotoList(userPhotos);
+ }
public static List<MyAlbum> getUserPhotoSets(String username)
{
List<MyAlbum> myPhotoSets = new List<MyAlbum>();
@@ -71,7 +81,7 @@
{
MyAlbum album = new MyAlbum();
album.id = set.PhotosetId;
- album.title = set.Title;
+ album.Title = set.Title;
album.coverThumbnailUrl = set.PhotosetThumbnailUrl;
album.photoCollection = loadMyPhotoList(set.PhotoCollection);
return album;
@@ -98,7 +108,7 @@
{
group = new MyAlbum();
group.id = result.GroupId;
- group.title = result.GroupName;
+ group.Title = result.GroupName;
groups.Add(group);
}
return groups;
Modified: trunk/plugins/OnlinePhotos/MyClass.cs
===================================================================
--- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-03 08:25:35 UTC (rev 370)
+++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -16,497 +16,597 @@
using System.Xml;
using System.Net;
using System.Web;
+using System.IO;
using System.ComponentModel;
namespace OnlinePhotos
{
- public class MyPhoto
- {
- private String title;
- public String Title
- {
- get
- {
- return title;
- }
- set
- {
- title = value;
- ThumbName = Utils.GetFilename(Utils.GetThumb(value));
- }
- }
- public String id;
- public String thumbnailUrl;
- public String largeUrl;
- public String mediumUrl;
- public String smallUrl;
- public String ThumbName;
- }
- public class MyAlbum
- {
- public string id;
- public string title;
- public string coverThumbnailUrl;
- public List<MyPhoto> photoCollection = new List<MyPhoto>();
- }
+ public class MyPhoto
+ {
+ private String title;
+ public String Title
+ {
+ get
+ {
+ return title;
+ }
+ set
+ {
+ title = value;
+
+ }
+ }
+ public String id;
+ public String thumbnailUrl;
+ public String largeUrl;
+ public String mediumUrl;
+ public String smallUrl;
+ private String thumbName;
+ public String ThumbName{
+ get{
+ if(String.IsNullOrEmpty(thumbName)){
+ thumbName = Utils.GetFilename(Utils.GetThumb(title))+id;
+ }
+ return thumbName;
+ }
+ }
+ }
+ public class MyAlbum
+ {
+ public string id;
+ private string title;
+ public string coverThumbnailUrl;
+ private String thumbName;
+ public List<MyPhoto> photoCollection = new List<MyPhoto>();
+ public String Title
+ {
+ get
+ {
+ return title;
+ }
+ set
+ {
+ title = value;
+ //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value));
+ }
+ }
+ public String ThumbName{
+ get{
+ if(String.IsNullOrEmpty(thumbName)){
+ thumbName = Utils.GetFilename(Utils.GetThumb(title))+id;
+ }
+ return thumbName;
+ }
+ }
+ }
- /// <summary>
- /// Description of MyClass.
- /// </summary>
- public class MyOnlinePhotos : GUIWindow, ISetupForm
- {
- [SkinControlAttribute(2)]
- protected GUIButtonControl btnViewAs = null;
- [SkinControlAttribute(3)]
- protected GUIButtonControl btnSlide = null;
- [SkinControlAttribute(50)]
- protected GUIFacadeControl facadeView = null;
- private State _CurrentState = State.home;
- protected View currentView = View.List;
- protected List<MyPhoto> CurrentPhotoList;
- protected List<MyAlbum> CurrentAlbumList;
- protected bool _imagesDone = true;
- public enum State
- {
- home = 0,
- categories = 1,
- videos = 2
- }
- public enum View
- {
- List = 0,
- Icons = 1,
- LargeIcons = 2,
- FilmStrip = 3
- }
+ /// <summary>
+ /// Description of MyClass.
+ /// </summary>
+ public class MyOnlinePhotos : GUIWindow, ISetupForm
+ {
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl btnViewAs = null;
+ [SkinControlAttribute(3)]
+ protected GUIButtonControl btnSlide = null;
+ [SkinControlAttribute(50)]
+ protected GUIFacadeControl facadeView = null;
+ private State _CurrentState = State.home;
+ protected View currentView = View.List;
+ protected List<MyPhoto> CurrentPhotoList;
+ protected List<MyAlbum> CurrentAlbumList;
+ protected MyAlbum CurrentAlbum;
+ protected bool _imagesDone = true;
+ protected bool _stopImgDownload = false;
+ public enum State
+ {
+ home = 0,
+ albums = 1,
+ photos = 2,
+ album_photos = 3
+ }
+ public enum View
+ {
+ List = 0,
+ Icons = 1,
+ LargeIcons = 2,
+ FilmStrip = 3
+ }
- public string PluginName()
- {
+ public string PluginName()
+ {
- return "Online Photos";
+ return "Online Photos";
- }
+ }
- // Returns the description of the plugin is shown in the plugin menu
+ // Returns the description of the plugin is shown in the plugin menu
- public string Description()
- {
+ public string Description()
+ {
- return "Flickr and Google Photo Plugin";
+ return "Flickr and Google Photo Plugin";
- }
+ }
- // Returns the author of the plugin which is shown in the plugin menu
+ // Returns the author of the plugin which is shown in the plugin menu
- public string Author()
- {
+ public string Author()
+ {
- return "GregMac45";
+ return "GregMac45";
- }
+ }
- // show the setup dialog
+ // show the setup dialog
- public void ShowPlugin()
- {
+ public void ShowPlugin()
+ {
- //MessageBox.Show("Nothing to configure, this is just an example");
+ //MessageBox.Show("Nothing to configure, this is just an example");
- }
+ }
- // Indicates whether plugin can be enabled/disabled
+ // Indicates whether plugin can be enabled/disabled
- public bool CanEnable()
- {
+ public bool CanEnable()
+ {
- return true;
+ return true;
- }
+ }
- // get ID of windowplugin belonging to this setup
+ // get ID of windowplugin belonging to this setup
- public int GetWindowId()
- {
+ public int GetWindowId()
+ {
- return GetID;
+ return GetID;
- }
+ }
- // Indicates if plugin is enabled by default;
+ // Indicates if plugin is enabled by default;
- public bool DefaultEnabled()
- {
+ public bool DefaultEnabled()
+ {
- return true;
+ return true;
- }
+ }
- // indicates if a plugin has its own setup screen
+ // indicates if a plugin has its own setup screen
- public bool HasSetup()
- {
+ public bool HasSetup()
+ {
- return false;
+ return false;
- }
- public override int GetID
- {
- get
- {
- return 5757;
- }
- set
- {
- }
- }
+ }
+ public override int GetID
+ {
+ get
+ {
+ return 5757;
+ }
+ set
+ {
+ }
+ }
- public override bool Init()
- {
- LoadSettings();
- return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml");
+ public override bool Init()
+ {
+ LoadSettings();
+ return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml");
- }
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = PluginName();
+ }
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = PluginName();
- strButtonImage = String.Empty;
+ strButtonImage = String.Empty;
- strButtonImageFocus = String.Empty;
+ strButtonImageFocus = String.Empty;
- strPictureImage = 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 Photos");
- DisplayHome();
- //DisplaySites();
- }
- else if (_CurrentState == State.categories)
- {
- DisplayCurrentPhotos();
- }
- currentView = View.Icons;
- ChangeFacadeView();
-
-
- base.OnPageLoad();
- }
- 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)
- {
- DisplayHome();
- _CurrentState = State.home;
- return;
- }
- }
- base.OnAction(action);
- }
- protected override void OnPageDestroy(int new_windowId)
- {
+ 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 Photos");
+ DisplayHome();
+ //DisplaySites();
+ }
+ else if (_CurrentState == State.photos)
+ {
+ DisplayCurrentPhotos(false);
+ }
+ currentView = View.Icons;
+ ChangeFacadeView();
+
+
+ base.OnPageLoad();
+ }
+ public override void OnAction(Action action)
+ {
+ if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
+ {
+ if (_CurrentState == State.album_photos)
+ {
+ DisplayCurrentAlbums();
+ _CurrentState = State.albums;
+ return;
+ }
+ else if (_CurrentState == State.albums || _CurrentState == State.photos)
+ {
+ DisplayHome();
+ _CurrentState = State.home;
+ return;
+ }
+ _stopImgDownload = true;
+
+ }
+ base.OnAction(action);
+ }
+ protected override void OnPageDestroy(int new_windowId)
+ {
- base.OnPageDestroy(new_windowId);
- }
-
- protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
- {
- if (control == btnViewAs)
- {
- ChangeFacadeView();
- }
- else if (control == btnSlide)
- {
- OnSlideShow();
- }
- else if (control == facadeView)
- {
- String SelectedSiteId = facadeView.SelectedListItem.Path;
- switch (SelectedSiteId)
- {
- case "1":
- DisplayInterestingFlickrPhotos();
- _CurrentState = State.categories;
- break;
- case "2":
- DisplayRecentFlickrPhotos();
- _CurrentState = State.categories;
- break;
- case "3":
- string q = "";
- if (GetUserInputString(ref q))
- {
+ base.OnPageDestroy(new_windowId);
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ if (control == btnViewAs)
+ {
+ ChangeFacadeView();
+ }
+ else if (control == btnSlide)
+ {
+ OnSlideShow();
+ }
+ else if (control == facadeView && _CurrentState == State.home)
+ {
+ String SelectedSiteId = facadeView.SelectedListItem.Path;
+ switch (SelectedSiteId)
+ {
+ case "1":
+ DisplayInterestingFlickrPhotos();
+ _CurrentState = State.photos;
+ break;
+ case "2":
+ DisplayRecentFlickrPhotos();
+ _CurrentState = State.photos;
+ break;
+ case "3":
+ string q = "";
+ if (GetUserInputString(ref q))
+ {
- DisplayFlickrPhotosWithTags(q);
- _CurrentState = State.categories;
-
- }
- break;
- case "4":
- string text = "";
- if (GetUserInputString(ref text))
- {
+ DisplayFlickrPhotosWithTags(q);
+ _CurrentState = State.photos;
+
+ }
+ break;
+ case "4":
+ string text = "";
+ if (GetUserInputString(ref text))
+ {
- DisplayFlickrPhotosWithText(text);
- _CurrentState = State.categories;
+ DisplayFlickrPhotosWithText(text);
+ _CurrentState = State.photos;
- }
- break;
- case "5":
- DisplayFlickrUserPhotos("gregmac45");
- _CurrentState = State.categories;
+ }
+ break;
+ case "5":
+ DisplayFlickrUserPhotos("gregmac45");
+ _CurrentState = State.photos;
-
- break;
- case "6":
- string gtext = "";
- if (GetUserInputString(ref gtext))
- {
+
+ break;
+ case "6":
+ string gtext = "";
+ if (GetUserInputString(ref gtext))
+ {
+ DisplayFlickrGroupsWithText(gtext);
+ _CurrentState = State.photos;
+ }
+ break;
+ case "7":
+ DisplayFlickrUserFavoritePhotos("gregmac45");
+ _CurrentState = State.photos;
+ break;
+ case "8":
+ DisplayPicasaAlbums("gregmac45");
+ _CurrentState = State.albums;
+ break;
+ }
+ }
+ else if (control == facadeView && _CurrentState == State.albums)
+ {
+ _stopImgDownload = true;
+ CurrentAlbum = CurrentAlbumList[facadeView.SelectedListItemIndex];
+ DisplayAlbumPhotos();
+
+ _CurrentState = State.album_photos;
+ }
+ else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos))
+ {
+ OnShowPicture(facadeView.SelectedListItem.ThumbnailImage);
+ }
+ }
+ public void DisplayInterestingFlickrPhotos()
+ {
+ CurrentPhotoList =
+ MyFlickr.getInterestingPhotos();
+ DisplayCurrentPhotos();
+ }
+ public void DisplayRecentFlickrPhotos()
+ {
+ CurrentPhotoList = MyFlickr.getRecentPhotos();
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrPhotosWithTags(String tags)
+ {
+ CurrentPhotoList = MyFlickr.getPhotosByTag(tags);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrPhotosWithText(String text)
+ {
+ CurrentPhotoList = MyFlickr.getPhotosByText(text);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrGroupsWithText(String text)
+ {
+ CurrentAlbumList = MyFlickr.getGroupsByText(text);
+ DisplayCurrentAlbums();
+ }
+ public void DisplayFlickrUserPhotos(String user)
+ {
+ CurrentPhotoList = MyFlickr.getUserPhotos(user);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrUserFavoritePhotos(String user)
+ {
+ CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayPicasaAlbums(String user)
+ {
+ CurrentAlbumList = MyPicasa.getUserAlbums(user);
+ DisplayCurrentAlbums();
+ }
+ private bool GetUserInputString(ref string sString)
+ {
+ VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ keyBoard.Reset();
+ keyBoard.IsSearchKeyboard = true;
+ keyBoard.Text = sString;
+ keyBoard.DoModal(GetID); // show it...
+ if (keyBoard.IsConfirmed) sString = keyBoard.Text;
+ return keyBoard.IsConfirmed;
+ }
+ public void DisplayCurrentPhotos(){
+ DisplayCurrentPhotos(true);
+ }
+ public void DisplayCurrentPhotos(bool refresh)
+ {
+ facadeView.Clear();
+ GUIListItem item;
+ int i = 0;
+ List<String> ImageList = new List<string>();
+ foreach (MyPhoto photo in CurrentPhotoList)
+ {
+ item = new GUIListItem(photo.Title);
+ item.Path = photo.mediumUrl;
+ item.ItemId = i;
+ item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
+ if(refresh){
+ item.RetrieveArt = false;
+ item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
+
+
+ ImageList.Add(photo.mediumUrl);
+ Log.Info("setting photo to url " + photo.mediumUrl);
+ }else{
+ item.RetrieveArt = true;
+ item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
+ }
+ facadeView.Add(item);
+ //GUIWindowManager.Process();
+ i++;
- DisplayFlickrGroupsWithText(gtext);
- _CurrentState = State.categories;
+ }
+ if(refresh){
+ BackgroundWorker worker = new BackgroundWorker();
- }
- break;
- }
- }
- }
- public void DisplayInterestingFlickrPhotos()
- {
- CurrentPhotoList =
- MyFlickr.getInterestingPhotos();
- DisplayCurrentPhotos();
- }
- public void DisplayRecentFlickrPhotos()
- {
- CurrentPhotoList = MyFlickr.getRecentPhotos();
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrPhotosWithTags(String tags)
- {
- CurrentPhotoList = MyFlickr.getPhotosByTag(tags);
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrPhotosWithText(String text)
- {
- CurrentPhotoList = MyFlickr.getPhotosByText(text);
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrGroupsWithText(String text)
- {
- CurrentAlbumList = MyFlickr.getGroupsByText(text);
- DisplayCurrentAlbums();
- }
- public void DisplayFlickrUserPhotos(String user)
- {
- CurrentPhotoList = MyFlickr.getUserPhotos(user);
- DisplayCurrentPhotos();
- }
+ worker.DoWork += new DoWorkEventHandler(downloadImages);
+ worker.RunWorkerAsync(ImageList);
- private bool GetUserInputString(ref string sString)
- {
- VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
- keyBoard.Reset();
- keyBoard.IsSearchKeyboard = true;
- keyBoard.Text = sString;
- keyBoard.DoModal(GetID); // show it...
- if (keyBoard.IsConfirmed) sString = keyBoard.Text;
- return keyBoard.IsConfirmed;
- }
-
- public void DisplayCurrentPhotos()
- {
- facadeView.Clear();
- GUIListItem item;
- int i = 0;
- List<String> ImageList = new List<string>();
- foreach (MyPhoto photo in CurrentPhotoList)
- {
- item = new GUIListItem(photo.Title);
- item.Path = photo.mediumUrl;
- item.ItemId = i;
- item.RetrieveArt = false;
- item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
- item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
- ImageList.Add(photo.mediumUrl);
- Log.Info("setting photo to url " + photo.mediumUrl);
- facadeView.Add(item);
- GUIWindowManager.Process();
- i++;
+ using (WaitCursor cursor = new WaitCursor())
+ {
+ while (_imagesDone == false)
+ {
+ GUIWindowManager.Process();
+ }
+ }
+ }
- }
- BackgroundWorker worker = new BackgroundWorker();
+ }
+ public void DisplayCurrentAlbums()
+ {
+ facadeView.Clear();
+ GUIListItem item;
+ int i = 0;
+ List<String> ImageList = new List<string>();
+ foreach (MyAlbum album in CurrentAlbumList)
+ {
+ item = new GUIListItem(album.Title);
+ item.Path = album.id;
+ item.ItemId = i;
+ //item.IsFolder = true;
+ item.RetrieveArt = false;
+ item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
+ item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
+ ImageList.Add(album.coverThumbnailUrl);
+ Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl);
+ facadeView.Add(item);
+ GUIWindowManager.Process();
+ i++;
- worker.DoWork += new DoWorkEventHandler(downloadImages);
- worker.RunWorkerAsync(ImageList);
+ }
+ BackgroundWorker worker = new BackgroundWorker();
- using (WaitCursor cursor = new WaitCursor())
- {
- while (_imagesDone == false)
- {
- GUIWindowManager.Process();
- }
- }
+ worker.DoWork += new DoWorkEventHandler(downloadImages);
+ worker.RunWorkerAsync(ImageList);
- }
- public void DisplayCurrentAlbums()
- {
- facadeView.Clear();
- GUIListItem item;
- int i = 0;
- List<String> ImageList = new List<string>();
- foreach (MyAlbum album in CurrentAlbumList)
- {
- item = new GUIListItem(album.title);
- item.Path = album.id;
- item.ItemId = i;
- item.RetrieveArt = false;
- item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
- item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
- ImageList.Add(album.coverThumbnailUrl);
- facadeView.Add(item);
- GUIWindowManager.Process();
- i++;
+ using (WaitCursor cursor = new WaitCursor())
+ {
+ while (_imagesDone == false)
+ {
+ GUIWindowManager.Process();
+ }
+ }
+ }
+ private void DisplayAlbumPhotos(){
+ CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id);
+ DisplayCurrentPhotos();
+ }
+ private String GetThumbnail(String lsUrl)
+ {
+ string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl);
+ lsThumb = System.IO.Path.GetFileName(lsThumb);
+ string lsThumbsDir = "C:\\Temp\\";
+ if (System.IO.Directory.Exists(lsThumbsDir) == false)
+ {
+ System.IO.Directory.CreateDirectory(lsThumbsDir);
+ }
+ lsThumb = lsThumbsDir + lsThumb;
+ //Log.Info(lsThumb);
+ if (System.IO.File.Exists(lsThumb) == false)
+ {
+ String lsFilename = System.IO.Path.GetFileName(lsThumb);
+ //moLog.Info("Filename will be {0}", lsFilename);
+ MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb);
+ }
+ if (System.IO.File.Exists(lsThumb))
+ {
+ //facadeView[liIdx].IconImageBig = lsThumb;
+ return lsThumb;
+ }
+ else
+ {
+ return "";
+ //facadeView[liIdx].IconImageBig = "";
+ }
+ }
+ public void downloadImages(object sender, DoWorkEventArgs e)
+ {
+ _imagesDone = false;
+ _stopImgDownload = false;
+ List<String> imageList = (List<String>)e.Argument;
+ WebClient client = new WebClient();
+ int i=0;
+ String imageLocation;
+ foreach (String url in imageList)
+ {
+ if(_stopImgDownload){
+ break;
+ }
+ if(inPhotoState() ){
+ imageLocation = "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg";
+ }else{
+ imageLocation = "C:\\Temp\\" + CurrentAlbumList[i].ThumbName + ".jpg";
+ }
+ if(System.IO.File.Exists(imageLocation) == false){
+ client.DownloadFile(url, imageLocation);
+ }
+ facadeView[i].RetrieveArt = true;
+ facadeView[i].RefreshCoverArt();
+ i++;
+
+
+ }
+ _imagesDone = true;
+ }
+ public bool inPhotoState(){
+ return _CurrentState == State.album_photos || _CurrentState == State.photos;
+ }
+ void OnRetrieveCoverArt(GUIListItem item)
+ {
+ if(inPhotoState() ){
+ item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg";
+ }else{
+ item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg";
+ }
+ }
- }
- BackgroundWorker worker = new BackgroundWorker();
+ private void item_OnItemSelected(GUIListItem item, GUIControl parent)
+ {
+ GUIFilmstripControl filmstrip = parent as GUIFilmstripControl;
+ if (filmstrip == null)
+ return;
+ filmstrip.InfoImageFileName = item.ThumbnailImage;
+ }
- worker.DoWork += new DoWorkEventHandler(downloadImages);
- worker.RunWorkerAsync(ImageList);
+ private void ChangeFacadeView()
+ {
+
+
+ switch (currentView)
+ {
+ case View.List:
+ currentView = View.Icons;
+ facadeView.View = GUIFacadeControl.ViewMode.SmallIcons;
+ break;
+ case View.Icons:
+ currentView = View.LargeIcons;
+ facadeView.View = GUIFacadeControl.ViewMode.LargeIcons;
+ break;
+ case View.LargeIcons:
+ currentView = View.FilmStrip;
+ facadeView.View = GUIFacadeControl.ViewMode.Filmstrip;
+ break;
+ case View.FilmStrip:
+ currentView = View.List;
+ facadeView.View = GUIFacadeControl.ViewMode.List;
+ break;
+ }
+ GUIControl.FocusControl(GetID, facadeView.GetID);
- using (WaitCursor cursor = new WaitCursor())
- {
- while (_imagesDone == false)
- {
- GUIWindowManager.Process();
- }
- }
- }
- private String GetThumbnail(String lsUrl)
- {
- string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl);
- lsThumb = System.IO.Path.GetFileName(lsThumb);
- string lsThumbsDir = "C:\\Temp\\";
- if (System.IO.Directory.Exists(lsThumbsDir) == false)
- {
- System.IO.Directory.CreateDirectory(lsThumbsDir);
- }
- lsThumb = lsThumbsDir + lsThumb;
- //Log.Info(lsThumb);
- if (System.IO.File.Exists(lsThumb) == false)
- {
- String lsFilename = System.IO.Path.GetFileName(lsThumb);
- //moLog.Info("Filename will be {0}", lsFilename);
- MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb);
- }
- ...
[truncated message content] |
|
From: <gre...@us...> - 2007-05-05 00:39:14
|
Revision: 377
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=377&view=rev
Author: gregmac45
Date: 2007-05-04 17:39:12 -0700 (Fri, 04 May 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/OnlinePhotos/MyClass.cs
trunk/plugins/OnlinePhotos/OnlinePhotos.csproj
trunk/plugins/OnlinePhotos/OnlinePhotos.suo
trunk/plugins/OnlinePhotos/myonlinephotos.xml
Modified: trunk/plugins/OnlinePhotos/MyClass.cs
===================================================================
--- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-04 17:23:57 UTC (rev 376)
+++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-05 00:39:12 UTC (rev 377)
@@ -9,14 +9,18 @@
using System;
using MediaPortal;
using MediaPortal.Util;
+using MediaPortal.Utils;
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;
using MediaPortal.GUI.Pictures;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Xml;
using System.Net;
using System.Web;
using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
using System.ComponentModel;
namespace OnlinePhotos
@@ -36,6 +40,7 @@
}
}
+
public String id;
public String thumbnailUrl;
public String largeUrl;
@@ -87,10 +92,37 @@
{
[SkinControlAttribute(2)]
protected GUIButtonControl btnViewAs = null;
- [SkinControlAttribute(3)]
+ [SkinControlAttribute(3)]
+ protected GUIButtonControl btnFlickr = null;
+ [SkinControlAttribute(31)]
+ protected GUIButtonControl btnFlickrPhotos = null;
+ [SkinControlAttribute(32)]
+ protected GUIButtonControl btnFlickrSets = null;
+ [SkinControlAttribute(33)]
+ protected GUIButtonControl btnFlickrFav = null;
+ [SkinControlAttribute(34)]
+ protected GUIButtonControl btnInterest = null;
+ [SkinControlAttribute(35)]
+ protected GUIButtonControl btnRecent = null;
+ [SkinControlAttribute(36)]
+ protected GUIButtonControl btnSearchTag = null;
+ [SkinControlAttribute(37)]
+ protected GUIButtonControl btnSearchTxt = null;
+ [SkinControlAttribute(38)]
+ protected GUIButtonControl btnSearchGrp = null;
+ [SkinControlAttribute(4)]
+ protected GUIButtonControl btnPicasa = null;
+ [SkinControlAttribute(41)]
+ protected GUIButtonControl btnPicasaPhotos = null;
+ [SkinControlAttribute(5)]
protected GUIButtonControl btnSlide = null;
+ [SkinControlAttribute(6)]
+ protected GUIButtonControl btnClearCache = null;
+ [SkinControlAttribute(7)]
+ protected GUIButtonControl btnSettings = null;
[SkinControlAttribute(50)]
protected GUIFacadeControl facadeView = null;
+ GUISlideShow _SlideShow;
private State _CurrentState = State.home;
protected View currentView = View.List;
protected List<MyPhoto> CurrentPhotoList;
@@ -98,12 +130,18 @@
protected MyAlbum CurrentAlbum;
protected bool _imagesDone = true;
protected bool _stopImgDownload = false;
+ protected bool _onSlideShow = false;
+ protected string _imageDirectory = @"C:\Temp\";
+ protected NameValueCollection _photosToDownload;
+ protected NameValueCollection _AlbumCoversToDownload;
public enum State
{
home = 0,
albums = 1,
photos = 2,
- album_photos = 3
+ album_photos = 3,
+ //showpicture=4,
+ //slideshow=5
}
public enum View
{
@@ -112,75 +150,48 @@
LargeIcons = 2,
FilmStrip = 3
}
-
public string PluginName()
{
return "Online Photos";
- }
-
- // Returns the description of the plugin is shown in the plugin menu
-
+ }
public string Description()
{
return "Flickr and Google Photo 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
{
@@ -192,7 +203,6 @@
{
}
}
-
public override bool Init()
{
LoadSettings();
@@ -217,6 +227,7 @@
}
protected override void OnPageLoad()
{
+ Log.Info("in OnPageLoad");
if (_CurrentState == State.home)
{
//_log.Info("onPageLoad state home");
@@ -224,43 +235,68 @@
DisplayHome();
//DisplaySites();
}
- else if (_CurrentState == State.photos)
+ else if (_CurrentState == State.photos || _CurrentState == State.album_photos)
{
+ Log.Info("OnPageLoad with state ={0} calling DisplayCurrentPhotos with false",_CurrentState);
DisplayCurrentPhotos(false);
}
+
currentView = View.Icons;
ChangeFacadeView();
+ _onSlideShow = false;
+ if (_imagesDone == false)
+ {
+ Log.Info("OnPageLoad with state ={0} and imageDone = false calling GetImages(_photosToDownload)",_CurrentState);
+ if (_CurrentState == State.album_photos || _CurrentState == State.photos)
+ {
+ getImages(_photosToDownload);
+ }
+ }
-
base.OnPageLoad();
}
+ public override bool OnMessage(GUIMessage message)
+ {
+ return base.OnMessage(message);
+ }
public override void OnAction(Action action)
{
+
if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
{
+ Log.Info("in Action previous menu");
if (_CurrentState == State.album_photos)
{
+ _CurrentState = State.albums;
+ Log.Info(" AP - Sending request to stop img download");
+ _stopImgDownload = true;
+ System.Threading.Thread.Sleep(25);
DisplayCurrentAlbums();
- _CurrentState = State.albums;
+
+
return;
}
else if (_CurrentState == State.albums || _CurrentState == State.photos)
{
+ _CurrentState = State.home;
+ Log.Info(" P - Sending request to stop img download");
+ _stopImgDownload = true;
+ System.Threading.Thread.Sleep(25);
DisplayHome();
- _CurrentState = State.home;
+
return;
}
- _stopImgDownload = true;
+
+
}
base.OnAction(action);
- }
+ }
protected override void OnPageDestroy(int new_windowId)
{
base.OnPageDestroy(new_windowId);
- }
-
+ }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
if (control == btnViewAs)
@@ -270,10 +306,13 @@
else if (control == btnSlide)
{
OnSlideShow();
- }
+ }else if(control == btnClearCache){
+ ClearCache();
+ }
else if (control == facadeView && _CurrentState == State.home)
{
String SelectedSiteId = facadeView.SelectedListItem.Path;
+ String userInput = "" ;
switch (SelectedSiteId)
{
case "1":
@@ -285,21 +324,19 @@
_CurrentState = State.photos;
break;
case "3":
- string q = "";
- if (GetUserInputString(ref q))
+
+ if (GetUserInputString(ref userInput))
{
- DisplayFlickrPhotosWithTags(q);
+ DisplayFlickrPhotosWithTags(userInput);
_CurrentState = State.photos;
}
break;
- case "4":
- string text = "";
- if (GetUserInputString(ref text))
+ case "4":
+ if (GetUserInputString(ref userInput))
{
-
- DisplayFlickrPhotosWithText(text);
+ DisplayFlickrPhotosWithText(userInput);
_CurrentState = State.photos;
}
@@ -310,11 +347,10 @@
break;
- case "6":
- string gtext = "";
- if (GetUserInputString(ref gtext))
+ case "6":
+ if (GetUserInputString(ref userInput))
{
- DisplayFlickrGroupsWithText(gtext);
+ DisplayFlickrGroupsWithText(userInput);
_CurrentState = State.photos;
}
break;
@@ -338,7 +374,7 @@
}
else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos))
{
- OnShowPicture(facadeView.SelectedListItem.ThumbnailImage);
+ OnShowPicture(facadeView.SelectedListItem.Path);
}
}
public void DisplayInterestingFlickrPhotos()
@@ -400,7 +436,7 @@
facadeView.Clear();
GUIListItem item;
int i = 0;
- List<String> ImageList = new List<string>();
+ _photosToDownload = new NameValueCollection();
foreach (MyPhoto photo in CurrentPhotoList)
{
item = new GUIListItem(photo.Title);
@@ -412,8 +448,8 @@
item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
- ImageList.Add(photo.mediumUrl);
- Log.Info("setting photo to url " + photo.mediumUrl);
+ _photosToDownload.Add(photo.ThumbName,photo.mediumUrl);
+ //Log.Info("setting photo to url " + photo.mediumUrl);
}else{
item.RetrieveArt = true;
item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
@@ -424,18 +460,7 @@
}
if(refresh){
- BackgroundWorker worker = new BackgroundWorker();
-
- worker.DoWork += new DoWorkEventHandler(downloadImages);
- worker.RunWorkerAsync(ImageList);
-
- using (WaitCursor cursor = new WaitCursor())
- {
- while (_imagesDone == false)
- {
- GUIWindowManager.Process();
- }
- }
+ getImages(_photosToDownload);
}
}
@@ -444,7 +469,7 @@
facadeView.Clear();
GUIListItem item;
int i = 0;
- List<String> ImageList = new List<string>();
+ _AlbumCoversToDownload = new NameValueCollection();
foreach (MyAlbum album in CurrentAlbumList)
{
item = new GUIListItem(album.Title);
@@ -454,30 +479,20 @@
item.RetrieveArt = false;
item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
- ImageList.Add(album.coverThumbnailUrl);
+ _AlbumCoversToDownload.Add(album.ThumbName,album.coverThumbnailUrl);
Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl);
facadeView.Add(item);
GUIWindowManager.Process();
i++;
}
- BackgroundWorker worker = new BackgroundWorker();
-
- worker.DoWork += new DoWorkEventHandler(downloadImages);
- worker.RunWorkerAsync(ImageList);
-
- using (WaitCursor cursor = new WaitCursor())
- {
- while (_imagesDone == false)
- {
- GUIWindowManager.Process();
- }
- }
+ getImages(_AlbumCoversToDownload);
}
private void DisplayAlbumPhotos(){
CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id);
DisplayCurrentPhotos();
}
+ /*
private String GetThumbnail(String lsUrl)
{
string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl);
@@ -506,33 +521,73 @@
//facadeView[liIdx].IconImageBig = "";
}
}
+ */
+ protected void getImages(NameValueCollection imageList){
+ Log.Info("Getting images");
+ BackgroundWorker worker = new BackgroundWorker();
+
+ worker.DoWork += new DoWorkEventHandler(downloadImages);
+ worker.RunWorkerAsync(imageList);
+
+ using (WaitCursor cursor = new WaitCursor())
+ {
+ while (_imagesDone == false)
+ {
+ GUIWindowManager.Process();
+ }
+ }
+ }
public void downloadImages(object sender, DoWorkEventArgs e)
{
+ Log.Info("Downloading images");
_imagesDone = false;
_stopImgDownload = false;
- List<String> imageList = (List<String>)e.Argument;
+ //List<String> imageList = (List<String>)e.Argument;
+ NameValueCollection imgNameUrlList= (NameValueCollection) e.Argument;
WebClient client = new WebClient();
- int i=0;
- String imageLocation;
- foreach (String url in imageList)
+
+ string imageLocation;
+ string thumbnailLocation;
+ string url;
+ string name;
+ for(int i=0;i<imgNameUrlList.Count;i++)
{
+ url = imgNameUrlList.Get(i);
+ name = imgNameUrlList.GetKey(i);
+
if(_stopImgDownload){
+ Log.Info("Received Request to stop Download");
break;
}
+ Log.Info("downloading image :"+url);
+ /*
if(inPhotoState() ){
imageLocation = "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg";
}else{
imageLocation = "C:\\Temp\\" + CurrentAlbumList[i].ThumbName + ".jpg";
}
+ */
+ imageLocation = "C:\\Temp\\" + name+ "L.jpg";
+ thumbnailLocation = "C:\\Temp\\" + name+ ".jpg";
if(System.IO.File.Exists(imageLocation) == false){
client.DownloadFile(url, imageLocation);
+ if(System.IO.File.Exists(thumbnailLocation) == false){
+ //int iRotate = dbs.GetRotation(imageLocation);
+ MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0);
+ System.Threading.Thread.Sleep(25);
+ }
+ if(_onSlideShow){
+ _SlideShow.Add(imageLocation);
+ }
}
+ facadeView[i].Path = imageLocation;
facadeView[i].RetrieveArt = true;
facadeView[i].RefreshCoverArt();
- i++;
+ //i++;
}
+ Log.Info("Setting imagesDone to true");
_imagesDone = true;
}
public bool inPhotoState(){
@@ -541,20 +596,18 @@
void OnRetrieveCoverArt(GUIListItem item)
{
if(inPhotoState() ){
- item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg";
+ item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg";
}else{
- item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg";
+ item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg";
}
}
-
private void item_OnItemSelected(GUIListItem item, GUIControl parent)
{
GUIFilmstripControl filmstrip = parent as GUIFilmstripControl;
if (filmstrip == null)
return;
- filmstrip.InfoImageFileName = item.ThumbnailImage;
+ filmstrip.InfoImageFileName = item.Path;
}
-
private void ChangeFacadeView()
{
@@ -688,7 +741,12 @@
{
//facadeView.Clear();
GUIControl.ClearControl(GetID, facadeView.GetID);
-
+ hideAllButtons();
+ btnClearCache.Visible = true;
+ btnFlickr.Visible = true;
+ btnPicasa.Visible = true;
+ btnSettings.Visible = true;
+ /*
GUIListItem loListItem;
//foreach (Site loSite in moSiteList.Values)
//{
@@ -740,10 +798,30 @@
loListItem.IsFolder = true;
MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
facadeView.Add(loListItem);
-
+ */
+
//}
//GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + "");
}
+ protected void hideAllButtons() {
+ btnClearCache.Visible = false;
+ btnFlickr.Visible = false;
+ btnFlickrFav.Visible = false;
+ btnFlickrPhotos.Visible = false;
+ btnFlickrSets.Visible = false;
+ btnInterest.Visible = false;
+ btnPicasa.Visible = false;
+ btnPicasaPhotos.Visible = false;
+ btnRecent.Visible = false;
+ btnSearchGrp.Visible = false;
+ btnSearchTag.Visible = false;
+ btnSearchTxt.Visible = false;
+ btnSettings.Visible = false;
+ btnSlide.Visible = false;
+ btnViewAs.Visible = false;
+
+ }
+ /*
private void LoadFlickrCategories()
{
GUIControl.ClearControl(GetID, facadeView.GetID);
@@ -774,19 +852,29 @@
}
+ * */
void OnSlideShow()
{
OnSlideShow(0);
- }
-
+ }
void OnSlideShow(int iStartItem)
{
-
- GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
- if (SlideShow == null)
+ bool doSlide = true;
+ if(_imagesDone==false){
+ GUIDialogYesNo notify = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
+ notify.SetLine(1,"Photos are still downloading.");
+ notify.SetLine(2,"Select Yes to slide the downloaded photos.");
+ notify.DoModal(GetID);
+ doSlide = notify.IsConfirmed;
+ }
+ if(doSlide == false){
return;
+ }
+ _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ if (_SlideShow == null)
+ return;
- SlideShow.Reset();
+ _SlideShow.Reset();
if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count))
iStartItem = 0;
@@ -794,9 +882,9 @@
do
{
GUIListItem item = facadeView[i];
- if (!item.IsFolder && !item.IsRemote)
+ if (!item.IsFolder && !item.IsRemote && item.RetrieveArt)
{
- SlideShow.Add(facadeView[i].ThumbnailImage);
+ _SlideShow.Add(facadeView[i].Path);
}
i++;
@@ -807,26 +895,45 @@
}
while (i != iStartItem);
- if (SlideShow.Count > 0)
+ if (_SlideShow.Count > 0)
{
- SlideShow.StartSlideShow();
+ GUIWindowManager.Callbacks+= new GUIWindowManager.OnCallBackHandler(OnCallBack);
+ _SlideShow.StartSlideShow();
+ _onSlideShow = true;
+ //GUIWindowManager.Receivers+= new GUIWindowManager.SendMessageHandler(OnSendMessage );
+ //Action.ActionType.
GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
}
}
+ public void OnCallBack(){
+ /*
+ Log.Info("received call back with onSlideshow set to {0}",_onSlideShow);
+ if(_imagesDone==false){
+ getImages(_photosToDownload);
+ }
+ * */
+ }
void OnShowPicture(string strFile)
{
- GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
- if (SlideShow == null)
+ _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ if (_SlideShow == null)
return;
- SlideShow.Reset();
- SlideShow.Add(strFile);
+ _SlideShow.Reset();
+ _SlideShow.Add(strFile);
GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
// SlideShow.Select(strFile);
}
+ protected void ClearCache(){
+ String [] strFiles = System.IO.Directory.GetFiles(_imageDirectory,"Thumbs*.jpg");
+ foreach(String path in strFiles){
+ System.IO.File.Delete(path);
+ }
+
+ }
public void TestSlideShow(String user){
List<MyPhoto> photoList = MyFlickr.getInterestingPhotos();
GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.csproj
===================================================================
--- trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-04 17:23:57 UTC (rev 376)
+++ trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-05 00:39:12 UTC (rev 377)
@@ -33,6 +33,9 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath>
+ </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="Core">
@@ -55,6 +58,8 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Drawing.Design" />
<Reference Include="System.Xml" />
<Reference Include="Utils">
<HintPath>..\..\MediaPortal\Utils\bin\Release\Utils.DLL</HintPath>
Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.suo
===================================================================
(Binary files differ)
Modified: trunk/plugins/OnlinePhotos/myonlinephotos.xml
===================================================================
--- trunk/plugins/OnlinePhotos/myonlinephotos.xml 2007-05-04 17:23:57 UTC (rev 376)
+++ trunk/plugins/OnlinePhotos/myonlinephotos.xml 2007-05-05 00:39:12 UTC (rev 377)
@@ -25,11 +25,124 @@
</control>
<control>
<type>button</type>
- <description>slideshow button</description>
+ <description>Flickr</description>
<id>3</id>
<onright>50</onright>
+ <label>Flickr</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Picasa</description>
+ <id>4</id>
+ <onright>50</onright>
+ <label>Picasa</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>slideshow button</description>
+ <id>5</id>
+ <onright>50</onright>
<label>Slideshow</label>
</control>
+ <control>
+ <type>button</type>
+ <description>cache button</description>
+ <id>6</id>
+ <onright>50</onright>
+ <label>Clear Cache</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>cache button</description>
+ <id>7</id>
+ <onright>50</onright>
+ <label>Settings</label>
+ </control>
+ </control>
+ <control>
+ <description>group element</description>
+ <type>group</type>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <posX>60</posX>
+ <posY>97</posY>
+ <layout>StackLayout</layout>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>31</id>
+ <onright>50</onright>
+ <label>My Photos</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>32</id>
+ <onright>50</onright>
+ <label>My Photo Sets</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>33</id>
+ <onright>50</onright>
+ <label>My Favorites</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>34</id>
+ <onright>50</onright>
+ <label>Interesting Photos</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>35</id>
+ <onright>50</onright>
+ <label>Recent Photos</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>36</id>
+ <onright>50</onright>
+ <label>Search By Tag</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>37</id>
+ <onright>50</onright>
+ <label>Search by Text</label>
+ </control>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>38</id>
+ <onright>50</onright>
+ <label>Search Groups</label>
</control>
- </controls>
+ </control>
+ <control>
+ <description>group element</description>
+ <type>group</type>
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="500">WindowClose</animation>
+ <animation effect="slide" time="250" start="-300,0">WindowOpen</animation>
+ <animation effect="slide" time="500" end="0,-300">WindowClose</animation>
+ <posX>60</posX>
+ <posY>97</posY>
+ <layout>StackLayout</layout>
+ <control>
+ <type>button</type>
+ <description>Flickr</description>
+ <id>41</id>
+ <onright>50</onright>
+ <label>My Photos</label>
+ </control>
+ </control>
+ </controls>
</window>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gre...@us...> - 2007-05-07 02:00:12
|
Revision: 383
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=383&view=rev
Author: gregmac45
Date: 2007-05-06 19:00:09 -0700 (Sun, 06 May 2007)
Log Message:
-----------
Fixed GUI,
AddFixed GUI,
Added Settings,
Added Flickr photo sets,
Fixed various Bugs
Modified Paths:
--------------
trunk/plugins/OnlinePhotos/Flickr.cs
trunk/plugins/OnlinePhotos/MyClass.cs
trunk/plugins/OnlinePhotos/myonlinephotos.xml
Modified: trunk/plugins/OnlinePhotos/Flickr.cs
===================================================================
--- trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-06 18:24:35 UTC (rev 382)
+++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-07 02:00:09 UTC (rev 383)
@@ -145,6 +145,9 @@
private static List<MyPhoto> loadMyPhotoList(Photo[] photoArray)
{
Photos photos = new Photos();
+ if (photoArray == null)
+ return new List<MyPhoto>();
+
foreach(Photo photo in photoArray)
{
photos.PhotoCollection.Add(photo);
Modified: trunk/plugins/OnlinePhotos/MyClass.cs
===================================================================
--- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-06 18:24:35 UTC (rev 382)
+++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-07 02:00:09 UTC (rev 383)
@@ -13,6 +13,7 @@
using MediaPortal.GUI.Library;
using MediaPortal.Dialogs;
using MediaPortal.GUI.Pictures;
+using MediaPortal.Configuration;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Xml;
@@ -25,73 +26,80 @@
namespace OnlinePhotos
{
- public class MyPhoto
- {
- private String title;
- public String Title
- {
- get
- {
- return title;
- }
- set
- {
- title = value;
-
- }
- }
-
- public String id;
- public String thumbnailUrl;
- public String largeUrl;
- public String mediumUrl;
- public String smallUrl;
- private String thumbName;
- public String ThumbName{
- get{
- if(String.IsNullOrEmpty(thumbName)){
- thumbName = Utils.GetFilename(Utils.GetThumb(title))+id;
- }
- return thumbName;
- }
- }
- }
- public class MyAlbum
- {
- public string id;
- private string title;
- public string coverThumbnailUrl;
- private String thumbName;
- public List<MyPhoto> photoCollection = new List<MyPhoto>();
- public String Title
- {
- get
- {
- return title;
- }
- set
- {
- title = value;
- //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value));
- }
- }
- public String ThumbName{
- get{
- if(String.IsNullOrEmpty(thumbName)){
- thumbName = Utils.GetFilename(Utils.GetThumb(title))+id;
- }
- return thumbName;
- }
- }
- }
+ public class MyPhoto
+ {
+ private String title;
+ public String Title
+ {
+ get
+ {
+ return title;
+ }
+ set
+ {
+ title = value;
- /// <summary>
- /// Description of MyClass.
- /// </summary>
- public class MyOnlinePhotos : GUIWindow, ISetupForm
- {
- [SkinControlAttribute(2)]
- protected GUIButtonControl btnViewAs = null;
+ }
+ }
+
+ public String id;
+ public String thumbnailUrl;
+ public String largeUrl;
+ public String mediumUrl;
+ public String smallUrl;
+ private String thumbName;
+ public String ThumbName
+ {
+ get
+ {
+ if (String.IsNullOrEmpty(thumbName))
+ {
+ thumbName = Utils.GetFilename(Utils.GetThumb(title)) + id;
+ }
+ return thumbName;
+ }
+ }
+ }
+ public class MyAlbum
+ {
+ public string id;
+ private string title;
+ public string coverThumbnailUrl;
+ private String thumbName;
+ public List<MyPhoto> photoCollection = new List<MyPhoto>();
+ public String Title
+ {
+ get
+ {
+ return title;
+ }
+ set
+ {
+ title = value;
+ //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value));
+ }
+ }
+ public String ThumbName
+ {
+ get
+ {
+ if (String.IsNullOrEmpty(thumbName))
+ {
+ thumbName = Utils.GetFilename(Utils.GetThumb(title)) + id;
+ }
+ return thumbName;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Description of MyClass.
+ /// </summary>
+ public class MyOnlinePhotos : GUIWindow, ISetupForm
+ {
+
+ [SkinControlAttribute(2)]
+ protected GUIButtonControl btnViewAs = null;
[SkinControlAttribute(3)]
protected GUIButtonControl btnFlickr = null;
[SkinControlAttribute(31)]
@@ -112,698 +120,750 @@
protected GUIButtonControl btnSearchGrp = null;
[SkinControlAttribute(4)]
protected GUIButtonControl btnPicasa = null;
- [SkinControlAttribute(41)]
- protected GUIButtonControl btnPicasaPhotos = null;
- [SkinControlAttribute(5)]
- protected GUIButtonControl btnSlide = null;
+ //[SkinControlAttribute(41)]
+ //protected GUIButtonControl btnPicasaPhotos = null;
+ [SkinControlAttribute(5)]
+ protected GUIButtonControl btnSlide = null;
[SkinControlAttribute(6)]
- protected GUIButtonControl btnClearCache = null;
+ protected GUIButtonControl btnClearCache = null;
[SkinControlAttribute(7)]
protected GUIButtonControl btnSettings = null;
- [SkinControlAttribute(50)]
- protected GUIFacadeControl facadeView = null;
- GUISlideShow _SlideShow;
- private State _CurrentState = State.home;
- protected View currentView = View.List;
- protected List<MyPhoto> CurrentPhotoList;
- protected List<MyAlbum> CurrentAlbumList;
- protected MyAlbum CurrentAlbum;
- protected bool _imagesDone = true;
- protected bool _stopImgDownload = false;
- protected bool _onSlideShow = false;
- protected string _imageDirectory = @"C:\Temp\";
- protected NameValueCollection _photosToDownload;
- protected NameValueCollection _AlbumCoversToDownload;
- public enum State
- {
- home = 0,
- albums = 1,
- photos = 2,
- album_photos = 3,
- //showpicture=4,
- //slideshow=5
- }
- public enum View
- {
- List = 0,
- Icons = 1,
- LargeIcons = 2,
- FilmStrip = 3
- }
- public string PluginName()
- {
+ [SkinControlAttribute(8)]
+ protected GUIButtonControl btnBack = null;
+ [SkinControlAttribute(50)]
+ protected GUIFacadeControl facadeView = null;
- return "Online Photos";
+ #region Member variables
+ GUISlideShow _SlideShow;
+ private State _CurrentState = State.HOME;
+ protected View currentView = View.LIST;
+ protected View photoView = View.LARGE_ICONS;
+ protected List<MyPhoto> CurrentPhotoList;
+ protected List<MyAlbum> CurrentAlbumList;
+ protected MyAlbum CurrentAlbum;
+ protected string _CurrentFlickrUser = "";
+ protected string _CurrentPicasaUser = "";
+ protected bool _imagesDone = true;
+ protected bool _stopImgDownload = false;
+ protected bool _onSlideShow = false;
+ protected int _SelectedAlbumIdx = -1;
+ protected int _SelectedPhotoIdx = -1;
+ //protected string _imageDirectory = Config.GetSubFolder(Config.Dir.Thumbs, @"OnlinePhotos");
+ protected string _imageDirectory = String.Empty;
+ protected NameValueCollection _photosToDownload;
+ protected NameValueCollection _AlbumCoversToDownload;
+ #endregion
+ #region Enums
+ public enum State
+ {
+ HOME,
+ FLICKR_HOME,
+ FLICKR_SETS,
+ FLICKR_SET_PHOTOS,
+ FLICKR_PHOTOS,
+ //PICASA_HOME,
+ PICASA_ALBUMS,
+ PICASA_PHOTOS
+ }
+ public enum View
+ {
+ LIST =1,
+ ICONS=2,
+ LARGE_ICONS=3,
+ FILM_STRIP=4
+ }
+ #endregion
+ public string PluginName()
+ {
- }
- public string Description()
- {
+ return "Online Photos";
- return "Flickr and Google Photo Plugin";
+ }
+ public string Description()
+ {
- }
- public string Author()
- {
+ return "Flickr and Google Photo Plugin";
- return "GregMac45";
+ }
+ public string Author()
+ {
- }
- public void ShowPlugin()
- {
+ return "GregMac45";
- //MessageBox.Show("Nothing to configure, this is just an example");
+ }
+ public void ShowPlugin()
+ {
- }
- public bool CanEnable()
- {
+ //MessageBox.Show("Nothing to configure, this is just an example");
- return true;
- }
- public int GetWindowId()
- {
+ }
+ public bool CanEnable()
+ {
- return GetID;
+ return true;
+ }
+ public int GetWindowId()
+ {
- }
- public bool DefaultEnabled()
- {
- return true;
- }
- public bool HasSetup()
- {
- return false;
- }
- public override int GetID
- {
- get
- {
- return 5757;
- }
- set
- {
- }
- }
- public override bool Init()
- {
- LoadSettings();
- return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml");
+ return GetID;
- }
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = PluginName();
+ }
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
+ public bool HasSetup()
+ {
+ return false;
+ }
+ public override int GetID
+ {
+ get
+ {
+ return 5757;
+ }
+ set
+ {
+ }
+ }
+ public override bool Init()
+ {
+ _imageDirectory = Config.GetSubFolder(Config.Dir.Thumbs, @"OnlinePhotos");
+ if (Directory.Exists(_imageDirectory) == false)
+ {
+ try
+ {
+ Directory.CreateDirectory(_imageDirectory);
+ }
+ catch (Exception)
+ {
+ //Log.Error("Unable to create thumb directory {0}", _imageDirectory);
+ _imageDirectory = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
+ }
+ }
+ _imageDirectory += "/";
+ Log.Info("OnlinePhotos thumb Dir: {0}", _imageDirectory);
+ LoadSettings();
+ return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml");
- strButtonImage = String.Empty;
+ }
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = PluginName();
- strButtonImageFocus = String.Empty;
+ strButtonImage = String.Empty;
- strPictureImage = String.Empty;
+ strButtonImageFocus = String.Empty;
- return true;
- }
- public bool ShowDefaultHome()
- {
- return true;
- }
- protected override void OnPageLoad()
- {
- Log.Info("in OnPageLoad");
- if (_CurrentState == State.home)
- {
- //_log.Info("onPageLoad state home");
- GUIPropertyManager.SetProperty("#header.label", "Online Photos");
- DisplayHome();
- //DisplaySites();
- }
- else if (_CurrentState == State.photos || _CurrentState == State.album_photos)
- {
- Log.Info("OnPageLoad with state ={0} calling DisplayCurrentPhotos with false",_CurrentState);
- DisplayCurrentPhotos(false);
- }
-
- currentView = View.Icons;
- ChangeFacadeView();
- _onSlideShow = false;
- if (_imagesDone == false)
+ strPictureImage = String.Empty;
+
+ return true;
+ }
+ public bool ShowDefaultHome()
+ {
+ return true;
+ }
+ protected override void OnPageLoad()
+ {
+ Log.Info("in OnPageLoad");
+ base.OnPageLoad();
+ switch (_CurrentState)
{
- Log.Info("OnPageLoad with state ={0} and imageDone = false calling GetImages(_photosToDownload)",_CurrentState);
- if (_CurrentState == State.album_photos || _CurrentState == State.photos)
- {
- getImages(_photosToDownload);
- }
+ case State.HOME:
+ GUIPropertyManager.SetProperty("#header.label", "Online Photos");
+ SetStateHome();
+ break;
+ case State.FLICKR_PHOTOS:
+ GUIPropertyManager.SetProperty("#header.label", "FLICKR");
+ SetStateFlickrPhotos();
+ DisplayCurrentPhotos(!_imagesDone);
+ if (_SelectedPhotoIdx > -1)
+ {
+ GUIControl.FocusControl(GetID, facadeView.GetID);
+ GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx);
+ }
+ break;
+ case State.FLICKR_SET_PHOTOS:
+ GUIPropertyManager.SetProperty("#header.label", "FLICKR");
+ SetStateFlickrSetPhotos();
+ DisplayCurrentPhotos(!_imagesDone);
+ if (_SelectedPhotoIdx > -1)
+ {
+ GUIControl.FocusControl(GetID, facadeView.GetID);
+ GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx);
+ }
+ break;
+ case State.PICASA_PHOTOS:
+ GUIPropertyManager.SetProperty("#header.label", "PICASA");
+ SetStatePicasaPhotos();
+ DisplayCurrentPhotos(!_imagesDone);
+ if (_SelectedPhotoIdx > -1)
+ {
+ GUIControl.FocusControl(GetID, facadeView.GetID);
+ GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx);
+ }
+ break;
}
-
- base.OnPageLoad();
- }
- public override bool OnMessage(GUIMessage message)
- {
- return base.OnMessage(message);
- }
- public override void OnAction(Action action)
- {
-
- if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
- {
- Log.Info("in Action previous menu");
- if (_CurrentState == State.album_photos)
- {
- _CurrentState = State.albums;
- Log.Info(" AP - Sending request to stop img download");
+
+ _onSlideShow = false;
+
+
+ }
+ public override bool OnMessage(GUIMessage message)
+ {
+ return base.OnMessage(message);
+ }
+ public override void OnAction(Action action)
+ {
+
+ if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
+ {
+ OnPreviousWindow();
+ return;
+ }
+ base.OnAction(action);
+ }
+ protected override void OnPreviousWindow()
+ {
+ Log.Info("Current state = {0}", _CurrentState);
+ switch (_CurrentState)
+ {
+ case State.FLICKR_PHOTOS:
_stopImgDownload = true;
System.Threading.Thread.Sleep(25);
- DisplayCurrentAlbums();
-
-
- return;
- }
- else if (_CurrentState == State.albums || _CurrentState == State.photos)
- {
- _CurrentState = State.home;
- Log.Info(" P - Sending request to stop img download");
+ GUIControl.ClearControl(GetID, facadeView.GetID);
+ SetStateFlickrHome();
+ //DisplayCurrentAlbums();
+ return;
+ case State.FLICKR_SETS:
_stopImgDownload = true;
System.Threading.Thread.Sleep(25);
- DisplayHome();
-
- return;
- }
-
-
-
- }
- base.OnAction(action);
- }
- protected override void OnPageDestroy(int new_windowId)
- {
+ GUIControl.ClearControl(GetID, facadeView.GetID);;
+ SetStateFlickrHome();
+ return;
+ case State.FLICKR_SET_PHOTOS:
+ _stopImgDownload = true;
+ System.Threading.Thread.Sleep(25);
+ SetStateFlickrSets();
+ DisplayCurrentAlbums();
+ if (_SelectedAlbumIdx > -1)
+ {
+ GUIControl.FocusControl(GetID, facadeView.GetID);
+ GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedAlbumIdx);
+ }
+ return;
+ case State.PICASA_ALBUMS:
+ _stopImgDownload = true;
+ System.Threading.Thread.Sleep(25);
+ GUIControl.ClearControl(GetID, facadeView.GetID);;
+ SetStateHome();
+ return;
+ case State.FLICKR_HOME:
+ //case State.PICASA_HOME:
+ SetStateHome();
+ return;
- base.OnPageDestroy(new_windowId);
- }
- protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
- {
- if (control == btnViewAs)
- {
- ChangeFacadeView();
- }
- else if (control == btnSlide)
- {
- OnSlideShow();
- }else if(control == btnClearCache){
- ClearCache();
+ case State.PICASA_PHOTOS:
+ _stopImgDownload = true;
+ System.Threading.Thread.Sleep(25);
+ SetStatePicasaAlbums();
+ DisplayCurrentAlbums();
+ if (_SelectedAlbumIdx > -1)
+ {
+ GUIControl.FocusControl(GetID, facadeView.GetID);
+ GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedAlbumIdx);
+ }
+ return;
+ default:
+ base.OnPreviousWindow();
+ break;
}
- else if (control == facadeView && _CurrentState == State.home)
- {
- String SelectedSiteId = facadeView.SelectedListItem.Path;
- String userInput = "" ;
- switch (SelectedSiteId)
- {
- case "1":
- DisplayInterestingFlickrPhotos();
- _CurrentState = State.photos;
- break;
- case "2":
- DisplayRecentFlickrPhotos();
- _CurrentState = State.photos;
- break;
- case "3":
-
- if (GetUserInputString(ref userInput))
- {
- DisplayFlickrPhotosWithTags(userInput);
- _CurrentState = State.photos;
-
- }
- break;
- case "4":
- if (GetUserInputString(ref userInput))
- {
- DisplayFlickrPhotosWithText(userInput);
- _CurrentState = State.photos;
+
+ }
+ protected override void OnPageDestroy(int new_windowId)
+ {
+ SaveSettings();
+ base.OnPageDestroy(new_windowId);
+ }
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ String userInput = "";
+ if (control == btnClearCache) ClearCache();
+ else if (control == btnViewAs) ChangeFacadeView();
+ else if (control == btnClearCache) ClearCache();
+ else if (control == btnSettings) OnSettings();
+ else if (control == btnSlide) OnSlideShow();
+ else if (control == facadeView) OnClick();
+ else if (control == btnBack) OnPreviousWindow();
+ else if (control == btnFlickr)
+ {
+ SetStateFlickrHome();
+ }
+ else if (control == btnInterest)
+ {
+ DisplayInterestingFlickrPhotos();
+ SetStateFlickrPhotos();
+ }
+ else if (control == btnRecent)
+ {
+ SetStateFlickrPhotos();
+ DisplayRecentFlickrPhotos();
+
+ }
- }
- break;
- case "5":
- DisplayFlickrUserPhotos("gregmac45");
- _CurrentState = State.photos;
+ else if (control == btnSearchTag)
+ {
+ if (GetUserInputString(ref userInput))
+ {
-
- break;
- case "6":
- if (GetUserInputString(ref userInput))
- {
- DisplayFlickrGroupsWithText(userInput);
- _CurrentState = State.photos;
- }
- break;
- case "7":
- DisplayFlickrUserFavoritePhotos("gregmac45");
- _CurrentState = State.photos;
- break;
- case "8":
- DisplayPicasaAlbums("gregmac45");
- _CurrentState = State.albums;
- break;
- }
- }
- else if (control == facadeView && _CurrentState == State.albums)
- {
- _stopImgDownload = true;
- CurrentAlbum = CurrentAlbumList[facadeView.SelectedListItemIndex];
- DisplayAlbumPhotos();
-
- _CurrentState = State.album_photos;
- }
- else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos))
- {
- OnShowPicture(facadeView.SelectedListItem.Path);
- }
- }
- public void DisplayInterestingFlickrPhotos()
- {
- CurrentPhotoList =
- MyFlickr.getInterestingPhotos();
- DisplayCurrentPhotos();
- }
- public void DisplayRecentFlickrPhotos()
- {
- CurrentPhotoList = MyFlickr.getRecentPhotos();
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrPhotosWithTags(String tags)
- {
- CurrentPhotoList = MyFlickr.getPhotosByTag(tags);
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrPhotosWithText(String text)
- {
- CurrentPhotoList = MyFlickr.getPhotosByText(text);
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrGroupsWithText(String text)
- {
- CurrentAlbumList = MyFlickr.getGroupsByText(text);
- DisplayCurrentAlbums();
- }
- public void DisplayFlickrUserPhotos(String user)
- {
- CurrentPhotoList = MyFlickr.getUserPhotos(user);
- DisplayCurrentPhotos();
- }
- public void DisplayFlickrUserFavoritePhotos(String user)
- {
- CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user);
- DisplayCurrentPhotos();
- }
- public void DisplayPicasaAlbums(String user)
- {
- CurrentAlbumList = MyPicasa.getUserAlbums(user);
- DisplayCurrentAlbums();
- }
- private bool GetUserInputString(ref string sString)
- {
- VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
- keyBoard.Reset();
- keyBoard.IsSearchKeyboard = true;
- keyBoard.Text = sString;
- keyBoard.DoModal(GetID); // show it...
- if (keyBoard.IsConfirmed) sString = keyBoard.Text;
- return keyBoard.IsConfirmed;
- }
- public void DisplayCurrentPhotos(){
- DisplayCurrentPhotos(true);
- }
- public void DisplayCurrentPhotos(bool refresh)
- {
- facadeView.Clear();
- GUIListItem item;
- int i = 0;
- _photosToDownload = new NameValueCollection();
- foreach (MyPhoto photo in CurrentPhotoList)
- {
- item = new GUIListItem(photo.Title);
- item.Path = photo.mediumUrl;
- item.ItemId = i;
- item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
- if(refresh){
- item.RetrieveArt = false;
- item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
-
-
- _photosToDownload.Add(photo.ThumbName,photo.mediumUrl);
- //Log.Info("setting photo to url " + photo.mediumUrl);
- }else{
- item.RetrieveArt = true;
- item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
- }
- facadeView.Add(item);
- //GUIWindowManager.Process();
- i++;
+ SetStateFlickrPhotos();
+ DisplayFlickrPhotosWithTags(userInput);
+
- }
- if(refresh){
- getImages(_photosToDownload);
- }
+ }
+ }
+ else if (control == btnSearchTxt)
+ {
+ if (GetUserInputString(ref userInput))
+ {
+ SetStateFlickrPhotos();
+ DisplayFlickrPhotosWithText(userInput);
+
- }
- public void DisplayCurrentAlbums()
- {
- facadeView.Clear();
- GUIListItem item;
- int i = 0;
- _AlbumCoversToDownload = new NameValueCollection();
- foreach (MyAlbum album in CurrentAlbumList)
- {
- item = new GUIListItem(album.Title);
- item.Path = album.id;
- item.ItemId = i;
- //item.IsFolder = true;
- item.RetrieveArt = false;
- item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
- item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
- _AlbumCoversToDownload.Add(album.ThumbName,album.coverThumbnailUrl);
- Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl);
- facadeView.Add(item);
- GUIWindowManager.Process();
- i++;
+ }
+ }
+ else if (control == btnFlickrSets)
+ {
+ SetStateFlickrSets();
+ DisplayFlickrUserSets(_CurrentFlickrUser);
+
+ }
+ else if (control == btnFlickrPhotos)
+ {
+ SetStateFlickrPhotos();
+ DisplayFlickrUserPhotos(_CurrentFlickrUser);
+
+ }
- }
- getImages(_AlbumCoversToDownload);
- }
- private void DisplayAlbumPhotos(){
- CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id);
- DisplayCurrentPhotos();
- }
- /*
- private String GetThumbnail(String lsUrl)
- {
- string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl);
- lsThumb = System.IO.Path.GetFileName(lsThumb);
- string lsThumbsDir = "C:\\Temp\\";
- if (System.IO.Directory.Exists(lsThumbsDir) == false)
- {
- System.IO.Directory.CreateDirectory(lsThumbsDir);
- }
- lsThumb = lsThumbsDir + lsThumb;
- //Log.Info(lsThumb);
- if (System.IO.File.Exists(lsThumb) == false)
- {
- String lsFilename = System.IO.Path.GetFileName(lsThumb);
- //moLog.Info("Filename will be {0}", lsFilename);
- MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb);
- }
- if (System.IO.File.Exists(lsThumb))
- {
- //facadeView[liIdx].IconImageBig = lsThumb;
- return lsThumb;
- }
- else
- {
- return "";
- //facadeView[liIdx].IconImageBig = "";
- }
- }
- */
- protected void getImages(NameValueCollection imageList){
+
+ else if (control == btnSearchGrp)
+ {
+ if (GetUserInputString(ref userInput))
+ {
+ SetStateFlickrPhotos();
+ DisplayFlickrGroupsWithText(userInput);
+
+ }
+ }
+ else if (control == btnFlickrFav)
+ {
+ SetStateFlickrPhotos();
+ DisplayFlickrUserFavoritePhotos(_CurrentFlickrUser);
+
+ }
+ else if (control == btnPicasa)
+ {
+ SetStatePicasaAlbums();
+ DisplayPicasaAlbums(_CurrentPicasaUser);
+ }
+ }
+ #region Flickr Api calls
+ public void DisplayInterestingFlickrPhotos()
+ {
+ CurrentPhotoList =
+ MyFlickr.getInterestingPhotos();
+ DisplayCurrentPhotos();
+ }
+ public void DisplayRecentFlickrPhotos()
+ {
+ CurrentPhotoList = MyFlickr.getRecentPhotos();
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrPhotosWithTags(String tags)
+ {
+ CurrentPhotoList = MyFlickr.getPhotosByTag(tags);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrPhotosWithText(String text)
+ {
+ CurrentPhotoList = MyFlickr.getPhotosByText(text);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrGroupsWithText(String text)
+ {
+ CurrentAlbumList = MyFlickr.getGroupsByText(text);
+ DisplayCurrentAlbums();
+ }
+ public void DisplayFlickrUserPhotos(String user)
+ {
+ CurrentPhotoList = MyFlickr.getUserPhotos(user);
+ DisplayCurrentPhotos();
+ }
+ public void DisplayFlickrUserSets(String user)
+ {
+ CurrentAlbumList = MyFlickr.getUserPhotoSets(user);
+ DisplayCurrentAlbums();
+ }
+
+ public void DisplayFlickrUserFavoritePhotos(String user)
+ {
+ CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user);
+ DisplayCurrentPhotos();
+ }
+ #endregion
+ public void DisplayPicasaAlbums(String user)
+ {
+ CurrentAlbumList = MyPicasa.getUserAlbums(user);
+ DisplayCurrentAlbums();
+ }
+ private bool GetUserInputString(ref string sString)
+ {
+ VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
+ keyBoard.Reset();
+ keyBoard.IsSearchKeyboard = true;
+ keyBoard.Text = sString;
+ keyBoard.DoModal(GetID); // show it...
+ if (keyBoard.IsConfirmed) sString = keyBoard.Text;
+ return keyBoard.IsConfirmed;
+ }
+ #region general Display album/photos
+ public void DisplayCurrentPhotos()
+ {
+ DisplayCurrentPhotos(true);
+ }
+ ...
[truncated message content] |