shoeset

Check-in [47fdc533c5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:First commit of App, still WIP
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 47fdc533c521db5bbe9dd651ed2308759b353fcb2ff0f2268ee169aff355164e
User & Date: i5ivem@gmail.com 2010-03-16 15:27:02
Context
2010-03-16
15:27
use snippet to return tag cloud check-in: 5df11ad2cc user: i5ivem@gmail.com tags: trunk
15:27
First commit of App, still WIP check-in: 47fdc533c5 user: i5ivem@gmail.com tags: trunk
2010-03-01
16:32
first commit check-in: ce86a2ab3d user: i5ivem@gmail.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added shoeset.rb.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
Shoes.setup do
	gem 'flickraw'
end

require 'flickraw'
require 'yaml'

Shoes.app do

	FlickRaw.api_key=""
	FlickRaw.shared_secret=""
	
	TOKENFILE = ENV['HOME']+"\\.shoeset.yml"
	#Load token if it exists
	if File.exists?(TOKENFILE)
				$SETTINGS = YAML::load(File.read(TOKENFILE))
				@token = $SETTINGS["Token"]
				auth = flickr.auth.checkToken :auth_token => @token
	else

		frob = flickr.auth.getFrob
		auth_url = FlickRaw.auth_url :frob => frob, :perms => 'read'
	
		para "Click to authorise with Flickr : ", link("Authorise", :click =>auth_url)
		para "Click OK when you are finished."
		@okbutton = button "OK" do
			begin
				auth = flickr.auth.getToken :frob => frob
				
				$SETTINGS = { "Token" => auth.token }
				f = File.open(TOKENFILE, 'w')
				f.write(YAML.dump $SETTINGS)
				f.close

			rescue FlickRaw::FailedResponse => e
				para "Authentication failed : #{e.msg}"
			end
		end
	end
	login = flickr.test.login
	para "You are authenticated as #{login.username} with token #{auth.token}"
	@setlist = []
	@photosetlist = flickr.photosets.getList.each do |set|
		@setlist << set["title"]
	end

	list_box :items => @setlist, 
		:chose => @setlist[0] do |set|
			para set.text
			photosetinfo = @photosetlist.select {|s| s["title"] == set.text}
			debug(photosetinfo)
			debug photosetinfo[0]["id"].to_s #it's an array of a hash. Even though just one
			photosetphotos = flickr.photosets.getPhotos(:photoset_id => photosetinfo[0]["id"] )
			debug(photosetphotos["photo"])
			photosetphotos["photo"].each do |photo|
				debug flickr.tags.getListPhoto(:photo_id => photo["id"])
				# Need to build tag cloud from this. Either "_content" or "raw" for the tag names
				# Could have a look at this http://github.com/ninajansen/cloud
				# Otherwise need to build one.
			end

		#what to do
		end

	

	debug(flickr.photosets.getList)

end