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


Permlink Replies: 3 - Pages: 1 - Last Post: 2 Dec 24, 11:57 Last Post By: RobM Threads: [ Previous | Next ]
jorsh

Posts: 4
Registered: 15-Sep-2024
Change files order from groovy script
Posted: 24 Nov 24, 18:42
 
  Click to reply to this thread Reply
I can set "custom" sorting order from groovy to the specific folder using setFolderOrdering() API.

Is there any way I can specify a position for each file in the folder individually when folder is set to a custom order?

I see AlbumObjectOrderer class and CustomOrderer interface, but I am not sure how/if they can be used from groovy. Also, I can't find anything I can use for direct position access - something like setOrderIndex( int idx)

I appreciate any help

Thanks
RobM

Posts: 3,829
Registered: 4-Aug-2006
Re: Change files order from groovy script
Posted: 24 Nov 24, 20:00   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
Are you running jAlbum from the command line or the GUI?
In the GUI, explore mode, you can right click in a free space and select 'Ordering' with an option to apply to subfolders.

If you want to look at an example tool that changes object ordering, for the whole project, look at this tool However if you want to set a folders contents be some arbitrary system, not just name, title, rating etc. then I'm not sure how that can be done.
jorsh

Posts: 4
Registered: 15-Sep-2024
Re: Change files order from groovy script
Posted: 2 Dec 24, 01:44   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
I am running groovy script as an "External tool". I want to use "custom" order and I know order of the files in each folder I want to have. I can't afford manually re-arrange each folder (>1000 files in an Album) in the UI. I am looking for the way to set order of files from groovy script programmatically according to a special rules I have. I looked into jAlbum Java documentation and can't figure out how to change order of files programmatically.
RobM

Posts: 3,829
Registered: 4-Aug-2006
Re: Change files order from groovy script
Posted: 2 Dec 24, 11:50   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
My guess would be to try the AlbumObjectOrderer Class
 AlbumObject[]  sort(AlbumObject[] objects) 
method.

That is part of Interface AlbumObject and has the method
 moveTo(AlbumObject newParent, int position) 

Never tried to use it but it seems the closest thing to what you want, assuming you already have the code to implement your ‘special rules’.

Sorry, but that’s the best I can suggest, maybe someone else will have an idea.

Edited by: RobM on 2 Dec 2024, 10:53
Legend
Forum admins
Helpful Answer
Correct Answer

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