In this third step towards progress reporting, two separate loops
are used instead of one. The first loop is non-parallelized, where
we check each file for need of transcoding. If it doesn't need to be
transcoded it is tagged, if necessary. If it does need to be
transcoded its name and filesize is saved in a datastructure, but no
more processing on the file takes place until the second loop. The
progress of the first loop is displayed and updated in 1 s intervals.
In the second loop, parallel processing is used to transcode the
files found in the first loop. Here, in the coming steps 4 and 5,
we will extend the 'run_on_finish' callback sub to also include
progress reporting and estimated time to finish, based on timing
and file size data.
Note that nothing would be gained by having the first loop similarly
parallelized - the computational overhead is far too big in
comparison to the relatively light cpu load.
use two separate loops (step 3/5)
In this third step towards progress reporting, two separate loops are used instead of one. The first loop is non-parallelized, where we check each file for need of transcoding. If it doesn't need to be transcoded it is tagged, if necessary. If it does need to be transcoded its name and filesize is saved in a datastructure, but no more processing on the file takes place until the second loop. The progress of the first loop is displayed and updated in 1 s intervals.
In the second loop, parallel processing is used to transcode the files found in the first loop. Here, in the coming steps 4 and 5, we will extend the 'run_on_finish' callback sub to also include progress reporting and estimated time to finish, based on timing and file size data.
Note that nothing would be gained by having the first loop similarly parallelized - the computational overhead is far too big in comparison to the relatively light cpu load.