1 Reply Latest reply on Dec 3, 2008 2:02 PM by (John_Verne)

    Flickr sample plug-in question

    hungchi Level 1
      Sorry for the newbie question, I'm not a programmer/developer I just play one for fun.

      I downloaded the LR SDK 2.0 and started playing with the sample plugins

      Looking at the Flickr sample plug-in I noticed it's built on LR API 1.3 and not 2.0 from reading the manual it looks like their are some changes needed to comply with lrSDK2. It also looks like the flickr API has changed some since the Flickr sample plug-in was written.

      I'm just trying to understand the code in the Flickr sample plug-in separating, what is LR, what is flicker API, and what is Lua?
        • 1. Re: Flickr sample plug-in question
          Level 1
          The Flickr sample worked pretty much out of the box for me on Lr 2.1, though I have to admit I didn't actually connect to Flickr to test, but another site that supports the Flickr API (because I don't use Flickr, but their API has become a de facto standard).

          As far as I can tell the sample does not use 2.0-only features, or is able to gracefully fall back to 1.3 behaviour.

          Version gotchas are documented in the SDK documentation. There are a few places in the docs where they tell you what happens during some SDK call when one of the version properties you set in Info.lua is not 2.0.

          The sample code is divided up in a reasonably logical manner. The API calls have been separated from the SDK routines, and both are separate from the boilerplate startup/management stuff.

          For example, Info.lua is the basic hook that Lr needs for the plugin manager to load the plugin. This defines SDK properties that tell Lr how to present the plugin to the user, including which scripts and objects are defined to insert the plugin into the Export dialog. The meat of the plugin is all the processing that is required for the user to interact with the dialog, and it is this processing that actually makes SDK calls.

          Flickr API calls take place over the wire via cleverly constructed URLs. The sample builds up web requests that are then sent via an HTTP POST to the API URL. I'm hand-waving around the authentication and API key stuff, which is grunt work that should only have to be handled once (normally).

          Lua is a pretty clear language and with a little time you should be able to pick it up (if you want to). However, jumping into an embedded form of the language where you can only really program in it via an SDK hook is not ideal for learning.

          Though, in my experience, this is exactly how people are often first introduced to the language.

          I guess I should add: the helloworld.lrdevplugin might be an easier place to start. You get the hook (Info.lua) showing how to add items to the Lr menu based on criteria, and what to do when those menu items are selected (either of the other two files). Maybe this might be a good place to start?