3 Replies Latest reply on Jul 14, 2011 8:16 AM by Runaway_Martian

    LrPublishService:createPublishedCollection ( ... ) not working?

    Runaway_Martian

      I'm trying to create a collection in LR Flickr Publish Service using LrPublishService:createPublishedCollection but whenever my script calls the function I get an INTERNAL ERROR and the only information available is "assertion failed".

       

      As anyone encountered this problem or a similar one and managed to solve it? Is this a bug if the SDK?

       

      thanks

       

      Here the piece of code:

       

      catalog = LrApp:activecatalog()

      catalog:withWriteAccessDo( "Update Flickr", function( context )

                if allPubCollections[tostring(collId)] == nil then

      local cName = flickrSets[tostring(collId)]

      logger:trace("trying to create the collection ",collId,cName)

                               coll = publishService:createPublishedCollectionSet(cName,nil,true)

      end

       

      coll:addPhotoByRemoteId(photo, fid, 'http://www.flickr.com/photos/' .. propertyTable.nsid .. "/" .. fid, true)

           end)

      all the variables are defined..

        • 1. Re: LrPublishService:createPublishedCollection ( ... ) not working?
          Runaway_Martian Level 1

          I think I solved this. I moved the catalog:withWriteAccess call right before the call for the operation and closed it right after, and it seems to work. But now I'm facing another problem, LR says that the object coll (an LrPublishedCollection I suppose) does not have a :addPhotoByRemoteId(..) method...

          • 2. Re: LrPublishService:createPublishedCollection ( ... ) not working?
            DawMatt Level 3

            Hi,

            Runaway_Martian wrote:

             

            I think I solved this. I moved the catalog:withWriteAccess call right before the call for the operation and closed it right after, and it seems to work.

            I think this is the correct approach. Some operations (and I think this is one of them) can't be used in the same withWriteAccess call that creates them. If the remainder of the work still requires write access them make a second withWriteAccess call.

             

            Runaway_Martian wrote:

             

            But now I'm facing another problem, LR says that the object coll (an LrPublishedCollection I suppose) does not have a :addPhotoByRemoteId(..) method...

            Collection sets can't contain photos directly. I think you meant to call publishService:createPublishedCollection() instead of publishService:createPublishedCollectionSet().  That is why the method is not present as a collection set rather than a collection is being returned..

             

            Matt

            • 3. Re: LrPublishService:createPublishedCollection ( ... ) not working?
              Runaway_Martian Level 1

              yeah, you're totally right. I've put that "Set" when i was trying to make it work at the beginning and didn't change it back, dumb me. Thanks