Hack request: Import Picasa sequencing

SystemSystem Registered Users Posts: 8,186 moderator
After I bitched and whined about this long enough (:-), Andy suggested that I post about it over here.

I'm not sure the API exposes enough functionality to get this accomplished -- my skimming of the documentation suggests not -- but it's worth asking.

I use Picasa, and as I mentioned in this thread, I'm trying to find a way to apply the sequencing it maintains to the galleries I then upload to Smug.

I did, finally, find a way to get that sequencing out; it will generate (in its Export To Web function) an XML file, which contains the album description, the photo filenames (in order) and their associated captions (though those are already supposed to also be in the IPTC data).

I've posted a copy of such a file here, for your perusal.

If anyone *can* figure out how to do this from outside, without Smug having to write any code, I suspect they'll make a whole lot of Picasa users very happy. And while perhaps I'm the only one silly enough to try to use it with a Pro account, surely there are lots of people with more basic accounts, for whom it would be good enough... if you didn't have to sequence everything twice.

Thoughts?

Comments

  • cabbeycabbey Registered Users Posts: 1,053 Major grins
    edited January 26, 2007
    smugmug.images.changePosition might accomplish what you want.
    SmugMug Sorcerer - Engineering Team Champion for Commerce, Finance, Security, and Data Support
    http://wall-art.smugmug.com/
  • SystemSystem Registered Users Posts: 8,186 moderator
    edited January 27, 2007
    A quick look at that suggests it works by image id, not filename. I guess I'll look around and see if there's another one to go from filename to image id.
  • SystemSystem Registered Users Posts: 8,186 moderator
    edited January 27, 2007
    Yeah, I see how to do it. The (misnamed) images.get (which ought to be called images.enumerate, since it doesn't actually *get* an image) will hand me all the image IDs, and I can iterate images.getInfo over them to get the filenames. Put both in an array, put the filenames from the XML in a second array in order, and walk the first one, pulling out the imageIDs in order.

    Hand that to changePosition, and Bob's your uncle.

    Anyone got a Smug API program framework in, say, Python I can steal?
  • cabbeycabbey Registered Users Posts: 1,053 Major grins
    edited January 28, 2007
    imageinc wrote:
    Yeah, I see how to do it. The (misnamed) images.get (which ought to be called images.enumerate, since it doesn't actually *get* an image) will hand me all the image IDs, and I can iterate images.getInfo over them to get the filenames.

    set heavy and you'll get the full image info in the array on the first get call, saving you an order n loop ping ponging with the server to get the details.
    Put both in an array, put the filenames from the XML in a second array in order, and walk the first one, pulling out the imageIDs in order.

    Hand that to changePosition, and Bob's your uncle.

    nod.gif good start. I would first iterating through the images and setting their position += round(number of images). Basically move them all up out of the way in whatever order they are in now, then bring them back down in the order you want them. I'm not sure if that's *needed* or not.... would likely depend on how the api reacts if you have images 1-5 and you try to insert another 1 (that used to be, say, 42)... do you get two 1s? does the former 1 become 2? (and so forth up the line until there is a gap?)
    Anyone got a Smug API program framework in, say, Python I can steal?

    I have one started in objective c... but it's not moving very fast at all. :cry
    SmugMug Sorcerer - Engineering Team Champion for Commerce, Finance, Security, and Data Support
    http://wall-art.smugmug.com/
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited January 28, 2007
    imageinc wrote:
    Anyone got a Smug API program framework in, say, Python I can steal?

    Rutt wrote a version sometime ago on an older version of the api, before some of the easier API methods (REST, PHP, JSON) were available. If you can't find his script, perhaps send him a PM.
    David Parry
    SmugMug API Developer
    My Photos
  • SystemSystem Registered Users Posts: 8,186 moderator
    edited January 28, 2007
    devbobo wrote:
    Rutt wrote a version sometime ago on an older version of the api, before some of the easier API methods (REST, PHP, JSON) were available. If you can't find his script, perhaps send him a PM.

    I haven't looked at it in detail yet, but that sounds like nearly exactly what I want, yes.

    If Rutt is still around, I'd love to kibitz with him on updating his code to 1.1.1, and adding in the Picasa reposition functionality.
  • SystemSystem Registered Users Posts: 8,186 moderator
    edited January 28, 2007
    cabbey wrote:
    I would first iterating through the images and setting their position += round(number of images). Basically move them all up out of the way in whatever order they are in now, then bring them back down in the order you want them. I'm not sure if that's *needed* or not.... would likely depend on how the api reacts if you have images 1-5 and you try to insert another 1 (that used to be, say, 42)... do you get two 1s? does the former 1 become 2? (and so forth up the line until there is a gap?)

    I was all set to say "good point" here, until I tried to explain what I didn't understand, and realized it was immaterial. :-)

    Our handle on the thing-to-be-moved isn't a position, it's an ImageID, so it won't change.

    Therefore, we just line up all the imageIDs in *our idea of* The Right Sequence, and then we iterate over i=1...max, changePosition'ing ImageID to position I.

    And we're done; no semantic messes.
  • cabbeycabbey Registered Users Posts: 1,053 Major grins
    edited January 28, 2007
    imageinc wrote:
    Therefore, we just line up all the imageIDs in *our idea of* The Right Sequence, and then we iterate over i=1...max, changePosition'ing ImageID to position I.

    And we're done; no semantic messes.

    Oh! Duh. Yeah, iterate by new position, not image id. thumb.gif
    SmugMug Sorcerer - Engineering Team Champion for Commerce, Finance, Security, and Data Support
    http://wall-art.smugmug.com/
Sign In or Register to comment.