|
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);
- }
- 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;
- List<String> imageList = (List<String>)e.Argument;
- WebClient client = new WebClient();
- int i=0;
- foreach (String url in imageList)
- {
- client.DownloadFile(url, "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg");
- facadeView[i].RetrieveArt = true;
- facadeView[i].RefreshCoverArt();
- i++;
- }
- _imagesDone = true;
- }
- void OnRetrieveCoverArt(GUIListItem item)
- {
- item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg";
- }
+ 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);
- private void item_OnItemSelected(GUIListItem item, GUIControl parent)
- {
- GUIFilmstripControl filmstrip = parent as GUIFilmstripControl;
- if (filmstrip == null)
- return;
- filmstrip.InfoImageFileName = item.ThumbnailImage;
- }
-
- 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);
-
- 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);
-
- }
- private void LoadSettings()
- {
- XmlDocument doc = new XmlDocument();
- try
- {
- doc.Load("OnlinePhotoSettings.xml");
- /*
+ }
+ private void LoadSettings()
+ {
+ XmlDocument doc = new XmlDocument();
+ try
+ {
+ doc.Load("OnlinePhotoSettings.xml");
+ /*
XmlNode filter = doc.SelectSingleNode("//settings/filter");
String lsFilter = filter.InnerText;
msFilterArray = lsFilter.Split(new char[] { ',' });
@@ -575,130 +675,175 @@
}
moSiteList.Add(loSite.id, loSite);
}
- * */
- }
+ * */
+ }
- catch (Exception e)
- {
- //moLog.Error(e);
- Log.Error(e);
- }
- }
- private void DisplayHome()
- {
- //facadeView.Clear();
- GUIControl.ClearControl(GetID, facadeView.GetID);
+ catch (Exception e)
+ {
+ //moLog.Error(e);
+ Log.Error(e);
+ }
+ }
+ private void DisplayHome()
+ {
+ //facadeView.Clear();
+ GUIControl.ClearControl(GetID, facadeView.GetID);
- GUIListItem loListItem;
- //foreach (Site loSite in moSiteList.Values)
- //{
- loListItem = new GUIListItem("Flickr - Interesting Photos");
- loListItem.Path = "1";
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
-
- loListItem = new GUIListItem("Flickr - Recent Photos");
- loListItem.Path = "2";
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
+ GUIListItem loListItem;
+ //foreach (Site loSite in moSiteList.Values)
+ //{
+ loListItem = new GUIListItem("Flickr - Interesting Photos");
+ loListItem.Path = "1";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
+
+ 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);
+ 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);
- loListItem = new GUIListItem("Flickr - My Photos");
- loListItem.Path = "5";
- 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 + "");
- }
- private void LoadFlickrCategories()
- {
- GUIControl.ClearControl(GetID, facadeView.GetID);
+ loListItem = new GUIListItem("Flickr - My Favorites");
+ loListItem.Path = "7";
+ 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);
+
+ loListItem = new GUIListItem("Picasa - My Photos");
+ loListItem.Path = "8";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
+
+ //}
+ //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + "");
+ }
+ private void LoadFlickrCategories()
+ {
+ GUIControl.ClearControl(GetID, facadeView.GetID);
- GUIListItem loListItem;
- loListItem = new GUIListItem("..");
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
+ GUIListItem loListItem;
+ loListItem = new GUIListItem("..");
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
- loListItem = new GUIListItem("Interesting Photos");
- loListItem.Path = "1";
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
+ loListItem = new GUIListItem("Interesting Photos");
+ loListItem.Path = "1";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
- loListItem = new GUIListItem("Recent Photos");
- loListItem.Path = "2";
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
+ loListItem = new GUIListItem("Recent Photos");
+ loListItem.Path = "2";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
- loListItem = new GUIListItem("My Photos");
- loListItem.Path = "3";
- loListItem.IsFolder = true;
- MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
- facadeView.Add(loListItem);
+ loListItem = new GUIListItem("My Photos");
+ loListItem.Path = "3";
+ loListItem.IsFolder = true;
+ MediaPortal.Util.Utils.SetDefaultIcons(loListItem);
+ facadeView.Add(loListItem);
- }
- void OnSlideShow()
- {
- OnSlideShow(0);
- }
-
- void OnSlideShow(int iStartItem)
- {
+ }
+ void OnSlideShow()
+ {
+ OnSlideShow(0);
+ }
+
+ void OnSlideShow(int iStartItem)
+ {
- GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
- if (SlideShow == null)
- return;
+ GUISlideShow 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;
- int i = iStartItem;
- do
- {
- GUIListItem item = facadeView[i];
- if (!item.IsFolder && !item.IsRemote)
- {
- SlideShow.Add(facadeView[i].ThumbnailImage);
- }
+ if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count))
+ iStartItem = 0;
+ int i = iStartItem;
+ do
+ {
+ GUIListItem item = facadeView[i];
+ if (!item.IsFolder && !item.IsRemote)
+ {
+ SlideShow.Add(facadeView[i].ThumbnailImage);
+ }
- i++;
- if (i >= CurrentPhotoList.Count)
- {
- i = 0;
- }
- }
- while (i != iStartItem);
+ i++;
+ if (i >= CurrentPhotoList.Count)
+ {
+ i = 0;
+ }
+ }
+ while (i != iStartItem);
- if (SlideShow.Count > 0)
- {
- SlideShow.StartSlideShow();
- GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
- }
- }
- }
-}
\ No newline at end of file
+ if (SlideShow.Count > 0)
+ {
+ SlideShow.StartSlideShow();
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ }
+ }
+ void OnShowPicture(string strFile)
+ {
+ GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ if (SlideShow == null)
+ return;
+
+
+ SlideShow.Reset();
+ SlideShow.Add(strFile);
+
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ // SlideShow.Select(strFile);
+
+ }
+ public void TestSlideShow(String user){
+ List<MyPhoto> photoList = MyFlickr.getInterestingPhotos();
+ GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ if (SlideShow == null)
+ return;
+
+ SlideShow.Reset();
+
+ foreach(MyPhoto photo in photoList){
+ SlideShow.Add(photo.mediumUrl);
+ }
+
+ if (SlideShow.Count > 0)
+ {
+ SlideShow.StartSlideShow();
+ GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW);
+ }
+ }
+ }
+}
Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.csproj
===================================================================
--- trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-03 08:25:35 UTC (rev 370)
+++ trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-04 00:46:15 UTC (rev 371)
@@ -6,13 +6,18 @@
<OutputType>Library</OutputType>
<RootNamespace>OnlinePhotos</RootNamespace>
<AssemblyName>OnlinePhotos</AssemblyName>
+ <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+ <NoStdLib>False</NoStdLib>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
- <OutputPath>bin\Debug\</OutputPath>
- <DebugSymbols>True</DebugSymbols>
+ <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath>
+ <DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
+ <Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath>
@@ -21,6 +26,13 @@
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
+ <RegisterForComInterop>False</RegisterForComInterop>
+ <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
+ <BaseAddress>4194304</BaseAddress>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <FileAlignment>4096</FileAlignment>
+ </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="Core">
@@ -29,7 +41,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Databases">
- <HintPath>..\..\MediaPortal\Databases\bin\Release\Databases.DLL</HintPath>
+ <HintPath>..\..\Mediaportal\Databases\bin\Release\Databases.DLL</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
@@ -59,5 +71,12 @@
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Flickr.cs" />
<Compile Include="MyClass.cs" />
+ <Compile Include="Picasa.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="google-sharp\PicasaNet.csproj">
+ <Project>{7B1FD153-0301-41F0-87EA-FB862148D6C9}</Project>
+ <Name>PicasaNet</Name>
+ </ProjectReference>
+ </ItemGroup>
</Project>
\ No newline at end of file
Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.sln
===================================================================
--- trunk/plugins/OnlinePhotos/OnlinePhotos.sln 2007-05-03 08:25:35 UTC (rev 370)
+++ trunk/plugins/OnlinePhotos/OnlinePhotos.sln 2007-05-04 00:46:15 UTC (rev 371)
@@ -6,6 +6,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunner", "..\TestRunner\TestRunner.csproj", "{1EE2BACD-3C01-495E-A06E-F739D649A1ED}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PicasaNet", "google-sharp\PicasaNet.csproj", "{7B1FD153-0301-41F0-87EA-FB862148D6C9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -20,5 +22,17 @@
{1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Release|Any CPU.Build.0 = Release|Any CPU
{1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ E4238A46-225D-4827-A429-849098A94F8A.Debug|Any CPU.Build.0 = Debug|Any CPU
+ E4238A46-225D-4827-A429-849098A94F8A.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ E4238A46-225D-4827-A429-849098A94F8A.Release|Any CPU.Build.0 = Release|Any CPU
+ E4238A46-225D-4827-A429-849098A94F8A.Release|Any CPU.ActiveCfg = Release|Any CPU
+ 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Debug|Any CPU.Build.0 = Debug|Any CPU
+ 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Release|Any CPU.Build.0 = Release|Any CPU
+ 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal
Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.suo
===================================================================
(Binary files differ)
Added: trunk/plugins/OnlinePhotos/Picasa.cs
===================================================================
--- trunk/plugins/OnlinePhotos/Picasa.cs (rev 0)
+++ trunk/plugins/OnlinePhotos/Picasa.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -0,0 +1,75 @@
+/*
+ * Created by SharpDevelop.
+ * User: GZamor1
+ * Date: 5/3/2007
+ * Time: 2:11 PM
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+
+using System;
+using Mono.Google;
+using Mono.Google.Picasa;
+using System.Collections.Generic;
+namespace OnlinePhotos
+{
+ /// <summary>
+ /// Description of Picasa.
+ /// </summary>
+ public class MyPicasa
+ {
+ private static PicasaAlbumCollection _albumCollection;
+
+ public static List<MyAlbum> getUserAlbums(String user){
+ List<MyAlbum> MyAlbumList = new List<MyAlbum>();
+ GoogleConnection conn = new GoogleConnection (GoogleService.Picasa);
+ //conn.Authenticate("gregandsamira","53025302");
+ PicasaWeb picasa = new PicasaWeb(conn,user);
+ _albumCollection = picasa.GetAlbums();
+ foreach(PicasaAlbum album in _albumCollection.AllValues){
+ MyAlbumList.Add(loadPhotoAlbum(album));
+ }
+ return MyAlbumList;
+ }
+ public static List<MyPhoto> getAlbumPhotos(String id){
+ List<MyPhoto> photoList = new List<MyPhoto>();
+ if(_albumCollection==null){
+ return photoList;
+ }
+ return loadMyPhotoList(_albumCollection[id].GetPictures());
+ }
+ private static MyAlbum loadPhotoAlbum(PicasaAlbum picasaAlbum)
+ {
+ MyAlbum myAlbum = new MyAlbum();
+ myAlbum.id = picasaAlbum.UniqueID;
+ myAlbum.Title = picasaAlbum.Title;
+ myAlbum.coverThumbnailUrl = picasaAlbum.Thumbnail;
+ //myAlbum.photoCollection = loadMyPhotoList(picasaAlbum.GetPictures());
+ return myAlbum;
+
+ }
+ private static List<MyPhoto> loadMyPhotoList(PicasaPictureCollection photos)
+ {
+ List<MyPhoto> myPhotoList = new List<MyPhoto>();
+ if(photos == null || photos.Count ==0){
+ return myPhotoList;
+ }
+ MyPhoto myPhoto;
+ foreach (PicasaPicture photo in photos.AllValues)
+ {
+ myPhoto = new MyPhoto();
+ myPhoto.id = photo.UniqueID;
+ myPhoto.Title = photo.Title;
+ myPhoto.largeUrl = photo.ImageURL;
+ myPhoto.mediumUrl = photo.ImageURL;
+ myPhoto.smallUrl = photo.ImageURL;
+ myPhoto.thumbnailUrl = photo.ThumbnailURL;
+ myPhotoList.Add(myPhoto);
+ //photo.;
+ }
+
+ return myPhotoList;
+
+ }
+ }
+}
Added: trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs
===================================================================
--- trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -0,0 +1,31 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("PicasaNet")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PicasaNet")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
Added: trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs
===================================================================
--- trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs (rev 0)
+++ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -0,0 +1,158 @@
+//
+// Mono.Google.Authentication.cs:
+//
+// Authors:
+// Gonzalo Paniagua Javier (go...@xi...)
+// Stephane Delcroix (ste...@de...)
+//
+// (C) Copyright 2006 Novell, Inc. (http://www.novell.com)
+// (C) Copyright 2007 S. Delcroix
+//
+
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Check the Google Authentication Page at http://code.google.com/apis/accounts/AuthForInstalledApps.html
+//
+
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Web;
+
+namespace Mono.Google {
+ class Authentication {
+ static string client_login_url = "https://www.google.com/accounts/ClientLogin";
+
+ public static string GetAuthorization (GoogleConnection conn, string email, string password,
+ GoogleService service, string token, string captcha)
+ {
+ if (email == null || email == String.Empty || password == null || password == String.Empty)
+ return null;
+
+ email = HttpUtility.UrlEncode (email);
+ password = HttpUtility.UrlEncode (password);
+ string appname = HttpUtility.UrlEncode (conn.ApplicationName);
+ string service_code = service.ServiceCode;
+
+ StringBuilder content = new StringBuilder ();
+ content.Append ("accountType=HOSTED_OR_GOOGLE");
+ content.AppendFormat ("&Email={0}", email);
+ content.AppendFormat ("&Passwd={0}", password);
+ content.AppendFormat ("&email={0}", email);
+ content.AppendFormat ("&service={0}", service_code);
+ content.AppendFormat ("&source={0}", appname);
+
+ if (token != null) {
+ content.AppendFormat ("&logintoken={0}", token);
+ content.AppendFormat ("&logincaptcha={0}", captcha);
+ }
+ byte [] bytes = Encoding.UTF8.GetBytes (content.ToString ());
+
+ HttpWebRequest request = (HttpWebRequest) WebRequest.Create (client_login_url);
+ request.Method = "POST";
+ request.ContentType = "application/x-www-form-urlencoded";
+ request.ContentLength = bytes.Length;
+
+ Stream output = request.GetRequestStream ();
+ output.Write (bytes, 0, bytes.Length);
+ output.Close ();
+
+ HttpWebResponse response = null;
+ try {
+ response = (HttpWebResponse) request.GetResponse ();
+ } catch (WebException wexc) {
+ response = wexc.Response as HttpWebResponse;
+ if (response == null)
+ throw;
+ ThrowOnError (response);
+ throw; // if the method above does not throw, we do
+ }
+
+ //string sid = null;
+ //string lsid = null;
+ string auth = null;
+
+ using (Stream stream = response.GetResponseStream ()) {
+ StreamReader sr = new StreamReader (stream, Encoding.UTF8);
+ string s;
+ while ((s = sr.ReadLine ()) != null) {
+ if (s.StartsWith ("Auth="))
+ auth = s.Substring (5);
+ //else if (s.StartsWith ("LSID="))
+ // lsid = s.Substring (5);
+ //else if (s.StartsWith ("SID="))
+ // sid = s.Substring (4);
+ }
+ }
+ response.Close ();
+
+ return auth;
+ }
+
+ static void ThrowOnError (HttpWebResponse response)
+ {
+ if (response.StatusCode != HttpStatusCode.Forbidden)
+ return;
+
+ string url = null;
+ string token = null;
+ string captcha_url = null;
+ string code = null;
+ using (StreamReader reader = new StreamReader (response.GetResponseStream ())) {
+ string str;
+ while ((str = reader.ReadLine ()) != null) {
+ if (str.StartsWith ("Url=")) {
+ url = str.Substring (4);
+ } else if (str.StartsWith ("Error=")) {
+ /* These are the values for Error
+ None,
+ BadAuthentication,
+ NotVerified,
+ TermsNotAgreed,
+ CaptchaRequired,
+ Unknown,
+ AccountDeleted,
+ AccountDisabled,
+ ServiceUnavailable
+ */
+ code = str.Substring (6);
+ } else if (str.StartsWith ("CaptchaToken=")) {
+ token = str.Substring (13);
+ } else if (str.StartsWith ("CaptchaUrl=")) {
+ captcha_url = str.Substring (11);
+ }
+ }
+ }
+ if (code == "CaptchaRequired" && token != null && captcha_url != null) {
+ if (url != null) {
+ Uri uri = new Uri (url);
+ captcha_url = new Uri (uri, captcha_url).ToString ();
+ } else if (!captcha_url.StartsWith ("https://")) {
+ captcha_url = "https://www.google.com/accounts/" + captcha_url;
+ }
+ throw new CaptchaException (url, token, captcha_url);
+ }
+
+ throw new UnauthorizedAccessException (String.Format ("Access to '{0}' is denied ({1})", url, code));
+ }
+ }
+}
+
Added: trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs
===================================================================
--- trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs (rev 0)
+++ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs 2007-05-04 00:46:15 UTC (rev 371)
@@ -0,0 +1,87 @@
+//
+// Mono.Google.CaptchaException
+//
+// Authors:
+// Gonzalo Paniagua Javier (go...@no...)
+//
+// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Mono.Google {
+ [Serializable]
+ public class CaptchaException : UnauthorizedAccessException, ISerializable
+ {
+ public static string UnlockCaptchaURL = "https://www.google.com/accounts/DisplayUnlockCaptcha";
+ string url;
+ string token;
+ string captcha_url;
+
+ public CaptchaException ()
+ {
+ }
+
+ public CaptchaException (string url, string token, string captcha_url)
+ {...
[truncated message content] |