-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlickrStore.boo
69 lines (52 loc) · 2 KB
/
FlickrStore.boo
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
/* This file is a part of Flickroff
*
* Copyright (C) 2008:
*
* Authors:
* Michael Dominic K. <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
namespace Flickroff
import System
import FlickrNet
static class FlickrStore ():
_flickr as Flickr
HasToken as bool:
get:
return false if _flickr.AuthToken == null
return true
def Initialize ():
_flickr = Flickr ("346e3a9b94fb2195c2f9288534fb9864", "1758b49cce06594d")
_flickr.AuthToken = Config.Token
def GetFrob () as string:
return _flickr.AuthGetFrob ()
def GetUrlForFrob (frob) as string:
return _flickr.AuthCalcUrl (frob, AuthLevel.Read)
def GetTokenForFrob (frob):
token = _flickr.AuthGetToken (frob).Token
Config.Token = token
_flickr.AuthToken = token
def GetPhotosForPhotoset (photoset as Photoset) as (Photo):
return _flickr.PhotosetsGetPhotos (photoset.PhotosetId).PhotoCollection
def GetPhotosets () as (Photoset):
return _flickr.PhotosetsGetList ().PhotosetCollection
def GetPhotosNotInSet () as (Photo):
return _flickr.PhotosGetNotInSet ().PhotoCollection
def GetOriginalPhotoUrl (photo as Photo) as string:
sizes = _flickr.PhotosGetSizes (photo.PhotoId)
for size in sizes.SizeCollection:
return size.Source if size.Label == "Original"
raise Exception ("FIXME: No original size!")