This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: 23 Sep 24, 23:57 Last Post By: RobM Threads: [ Previous | Next ]
jorsh

Posts: 5
Registered: 15-Sep-2024
Change web link image property from groovy script
Posted: 23 Sep 24, 05:32
 
  Click to reply to this thread Reply
I am trying to batch update Web links (AlbumObject represented by *.webloc files). I was able to update Title:
getProperties().put("title", "MyTitle")

and comment:
setComment()


I can't find how to change location of image file associated with link (not every site provides descent image for preview). In .webloc.info file imageURI is a member of HiddenPropery:

   <void method="put">
   <string>imageURI</string>
   <object class="se.datadosen.jalbum.AlbumObjectProperties$HiddenProperty">
    <void property="property">
     <string>file:/C:/test/abc.png</string>
    </void>
   </object>
  </void>


Is there any way to access this property from the groovy script?

There is still an option to modify *.webloc.info files directly from outside jAlbum. But this can be broken later if jAlbum will change the way it stores data later.

I appreciate any help or better ideas.
RobM

Posts: 3,843
Registered: 4-Aug-2006
Re: Change web link image property from groovy script
Posted: 23 Sep 24, 11:59   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
I don’t recall using hidden properties but see:
https://jalbum.net/api/se/datadosen/jalbum/AlbumObjectProperties.HiddenProperty.html

https://jalbum.net/api/se/datadosen/jalbum/AlbumObjectProperties.html

You could try something like AlbumObjectProperties props = AO.getProperties();
props.HiddenProperty().putHidden(“imageURI”, “image path”);
props.save(false);

No idea if the above is correct, haven’t tried it, you might need to wait for David to give a workable answer.
jorsh

Posts: 5
Registered: 15-Sep-2024
Re: Change web link image property from groovy script
Posted: 23 Sep 24, 20:10   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Hello Rob,

This was very helpful. Somehow I missed "HiddenProperty" property of AlbumObject. Just a minor correction if anyone will need the same. Proper code should be:

ao.getProperties().putHidden( "imageURI", se.datadosen.util.IO.urlEncode(val));


- it seems there is no HiddenPropery property
- urlEncode is needed for spaces and some other symbols can be used in file name
RobM

Posts: 3,843
Registered: 4-Aug-2006
Re: Change web link image property from groovy script
Posted: 23 Sep 24, 20:32   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
jorsh wrote:
Hello Rob,

This was very helpful. Somehow I missed "HiddenProperty" property of AlbumObject. Just a minor correction if anyone will need the same. Proper code should be:

ao.getProperties().putHidden( "imageURI", se.datadosen.util.IO.urlEncode(val));

- it seems there is no HiddenPropery property
- urlEncode is needed for spaces and some other symbols can be used in file name

Just got there a few minutes ago. You can just use IO.urlEncode(val)
you don't need to include "se.datadosen.util."
RobM

Posts: 3,843
Registered: 4-Aug-2006
Re: Change web link image property from groovy script
Posted: 23 Sep 24, 23:57   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
I'm moving this to the Skin and Tool development forum. We're trying to keep this forum to just the tools, plugins and extensions themselves, to make it easier to find specific things. If you decide to share the tool post it in the tools, plugins and extensions forum.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums