<commit_before><commit_msg>[api] photo panorama via panoramio.com<commit_after>define [
  'apis/base'
], (BaseAPI) ->

  class PhotoPanoramaAPI extends BaseAPI

    baseUrl: 'http://www.panoramio.com/map/get_panoramas.php'

    dataDefaults:
      set: 'public'
      from: 0
      to: 20
      size: 'medium'
      mapfilter: 'true'
      callback: 'callback'
      # lat: undefined
      # lon: undefined
      # minx: undefined
      # miny: undefined
      # maxx: undefined
      # maxy: undefined

    initialize: (options) ->
      super
      @request()
      @

    ajaxParams: ->
      $.extend {}, super,
        dataType: 'jsonp'

    prepareData: ->
      delta = 0.03
      @options.data.minx = @options.data.lng - delta
      @options.data.miny = @options.data.lat - delta
      @options.data.maxx = @options.data.lng + delta
      @options.data.maxy = @options.data.lat + delta
      delete @options.data.lat
      delete @options.data.lng
      super

    prepareResult: ->
      data = super?.photos
      random = data? && _.random(0, _(data).size() - 1)
      data = _(data).any? && data[random]
      data = data? && data.photo_file_url
      @result = data || ''
{'fraction_non_alphanumeric': 0.13597972972972974, 'fraction_numerical': 0.006756756756756757, 'mean_word_length': 2.1266490765171504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6423667', 'n_tokens_mistral': 402, 'n_tokens_neox': 382, 'n_words': 83}