~ubuntu-branches/debian/squeeze/f-spot/squeeze

« back to all changes in this revision

Viewing changes to extensions/Exporters/FacebookExport/Mono.Facebook/Album.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Mirco Bauer, Iain Lane
  • Date: 2009-02-07 20:23:32 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090207202332-oc93rfjo1st0571s
Tags: 0.5.0.3-2
[ Mirco Bauer]
* Upload to unstable.
* debian/control:
  + Lowered GNOME# build-deps to 2.0 ABI as that transition didn't happen
    yet in unstable.

[ Iain Lane ]
* debian/patches/svn-r4545_locales-import.dpatch: Patch backported from SVN
  trunk revision 4545 - initialize the translation catalog earlier (LP: #293305)
  (Closes: #514457). Thanks to Florian Heinle for finding the patch and to
  Chris Coulson for preparing the update.
* debian/control: Build-depend on libmono-dev (>= 1.2.4) to match configure
  checks.
* debian/rules: Pass CSC=/usr/bin/csc to configure for gio-sharp to fix FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Mono.Facebook.Album.cs:
 
3
//
 
4
// Authors:
 
5
//      Thomas Van Machelen (thomas.vanmachelen@gmail.com)
 
6
//
 
7
// (C) Copyright 2007 Novell, Inc. (http://www.novell.com)
 
8
//
 
9
 
 
10
// Permission is hereby granted, free of charge, to any person obtaining
 
11
// a copy of this software and associated documentation files (the
 
12
// "Software"), to deal in the Software without restriction, including
 
13
// without limitation the rights to use, copy, modify, merge, publish,
 
14
// distribute, sublicense, and/or sell copies of the Software, and to
 
15
// permit persons to whom the Software is furnished to do so, subject to
 
16
// the following conditions:
 
17
//
 
18
// The above copyright notice and this permission notice shall be
 
19
// included in all copies or substantial portions of the Software.
 
20
//
 
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
22
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
23
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
24
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
25
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
26
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
27
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
28
//
 
29
using System;
 
30
using System.Collections.Generic;
 
31
using System.IO;
 
32
using System.Xml.Serialization;
 
33
using System.Text;
 
34
using System.Net;
 
35
 
 
36
namespace Mono.Facebook
 
37
{
 
38
        [XmlRoot ("photos_createAlbum_response", Namespace="http://api.facebook.com/1.0/")]
 
39
        public class Album : SessionWrapper
 
40
        {
 
41
                [XmlElement ("aid")]
 
42
                public long AId;
 
43
 
 
44
                [XmlElement ("cover_pid")]
 
45
                public long ConverPId;
 
46
 
 
47
                [XmlElement ("owner")]
 
48
                public int Owner;
 
49
 
 
50
                [XmlElement ("name")]
 
51
                public string Name;
 
52
 
 
53
                [XmlElement ("created")]
 
54
                public int Created;
 
55
 
 
56
                [XmlElement ("modified")]
 
57
                public int Modified;
 
58
 
 
59
                [XmlElement ("description")]
 
60
                public string Description;
 
61
 
 
62
                [XmlElement ("location")]
 
63
                public string Location;
 
64
 
 
65
                [XmlElement ("link")]
 
66
                public string Link;
 
67
 
 
68
                [XmlIgnore ()]
 
69
                public Uri Uri
 
70
                {
 
71
                        get { return new Uri (Link); }
 
72
                }
 
73
 
 
74
                public Photo[] GetPhotos ()
 
75
                {
 
76
                        PhotosResponse rsp = Session.Util.GetResponse<PhotosResponse> ("facebook.photos.get",
 
77
                                FacebookParam.Create ("aid", AId),
 
78
                                FacebookParam.Create ("session_key", Session.SessionKey),
 
79
                                FacebookParam.Create ("call_id", DateTime.Now.Ticks));
 
80
 
 
81
                        foreach (Photo p in rsp.Photos)
 
82
                                p.Session = Session;
 
83
 
 
84
                        return rsp.Photos;
 
85
                }
 
86
 
 
87
                public Tag[] GetTags ()
 
88
                {
 
89
                        StringBuilder pids = new StringBuilder ();
 
90
 
 
91
                        foreach (Photo p in GetPhotos ()) {
 
92
                                if (pids.Length > 0)
 
93
                                        pids.Append (",");
 
94
 
 
95
                                pids.Append (p.PId);
 
96
                        }
 
97
 
 
98
                        PhotoTagsResponse rsp = Session.Util.GetResponse<PhotoTagsResponse> ("facebook.photos.getTags",
 
99
                                FacebookParam.Create ("pids", pids),
 
100
                                FacebookParam.Create ("session_key", Session.SessionKey),
 
101
                                FacebookParam.Create ("call_id", System.DateTime.Now.Ticks));
 
102
 
 
103
                        foreach (Tag t in rsp.Tags)
 
104
                                t.Session = Session;
 
105
 
 
106
                        return rsp.Tags;
 
107
                }
 
108
 
 
109
 
 
110
                public Photo Upload (string caption, string path)
 
111
                {
 
112
                        Photo uploaded = Session.Util.Upload (AId, caption, path, Session.SessionKey);
 
113
                        uploaded.Session = this.Session;
 
114
 
 
115
                        return uploaded;
 
116
                }
 
117
        }
 
118
}