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


Permlink Replies: 5 - Pages: 1 - Last Post: 21 Dec 24, 02:40 Last Post By: jorsh Threads: [ Previous | Next ]
jorsh

Posts: 14
Registered: 15-Sep-2024
Custom sort order does not work when Album set to custom sort
Posted: 17 Dec 24, 05:05
 
  Click to reply to this thread Reply
This may be related to already existing thread: Sorting albums/files by name broken if using LINK/MIRROR CONTENT

Scenario:
1. Album set as a links (not mirror)
2. Album global sorting set to "custom"
3. Groovy script sets each folder to "custom" sort individually
4. Groovy script uses setChildren() to force certain order
5. As result files in all folders still shown in "Date and time" order

File meta.properties in the Album location (My Album\albumName) says
ordering=custom

meta.properties files in *.jAlbum" subdirectory in each directory says
ordering=album


Refresh or restart jAlbum does not work.

How to fix:
1. delete meta.properties in the Album location
2. run script again. each directory will have meta.properties with
ordering=custom
and folders will accept changes from setChildren() call.
davidekholm

Posts: 3,712
Registered: 18-Oct-2002
Re: Custom sort order does not work when Album set to custom sort
Posted: 17 Dec 24, 14:59   in response to: jorsh in response to: jorsh
 
  Click to reply to this thread Reply
Please attach that Groovy script. Also enlighten me on why a "meta.properties" file is created straight in the album folder. That file these days reside under the .jalbum sub folder and should never need to be touched directly. It should be updated indirectly via AlbumObject.setOrdering()
jorsh

Posts: 14
Registered: 15-Sep-2024
Re: Custom sort order does not work when Album set to custom sort
Posted: 18 Dec 24, 05:01   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Sorry if I was not clear enough. "meta.properties" was created in ".jalbum" subdirectory of album folder. This is the result of call
rootFolder.setFolderOrdering( AlbumObject.Ordering.custom );
in Groovy script in attempt to set custom sorting for the album root. So, I guess there is nothing wrong with the file location.

I am not sure it make sense to provide full script - it requires much more then just a script to run it. Groovy script is a final part of automated process involving Excel spreadsheet and external tool to process various user files and generate list of commands to a groovy script. I will try to isolate a test case to simplify troubleshooting and post it here.
RobM

Posts: 3,950
Registered: 4-Aug-2006
Re: Custom sort order does not work when Album set to custom sort
Posted: 18 Dec 24, 13:59   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
David, is it necessary to set custom ordering as the tool is aiming to reposition objects anyway?
Won’t custom ordering be set automatically when the first object is moved in the tree?
davidekholm

Posts: 3,712
Registered: 18-Oct-2002
Re: Custom sort order does not work when Album set to custom sort
Posted: 18 Dec 24, 14:22   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
His tool doesn't move objects manually. It sets custom ordering and then sets an explicit set of children.
jorsh

Posts: 14
Registered: 15-Sep-2024
Re: Custom sort order does not work when Album set to custom sort
Posted: 21 Dec 24, 02:40   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Find workaround for this issue:

When root folder set to "custom" sorting I will store current list of objects in the root, and set ordering for something else. Then recursively process all subfolders (setting "custom" there) and once complete - restore original sorting and objects order.

ArrayList<AlbumObject> rootChildren = null;
if( rootFolder.getFolderOrdering() == AlbumObject.Ordering.custom )
{
    rootChildren = rootFolder.getChildren( true );
    rootFolder.setFolderOrdering( AlbumObject.Ordering.addedDate );
}
 
// Run recursive routine to apply jAlbum commands
processFolder(rootFolder);
 
if( rootChildren != null ){
    rootFolder.setFolderOrdering( custom );
    rootFolder.setChildren( rootChildren );
}
Legend
Forum admins
Helpful Answer
Correct Answer

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