-rw-r--r-- | content/flickr.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/content/flickr.js b/content/flickr.js index b8360c1..e09d5f0 100644 --- a/content/flickr.js +++ b/content/flickr.js | |||
@@ -88,24 +88,25 @@ Photo.prototype = { | |||
88 | // TODO: urls/url/@type urls/url | 88 | // TODO: urls/url/@type urls/url |
89 | } | 89 | } |
90 | }; | 90 | }; |
91 | 91 | ||
92 | function Flickr() { } | 92 | function Flickr() { } |
93 | Flickr.prototype = { | 93 | Flickr.prototype = { |
94 | 94 | ||
95 | rest_url: 'http://www.flickr.com/services/rest/', | 95 | rest_url: 'http://www.flickr.com/services/rest/', |
96 | auth_url: 'http://flickr.com/services/auth/', | 96 | auth_url: 'http://flickr.com/services/auth/', |
97 | photo_url: 'http://static.flickr.com/', | 97 | photo_url: 'http://static.flickr.com/', |
98 | photos_url: 'http://www.flickr.com/photos/', | 98 | photos_url: 'http://www.flickr.com/photos/', |
99 | upload_url: 'http://www.flickr.com/services/upload/', | 99 | upload_url: 'http://www.flickr.com/services/upload/', |
100 | uploader_edit_url: 'http://www.flickr.com/tools/uploader_edit.gne', | ||
100 | 101 | ||
101 | api_sig: function(paramstr) { | 102 | api_sig: function(paramstr) { |
102 | return MD5(toutf8(this.api_shs+paramstr)); | 103 | return MD5(toutf8(this.api_shs+paramstr)); |
103 | }, | 104 | }, |
104 | api_call_url: function(params,url) { | 105 | api_call_url: function(params,url) { |
105 | params.api_key = this.api_key; | 106 | params.api_key = this.api_key; |
106 | var pp = new Array(); | 107 | var pp = new Array(); |
107 | for(var p in params) { | 108 | for(var p in params) { |
108 | pp.push(p); | 109 | pp.push(p); |
109 | } | 110 | } |
110 | var pstr = ''; | 111 | var pstr = ''; |
111 | var rv = (url?url:this.rest_url)+'?'; | 112 | var rv = (url?url:this.rest_url)+'?'; |
@@ -266,24 +267,28 @@ Flickr.prototype = { | |||
266 | return this.photos_url + this.user.nsid + '/' + p; | 267 | return this.photos_url + this.user.nsid + '/' + p; |
267 | }, | 268 | }, |
268 | make_photo_url: function(p,sfx) { | 269 | make_photo_url: function(p,sfx) { |
269 | if(sfx=='p') | 270 | if(sfx=='p') |
270 | return this.get_photo_page_url(p); | 271 | return this.get_photo_page_url(p); |
271 | else | 272 | else |
272 | return this.get_image_url(p,sfx); | 273 | return this.get_image_url(p,sfx); |
273 | }, | 274 | }, |
274 | make_photoset_url: function(ps) { | 275 | make_photoset_url: function(ps) { |
275 | // TODO: allow for using someone else's photoset? | 276 | // TODO: allow for using someone else's photoset? |
276 | return this.photos_url+this.user.nsid+'/sets/'+ps.id; | 277 | return this.photos_url+this.user.nsid+'/sets/'+ps.id; |
277 | }, | 278 | }, |
279 | make_uploader_edit_url: function(pid) { | ||
280 | // TODO: handle arrays | ||
281 | return this.uploader_edit_url+'?ids='+pid; | ||
282 | }, | ||
278 | 283 | ||
279 | upload_file: function(f,fa,on_success,on_failure) { | 284 | upload_file: function(f,fa,on_success,on_failure) { |
280 | try { | 285 | try { |
281 | var fi = Components.classes["@mozilla.org/file/local;1"] | 286 | var fi = Components.classes["@mozilla.org/file/local;1"] |
282 | .createInstance(Components.interfaces.nsILocalFile); | 287 | .createInstance(Components.interfaces.nsILocalFile); |
283 | fi.initWithPath( f ); | 288 | fi.initWithPath( f ); |
284 | var st = Components.classes["@mozilla.org/network/file-input-stream;1"] | 289 | var st = Components.classes["@mozilla.org/network/file-input-stream;1"] |
285 | .createInstance(Components.interfaces.nsIFileInputStream); | 290 | .createInstance(Components.interfaces.nsIFileInputStream); |
286 | st.init(fi,0x01,00004,null); | 291 | st.init(fi,0x01,00004,null); |
287 | var bis = Components.classes["@mozilla.org/binaryinputstream;1"] | 292 | var bis = Components.classes["@mozilla.org/binaryinputstream;1"] |
288 | .createInstance(Components.interfaces.nsIBinaryInputStream); | 293 | .createInstance(Components.interfaces.nsIBinaryInputStream); |
289 | bis.setInputStream(st); | 294 | bis.setInputStream(st); |