Committer: ailyin
LJSUP-11926 (ensure that fotobilder API works with the new photo hosting)U trunk/lib/Apache/FotoBilder.pm U trunk/lib/FB/Protocol/Fotki/CreateGals.pm U trunk/lib/FB/Protocol/Fotki/GetPics.pm U trunk/lib/FB/Protocol/Fotki/Login.pm U trunk/lib/FB/Protocol/Fotki/UploadPic.pm U trunk/lib/FB/Protocol/Fotki.pm
Modified: trunk/lib/Apache/FotoBilder.pm =================================================================== --- trunk/lib/Apache/FotoBilder.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/Apache/FotoBilder.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -142,6 +142,7 @@ my $lookup_result = LJ::Pics::Controller::FotobilderRedirect->lookup_redirect; + $lookup_result ||= ['noredir']; my ( $status, $details ) = @$lookup_result; if ( $status eq 'redir' ) { Modified: trunk/lib/FB/Protocol/Fotki/CreateGals.pm =================================================================== --- trunk/lib/FB/Protocol/Fotki/CreateGals.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/FB/Protocol/Fotki/CreateGals.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -66,8 +66,9 @@ 'allowmask' => $allowmask, ); }; - return $err->(512 => 'Error creating LJ Pics album' ) if $@; + return $err->(512 => 'Error creating LJ Pics album') if $@; + return $err->(512 => 'Error creating LJ Pics album' ) unless($album); push @{$ret->{Gallery}}, { GalID => [ $album->album_id ], Modified: trunk/lib/FB/Protocol/Fotki/GetPics.pm =================================================================== --- trunk/lib/FB/Protocol/Fotki/GetPics.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/FB/Protocol/Fotki/GetPics.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -33,16 +33,16 @@ push @{$ret->{Pic}}, { id => $photo->photo_id, Sec => [ FB::Protocol::Fotki->lj2fb_security($photo->security, $photo->allowmask) ], # TODO: convert mask to FB format - Width => [ $photo->prop('width') ], - Height => [ $photo->prop('height') ], - Bytes => [ $photo->prop('filesize') ], -# Format => [ FB::fmtid_to_mime($pic->{fmtid}) ], # TODO: Format of the original photo -# MD5 => [ FB::bin_to_hex($gpic_md5->{$pic->{gpicid}}) ], + Width => [ $photo->prop('width') || '' ], + Height => [ $photo->prop('height') || '' ], + Bytes => [ $photo->prop('filesize') || '' ], + Format => [ $photo->prop('mimetype') || '' ], + MD5 => [ $photo->prop('content_md5') || '' ], URL => [ $photo->image_url( 'size' => 'original' ) ], Meta => [ - { 'name' => 'title', 'content' => $photo->prop('title') }, + { 'name' => 'title', 'content' => $photo->prop('title') }, { 'name' => 'description', 'content' => $photo->prop('description') }, - # TODO: filename + { 'name' => 'filename', 'content' => $photo->filename }, ], }; Modified: trunk/lib/FB/Protocol/Fotki/Login.pm =================================================================== --- trunk/lib/FB/Protocol/Fotki/Login.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/FB/Protocol/Fotki/Login.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -28,13 +28,11 @@ LJ::Request->notes(ProtocolClientVersion => $vars->{ClientVersion}); } - if (ref $spaces eq 'ARRAY') { - $ret->{Quota} = { - Total => [ LJ::Pics->get_available_space($lj_user) ], - Used => [ LJ::Pics->get_occupied_space($lj_user) ], - Remaining => [ LJ::Pics->get_free_space($lj_user) ], - }; - } + $ret->{Quota} = { + Total => [ LJ::Pics->get_available_space($lj_user) ], + Used => [ LJ::Pics->get_occupied_space($lj_user) ], + Remaining => [ LJ::Pics->get_free_space($lj_user) ], + }; # are there any current system messages applying to this user? $ret->{Message} = [ FB::get_system_message($u) . '' ]; Modified: trunk/lib/FB/Protocol/Fotki/UploadPic.pm =================================================================== --- trunk/lib/FB/Protocol/Fotki/UploadPic.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/FB/Protocol/Fotki/UploadPic.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -272,8 +272,6 @@ $photo = LJ::Pics::Photo->create( 'userid' => $lj_userid, 'album_id' => $album->album_id, - 'photo_data' => $photo_data, - 'version' => $version, 'security' => $security, 'allowmask' => $allowmask, ); @@ -305,13 +303,14 @@ # return the last returned photo_id # register return value with parent Request $resp->add_method_vars( - UploadPic => { - PicID => [ $photo->photo_id ], - URL => [ $photo->orig_url ], - Width => [ $photo->orig_width ], - Height => [ $photo->orig_height ], - Bytes => [ $length ], - }); + UploadPic => { + 'PicID' => [ $photo->photo_id ], + 'URL' => [ $photo->image_url( 'size' => 'original' ) ], + 'Width' => [ $photo->prop('width') ], + 'Height' => [ $photo->prop('height') ], + 'Bytes' => [ $length ], + } + ); return 1; } Modified: trunk/lib/FB/Protocol/Fotki.pm =================================================================== --- trunk/lib/FB/Protocol/Fotki.pm 2012-04-19 12:56:40 UTC (rev 1461) +++ trunk/lib/FB/Protocol/Fotki.pm 2012-04-23 15:04:25 UTC (rev 1462) @@ -13,11 +13,13 @@ my ($security, $allowmask); if ($sec == 255) { $security = 'public'; + $allowmask = 0; } elsif ($sec >= 126 && $sec < 158) { $security = 'usemask'; $allowmask = $sec - 127; } else { $security = 'private'; + $allowmask = 0; } return ($security, $allowmask); }