sst89 / as3flickrlib

Automatically exported from code.google.com/p/as3flickrlib
0 stars 0 forks source link

All date related flickr.photos.search arguments must be mysql datetime - not unix timestamps #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
All date related searches currently return empty results because of that.
The problem is that this is an error in the current flickr API documentation.

Original issue reported on code.google.com by ma...@quasimondo.com on 18 Feb 2009 at 9:13

GoogleCodeExporter commented 8 years ago
This can be fixed by changing the Photos.search method:

public function search( user_id:String = "",
                                tags:String = "",
                                tag_mode:String = "any", 
                                text:String = "",
                                min_upload_date:Date = null,
                                max_upload_date:Date = null, 
                                min_taken_date:Date = null,
                                max_taken_date:Date = null,
                                license:Number = -1,
                                sort:String = "date-posted-desc",
                                privacy_filter:int = -1,
                                bbox:String = "",
                                accuracy:int = -1,
                                safe_search:int = -1,
                                content_type:int = -1,
                                machine_tags:String = "",
                                machine_tag_mode:String = "",
                                group_id:String = "",
                                contacts:String = "",
                                woe_id:String = "",
                                place_id:String = "",
                                media:String = "",
                                has_geo:Boolean = false,//true, false or all
                                lat:String = "",
                                lon:String = "",
                                radius:Number = -1,
                                radius_units:Number = -1,
                                extras:String = "",
                                per_page:Number = 100,
                                page:Number = 1):void {

            // Let the Helper do the work to invoke the method          
            MethodGroupHelper.invokeMethod( _service, search_result, 
                                   "flickr.photos.search", 
                                   false,
                                   new NameValuePair( "user_id", user_id ),
                                   new NameValuePair( "tags", tags ),
                                   new NameValuePair( "tag_mode", tag_mode ),
                                   new NameValuePair( "text", text ),
                                   // convert dates to # of milliseconds
                                   new NameValuePair( "min_upload_date", min_upload_date == null ? "" :
MethodGroupHelper.dateToString(min_upload_date) ),
                                   new NameValuePair( "max_upload_date", max_upload_date == null ? "" :
MethodGroupHelper.dateToString(max_upload_date) ),
                                   new NameValuePair( "min_taken_date", min_taken_date == null ? "" :
MethodGroupHelper.dateToString(min_taken_date) ),
                                   new NameValuePair( "max_taken_date", max_taken_date == null ? "" :
MethodGroupHelper.dateToString(max_taken_date) ),
                                   new NameValuePair( "license", license == -1 ? "" : license.toString() ),
                                   new NameValuePair( "sort", sort ),
                                   new NameValuePair( "privacy_filter", privacy_filter == -1 ? "" :
privacy_filter.toString() ),
                                   new NameValuePair( "bbox", bbox ),
                                   new NameValuePair( "accuracy", accuracy == -1 ? "" : accuracy.toString() ),
                                   new NameValuePair( "safe_search", safe_search == -1 ? "" :
safe_search.toString() ),
                                   new NameValuePair( "content_type", content_type == -1 ? "" :
content_type.toString() ),
                                   new NameValuePair( "machine_tags", machine_tags ),
                                   new NameValuePair( "machine_tag_mode", machine_tag_mode ),

                                   new NameValuePair( "group_id", group_id ),
                                   new NameValuePair( "contacts", contacts ),
                                   new NameValuePair( "woe_id", woe_id ),
                                   new NameValuePair( "place_id", place_id ),
                                   new NameValuePair( "media", media ),

                                   new NameValuePair( "has_geo", (has_geo)?"true":"" ),
                                   new NameValuePair( "lat", lat ),
                                   new NameValuePair( "lon", lon ),
                                   new NameValuePair( "radius", radius == -1 ? "" : radius.toString() ),
                                   new NameValuePair( "radius_units", radius_units == -1 ? "" :
radius_units.toString() ),

                                   new NameValuePair( "extras", extras ),
                                   new NameValuePair( "per_page", per_page.toString() ),
                                   new NameValuePair( "page", page.toString() )
                                   );
        }

Original comment by ma...@quasimondo.com on 18 Feb 2009 at 9:31