Asistance with file sorting please.

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

dunno
Gold Member
Gold Member
Posts: 457
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Asistance with file sorting please.

Post by dunno » 2015 Apr 07, 13:50

My movie files are labelled as follows

Movie name (2064) [Spaced Out]
Movie name (1965)
Movie name (1999)
Movie name (1865) [Directors quit]
etc.

Is there a way I can list them by the year in a column ?,

A custom column would be nice but any method that could filter the year and list accordingly would be nice.

User avatar
nikos
Site Admin
Site Admin
Posts: 14859
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Asistance with file sorting please.

Post by nikos » 2015 Apr 07, 17:20

as I take it that "movie name" is different, you cannot do it

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 07, 21:58

nikos wrote:you cannot do it
Bah! Think outside the box, Joe-Joe! In fact, think off-the-bloody-planet. It took a few hours but I solved this one with a mechanism that would make even Sinatra cough thrice. :D

Once again it's incorporated into x2Filter because that saves me the trouble of building a separate integration framework. Download this beta version and make a user-command for it in the usual way. Remember that this is a beta version so, I wouldn't go tossing the salt just yet. :wink:

Basically select the "Sort by RegExp [S]" filter that appears in the menu, and you'll get a new dialog:

Image

For simplicity (and the express purpose of the OP's request) this defaults to a simple regex that matches any four numbers in a row anywhere in the filenames (such as "1975" or "2015", etc), and sorts by those values, ignoring the rest of the text. All objects in the current pane (both scrap and normal) are considered, and it will work best in "Details View" or "List View", or else weirdness might occur.

How does it do this? As they say, there are three things you don't want to know: 1) How Laws are made, 2) how Sausages are made, and 3) how x2Filter does this crazy sorting. :wink: (Hint: If you really want to know, tick "Watch Transposition" and set a transposition delay of 25ms. And please don't spill your coffee laughing.)

Hopefully this will work. For god's sake do not run it on a folder with thousands of items in it (it would take forever to parse) - test it with a few hundred at most, best at under 100.

You shouldn't need to worry about what the options do for the moment, just click "Ok" and see if it works as expected.

(Any items that don't match the regex will be sorted at the end of all other files, so they can be ignored. Turn on x2's Status Bar if you want miscellaneous text and error notifications.)

If any of the other stalwarts around here could test it too just to make sure it works on their systems without any goofs, I'd appreciate the feedback, even if you have no interest in this task, or x2Filter in general. I can't do this stuff in a vacuum.
Last edited by Kilmatead on 2015 Apr 16, 00:01, edited 1 time in total.

User avatar
kunkel321
Gold Member
Gold Member
Posts: 526
Joined: 2008 Jan 05, 18:58

Re: Asistance with file sorting please.

Post by kunkel321 » 2015 Apr 08, 02:10

Let's just all be glad he uses his powers for good and not evil...

dunno
Gold Member
Gold Member
Posts: 457
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Asistance with file sorting please.

Post by dunno » 2015 Apr 08, 03:58

That works on my sample files, I'll try it on my 600+ collection when I don't need to use my pc for a while.

Err, question, how do I revert to previous method of listing files after using this custom command ?.
(Never mind, I'll just open a new tab for this specific listing).

Many thanks for your time and effort much appreciated.

I would send you a rabbit for your pot, alas the postal services behave strangely when it comes to smelly parcels.

Edit; I tried it on my NAS movie collection and it worked a treat, it took approximately a "semi navy shower" for 691 items.
Only one movie wasn't sorted, it's named, 2081 (2009), but I'm perfectly happy with that as there aren't to many movies named with four digits. It's a great short SciFi movie well worth the bits and bytes.

Oustanding work Sir.

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 08, 06:44

The sorting order will be reset by a simple refresh <Ctrl+R> within x2 itself. It's not browsing-safe because it's not actually sorting at all, just visually moving things around, like a fastidious OCD bull in a child-safe china-shop. :D

That last film wasn't sorted with the rest because the regex I gave you was a simple one that just acted upon the "first set of digits found" which just happened to be the name of the film itself. The same thing would happen for 2001 (1968), etc.

Technically for films I should have used \(\d{4}\) or some variant thereof to match the number that is actually in parenthesis, or better yet the "last" set of numbers in parenthesis, etc - but the more rules you add the more likely there are to be a few films that weren't labelled properly in the first place and thus may not match. RegEx is not very a forgiving mistress when you don't use a condom. :wink:

Since it's a regex, it can be used for other things too, like sorting folders that have dates as part of their names, or stuff like that which is otherwise implemented as a poor-man's metadata.

This was an initial proof-of-concept, I have to add error-trapping, an escape method for sorts that are extremely long, separation of folders and files, etc etc etc. But hey, for a few hours work, it seems to do the job.
dunno wrote:I would send you a rabbit for your pot
Hmm... Glenn Close... hmm... how old is she now? And she always had that manly thing going on (jaw-line?), which isn't really to taste...
kunkel321 wrote:Let's just all be glad he uses his powers for good and not evil...
But what if my motivation is an elaborate ruse to just make Nikos look like a lazy dismissive dufus? Would that be good or evil? :twisted:
Last edited by Kilmatead on 2015 Apr 08, 06:50, edited 1 time in total.

User avatar
nikos
Site Admin
Site Admin
Posts: 14859
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Asistance with file sorting please.

Post by nikos » 2015 Apr 08, 06:50

such a bright mind, surely no problem is outside your grasp?

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 08, 06:56

I am definitely a square-peg in a round hole. You'll note that we neglected to mention the American-date Pi thing that happened recently... 3/14/15... 3.14159... doesn't really work for those who use real date formats... maybe squaring the circle uses 1.4315 or 1.5314 and everyone just missed it all these years? Descartes always was a bit of a presumptuous prat. :D

dunno
Gold Member
Gold Member
Posts: 457
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Asistance with file sorting please.

Post by dunno » 2015 Apr 09, 06:41

It takes 105 seconds to scan 691 files on my NAS.

I'm really chaffed with this new shiny toy, even made a special icon fort it, *sigh*, small things do amuse me.

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 09, 07:21

Somehow I think that's "chuffed" and not "chaffed"... :wink:... at least I hope so, unless you do an awful lot of farming from that hammock of yours. I assume you figured out that following the <Configure> entry in x2Filter and double-clicking on the "Sort by RegExp" filter entry allows you to assign your own icon to the popup menu item, as well as change its name and/or tooltip. I literally just chose a random icon for the default from sys32, "just because I could". I, too, am easily amused by such "feteshista" nonsense (to use Nikos' term for it). :D It can't be fired from the command-line just yet (so you can't create a dedicated toolbar button for it), but that's just part of the long list of stuff that needs doing...

It shouldn't take that long for under 1000 files... but I suppose networks are networks. :shrug: It's not the scanning, it's the actual sorting itself - it's literally spamming the poor x2 listview with multiple thousands of API messages, so it takes a bit of time to sort itself out. On the plus side, it now has a shiny green progressbar for when people get bored. :D I wasted many hours last night having an argument with the internet about why using LockWindowUpdate() is bad (but feels so good) and WM_SETREDRAW is supposed to be "good" (in terms of speed), but they both have unfortunate side-effects. There's also some algorithm optimising I can look at, so all in good time. The speed is also contingent upon how "out of order" the files are in the first place, so other collections may behave differently.

Whatever you do, don't click on anything else in x2 while it's having fun - you won't "hurt" anything but all hell (and parts of Australia) will break loose and float away into the sea. That too is on my list of things to fix.

User avatar
CrossX
Bronze Member
Bronze Member
Posts: 117
Joined: 2009 Dec 05, 21:13

Re: Asistance with file sorting please.

Post by CrossX » 2015 Apr 09, 11:13

Kilmatead wrote:
kunkel321 wrote:Let's just all be glad he uses his powers for good and not evil...
But what if my motivation is an elaborate ruse to just make Nikos look like a lazy dismissive dufus? Would that be good or evil? :twisted:
http://en.wikipedia.org/wiki/Needful_Things
Image

A new shop named "Needful Things" opens in the town of Castle Rock, Maine, sparking the curiosity of its citizens. The proprietor, Leland Gaunt, is a charming elderly gentleman who always seems to have an item in stock that is perfectly suited to any customer who comes through his door. The prices are surprisingly low, considering the merchandise - such as a rare Sandy Koufax baseball card, a carnival glass lampshade, and a fragment of wood believed to be from Noah's Ark - but he expects each customer to also play a little prank on someone else in Castle Rock....

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 09, 12:51

"...until the whole town is eventually caught up in madness and violence."

Apparently Leland Gaunt is much better at this than I am, as I have been trying to incite this forum into the delights of madness and violence for the last 7 years and the most I seem to accomplish is the odd chuckle and nervous cough from the dark recesses of the smoke-filled canteen. :shrug:

Maybe I should be flogging pieces of Noah's Ark instead? How much would you give me for a few hand-printed letters from Screwtape to Wormwood? Or those of Gargantua to Pantagruel? Moriarty didn't learn how to play chess by reading a column in the newspaper, you know. :wink:

But what is 7 years compared to 15 centuries? It's like in the The Rule of St. Benedict, even the man himself sees the need for a cajoling compromise before leading the brothers into battle with a greater evil...
Although we read that wine is by no means a drink for monks, yet since in these days the monks cannot be convinced of this, let us at least agree that we do not drink to satiety, but sparingly, because "Wine maketh even the wise to fall away."
On Topic: It's actually disappointing how little difference the addition of bidirectional transposition makes in the sorting-speed. :sad: I would have imagined it to be much greater, since that sort of thing sounds so impressive when placed in the changelog. Fantastic to watch when the listview scrolls in 20 different directions at the same time, though. :D "Bidirectional transposition: it's not just for the lustfully-confused-yet-willing-to-remain-opened-minded types who skulk in dark alleys." :shrug:

dunno
Gold Member
Gold Member
Posts: 457
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Asistance with file sorting please.

Post by dunno » 2015 Apr 10, 03:47

Kilmatead wrote: Whatever you do, don't click on anything else in x2 while it's having fun - you won't "hurt" anything but all hell (and parts of Australia) will break loose and float away into the sea. That too is on my list of things to fix.
I learnt a long time ago that computers are autistic, they're good at number crunching but don't confuse them with more than one task, a sure way to lock up ANY pc is to multi task, "it just donwork", keep it serial and simple, if I do ask it to multitask I make sure that I'm going fishing or something.

Your new shiny toy has got me thinking that I can include genre in the file name as I'll be able to list by genre. One day Mr. Someone will add ID3v5 metadata thingy to movie containers.

User avatar
nikos
Site Admin
Site Admin
Posts: 14859
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Asistance with file sorting please.

Post by nikos » 2015 Apr 10, 07:13

have you tried the icaros plugin? Supposedly it does good movie metadata
http://www.majorgeeks.com/files/details/icaros.html

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Asistance with file sorting please.

Post by Kilmatead » 2015 Apr 10, 07:14

dunno wrote:One day Mr. Someone will add ID3v5 metadata thingy to movie containers.
MP4 seems to be the container format most popular amongst "privateers" these days :wink:, and you can edit any metadata in those you want such as Directors/Writers/Year, etc etc etc directly from the right-click properties menu, and it will all happily show up in explorer columns as well. :shrug:

Also, as Nikos says, playing with handlers like Icaros can go a long way to salving the wounds that ail ya, though it is not as comprehensive as it claims over multiple formats - does wonders for thumbnails though. Icaros is also installed as part of the stock K-Lite setup, so you may already have it without knowing it.

Image

Post Reply