summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-10-09 19:02:55 (UTC)
committer Michael Krelin <hacker@klever.net>2006-10-09 19:02:55 (UTC)
commitda97ac566cb06a583bd8b84b9e1275e37ea0a3ca (patch) (unidiff)
tree14bad35b9e44ad58719d9704e89569bb9e842f09
parentb427de69c7df035643b95f9e2b1ed31276765065 (diff)
downloadfireflix-da97ac566cb06a583bd8b84b9e1275e37ea0a3ca.zip
fireflix-da97ac566cb06a583bd8b84b9e1275e37ea0a3ca.tar.gz
fireflix-da97ac566cb06a583bd8b84b9e1275e37ea0a3ca.tar.bz2
incomplete workaround for absense of owner information in Photo when generating url
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@188 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/flickr.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/content/flickr.js b/content/flickr.js
index b5bfa43..75d1a72 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -242,35 +242,40 @@ Flickr.prototype = {
242 get_photo_url: function(ser,id,sec,sfx,ext) { 242 get_photo_url: function(ser,id,sec,sfx,ext) {
243 var rv = this.photo_url + ser + '/' + id + '_' + sec; 243 var rv = this.photo_url + ser + '/' + id + '_' + sec;
244 if(sfx && sfx!='_') rv += '_'+sfx; 244 if(sfx && sfx!='_') rv += '_'+sfx;
245 rv += ext?'.'+ext:'.jpg'; 245 rv += ext?'.'+ext:'.jpg';
246 return rv; 246 return rv;
247 }, 247 },
248 get_image_url: function(o,sfx) { 248 get_image_url: function(o,sfx) {
249 return this.get_photo_url( 249 return this.get_photo_url(
250 o.server, 250 o.server,
251 (o instanceof Photoset)? o.primary : o.id, 251 (o instanceof Photoset)? o.primary : o.id,
252 o.secret, 252 o.secret,
253 sfx, 253 sfx,
254 (sfx=='o')?o.originalformat:null 254 (sfx=='o')?o.originalformat:null
255 ); 255 );
256 }, 256 },
257 get_photo_page_url: function(p) { 257 get_photo_page_url: function(p) {
258 if(p instanceof Photo) // TODO: half wrong, what if no owner? 258 if(p instanceof Photo) {
259 return this.photos_url + (p.owner.nsid?p.owner.nsid:this.user.nsid) + '/' + p.id; 259 // TODO: track photoset and user owner id from there?
260 else // TODO: take owner into account? 260 // The approach below is sheerly wrong.
261 var o = this.user.nsid;
262 if(p.owner && p.owner.nsid) o = p.owner.nsid;
263 var rv = this.photos_url + o +'/' + p.id;
264 return rv;
265 }else // TODO: take owner into account?
261 return this.photos_url + this.user.nsid + '/' + p; 266 return this.photos_url + this.user.nsid + '/' + p;
262 }, 267 },
263 make_photo_url: function(p,sfx) { 268 make_photo_url: function(p,sfx) {
264 if(sfx=='p') 269 if(sfx=='p')
265 return this.get_photo_page_url(p); 270 return this.get_photo_page_url(p);
266 else 271 else
267 return this.get_image_url(p,sfx); 272 return this.get_image_url(p,sfx);
268 }, 273 },
269 274
270 upload_file: function(f,fa,on_success,on_failure) { 275 upload_file: function(f,fa,on_success,on_failure) {
271 try { 276 try {
272 var fi = Components.classes["@mozilla.org/file/local;1"] 277 var fi = Components.classes["@mozilla.org/file/local;1"]
273 .createInstance(Components.interfaces.nsILocalFile); 278 .createInstance(Components.interfaces.nsILocalFile);
274 fi.initWithPath( f ); 279 fi.initWithPath( f );
275 var st = Components.classes["@mozilla.org/network/file-input-stream;1"] 280 var st = Components.classes["@mozilla.org/network/file-input-stream;1"]
276 .createInstance(Components.interfaces.nsIFileInputStream); 281 .createInstance(Components.interfaces.nsIFileInputStream);