steve8x8 / geotoad

Geocaching query tool written in Ruby
https://buymeacoffee.com/steve8x8
Other
28 stars 8 forks source link

Enhance output format by optional criterion #323

Closed steve8x8 closed 8 years ago

steve8x8 commented 9 years ago

The "wherigo" output format, in its current state, lists nonsensical information for all found WIDs. It should be limited to caches whose "type" is "wherigo". This could be achieved by adding another value to the template, checking for "\"<%wp.type%>\" == \"wherigo\"" as a precondition for templateWP output. There might be other usage cases as well, any suggestions?

steve8x8 commented 9 years ago

Patch merged into git head.

steve8x8 commented 8 years ago

Released with 3.24.0.

Leaving this issue open (although considered resolved) for comments and suggestions.

steve8x8 commented 8 years ago

There's another application of this feature: notification of new caches in the vicinity via Twitter DM.

Basic idea:

Here's the corresponding template that demonstrates usage of the conditionWP expression:

template = {

  'twitter' => {
    'ext'         => 'twt',
    'mime'        => 'text/plain',
    'desc'        =>     'Twitter-ready',
    'templatePre' => "",
    # output condition: distance must be <= 10km
    'conditionWP' =>
      "\"<%out.relativedistancekm%>\".to_f <= 10",
    'templateWP'  =>
      "coord.info/<%out.wid%>" +
      " <%out.latdegmin%> <%out.londegmin%>" +
      " <%out.nuvi%>" +
      " \"<%wpText.name%>\" by <%wpText.creator%>" +
      " (<%out.cdateshort%>)" +
      " <%out.relativedistancekm%>" +
      "\n"
    },

}

The link is clickable; nuvi has been used here to keep the cache characteristics short; on the other hand, the coordinates are shown in DD:MM.MMM format for easier map lookups (but one could also use the wp.latwritten and wp.lonwritten DD.DDDDD representations). You're free to write your own templates!

steve8x8 commented 8 years ago

After 3.25.0 release, closing.