1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
$NetBSD: patch-FlickrRemote.cs,v 1.2 2015/05/24 06:50:14 kefren Exp $
Make it compile with newer flickrnet
--- src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs.orig 2010-12-19 15:34:42.000000000 +0200
+++ src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs 2015-05-23 13:25:26.000000000 +0300
@@ -11,6 +11,7 @@
*/
using System;
using System.IO;
+using System.Linq;
using System.Text;
using System.Collections;
using FlickrNet;
@@ -22,7 +23,7 @@
namespace FSpot.Exporters.Flickr {
public class FlickrRemote {
- public static Licenses licenses;
+ public static LicenseCollection licenses;
private string frob;
private string token;
private Auth auth;
@@ -62,28 +63,29 @@
get { return flickr; }
}
- public License[] GetLicenses ()
+ public LicenseCollection GetLicenses ()
{
// Licenses won't change normally in a user session
if (licenses == null) {
try {
licenses = flickr.PhotosLicensesGetInfo();
} catch (FlickrNet.FlickrApiException e ) {
- Log.Error (e.Code + ": " + e.Verbose );
+ Log.Error (e.Code + ": " + e.Message );
return null;
}
}
- return licenses.LicenseCollection;
+ return licenses;
}
public ArrayList Search (string[] tags, int licenseId)
{
+ var options = new PhotoSearchOptions { Tags = tags.Aggregate((a, b) => a + " " + b) };
ArrayList photos_url = new ArrayList ();
// Photos photos = flickr.PhotosSearchText (tags, licenseId);
- Photos photos = flickr.PhotosSearch (tags);
+ PhotoCollection photos = flickr.PhotosSearch (options);
if (photos != null) {
- foreach (FlickrNet.Photo photo in photos.PhotoCollection) {
+ foreach (FlickrNet.Photo photo in photos) {
photos_url.Add (photo.ThumbnailUrl);
}
}
@@ -93,11 +95,14 @@
public ArrayList Search (string tags, int licenseId)
{
+ var options = new PhotoSearchOptions{Tags = tags};
ArrayList photos_url = new ArrayList ();
- Photos photos = flickr.PhotosSearchText (tags, licenseId);
+ // XXX: ignore license, probably should also set
+ // options.licenses
+ PhotoCollection photos = flickr.PhotosSearch (options);
if (photos != null) {
- foreach (FlickrNet.Photo photo in photos.PhotoCollection) {
+ foreach (FlickrNet.Photo photo in photos) {
photos_url.Add (photo.ThumbnailUrl);
}
}
@@ -126,7 +131,7 @@
return auth;
} catch (FlickrNet.FlickrApiException ex) {
- Log.Error ("Problems logging in to Flickr - " + ex.Verbose);
+ Log.Error ("Problems logging in to Flickr - " + ex.Message);
return null;
}
}
|