Scripts: XYPlorer GUI "not responding" on long loop operations

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
medder
Posts: 69
Joined: 19 May 2008 02:55

Scripts: XYPlorer GUI "not responding" on long loop operations

Post by medder »

Sample case: I need hundreds of videos tagged with their meta properties for quick management.

I usually build some video list using Search, select 30-100 videos, and run the script.
The script starts foreach loop for selecteditemspathnames and gets some properties for each video file.
Currently I get the information using requests like this: $bps = property("System.Video.EncodingBitrate",$token);
And get FrameHeight, FrameWidth, FrameRate, Duration and so on.
Then I tag the files with some of this information, further processed.

Later I want to try if using MediaInfo CLI from XYPlorer will be faster.

My problem:

I want to display some progress using status function and display the current filename, "file # of ###" or "% processed".
But XYplorer's GUI just freezes after the 10th or 15th file or after 5 seconds running the script. It continues with processing the files (in background), finishes the foreach loop, and continues with the script, so all I am able to show in the status bar - is total running time and "Finished processing" message. XYplorer unfreezes after the loop.

In the end all the files (even hundreds or thousands of them) are successfully processed, all the tags are written to Xyplorer's tag.dat file. So I have the desired result. But all this is done "in the background" without any chance to show the progress and approximate the time to finish.

Somewhere in between - after going through 10 files or running for 5 seconds (the time interval and file count varies) - XYplorer window stops responding, status stops changing (the status bar gets stuck with "Processed: 11 files of 120"), and Windows 10 Task Manager shows "not responding" next to XYplorer process. You have to "sit back and relax".

The CPU load does not go higher then 5 or 10 percent, there's plenty of RAM, hard drive is not overloaded. Disabling antivirus does not help. Running XYplorer with elevated permissions does not help. All other programs continue running without any problems.


Is there some tweak or setting to extend the timeout delay for running scripts
or maybe an option to run scripts in parallel process?
So that XYplorer GUI doesn't freeze while processing long loops.

jupe
Posts: 3296
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Scripts: XYPlorer GUI "not responding" on long loop operations

Post by jupe »

Put a wait; at the end of your foreach loop, also it will be more efficient getting all the properties via report() first outside the foreach, instead of multiple calls to property().

medder
Posts: 69
Joined: 19 May 2008 02:55

Re: Scripts: XYPlorer GUI "not responding" on long loop operations

Post by medder »

Thank you. I wouldn't have found this solution myself.
wait; at the end of the loop works like a charm. I've tested it with 500 files with no issues.
No freezes. New custom status text for every file in the loop. The progress display works perfectly.

I was stuck here not knowing what causes the GUI freezes (maybe even some broken video file).

Now I can work on the efficiency. You are right, multiple calls to property are far from perfect.
Though it gets the job done, and the running time is... bearable, MediaInfo shows that it can be done much faster.
Now I'll have to find a way to do this using XYplorer.

Thank you very much. You've been really helpful.

Post Reply