author | Michael Krelin <hacker@klever.net> | 2006-10-09 19:02:55 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-10-09 19:02:55 (UTC) |
commit | da97ac566cb06a583bd8b84b9e1275e37ea0a3ca (patch) (side-by-side diff) | |
tree | 14bad35b9e44ad58719d9704e89569bb9e842f09 | |
parent | b427de69c7df035643b95f9e2b1ed31276765065 (diff) | |
download | fireflix-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
-rw-r--r-- | content/flickr.js | 11 |
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 @@ -234,51 +234,56 @@ Flickr.prototype = { }catch(e) { return this._reset_token(); } return true; }, reset_token: function() { this._reset_token(); this.save_token(); }, get_photo_url: function(ser,id,sec,sfx,ext) { var rv = this.photo_url + ser + '/' + id + '_' + sec; if(sfx && sfx!='_') rv += '_'+sfx; rv += ext?'.'+ext:'.jpg'; return rv; }, get_image_url: function(o,sfx) { return this.get_photo_url( o.server, (o instanceof Photoset)? o.primary : o.id, o.secret, sfx, (sfx=='o')?o.originalformat:null ); }, get_photo_page_url: function(p) { - if(p instanceof Photo) // TODO: half wrong, what if no owner? - return this.photos_url + (p.owner.nsid?p.owner.nsid:this.user.nsid) + '/' + p.id; - else // TODO: take owner into account? + if(p instanceof Photo) { + // TODO: track photoset and user owner id from there? + // The approach below is sheerly wrong. + var o = this.user.nsid; + if(p.owner && p.owner.nsid) o = p.owner.nsid; + var rv = this.photos_url + o +'/' + p.id; + return rv; + }else // TODO: take owner into account? return this.photos_url + this.user.nsid + '/' + p; }, make_photo_url: function(p,sfx) { if(sfx=='p') return this.get_photo_page_url(p); else return this.get_image_url(p,sfx); }, upload_file: function(f,fa,on_success,on_failure) { try { var fi = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); fi.initWithPath( f ); var st = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); st.init(fi,0x01,00004,null); var bis = Components.classes["@mozilla.org/binaryinputstream;1"] .createInstance(Components.interfaces.nsIBinaryInputStream); bis.setInputStream(st); // allocate and initialize temp storage string var pbs = Components.classes["@mozilla.org/storagestream;1"] .createInstance(Components.interfaces.nsIStorageStream); |