|
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.
|