Exemple #1
0
 def test_progress(self):
     info = TranscoderTests.make_media(None, None, None, 1080, 90 * 60,
                                       2300, 25, None, [], [])
     stats = {'size': 1225360000, 'time': 50 * 60}
     done, comp = calculate_progress(info, stats)
     self.assertEqual(done, 55, 'Expected 55% done')
     self.assertEqual(comp, 6, 'Expected 6% compression')
Exemple #2
0
 def log_callback(stats):
     pct_done, pct_comp = calculate_progress(job.media_info, stats)
     self.log(f'{basename}: speed: {stats["speed"]}x, comp: {pct_comp}%, done: {pct_done:3}%')
     if _profile.threshold_check < 100:
         if pct_done >= _profile.threshold_check and pct_comp < _profile.threshold:
             # compression goal (threshold) not met, kill the job and waste no more time...
             self.log(f'Encoding of {basename} cancelled and skipped due to threshold not met')
             return True
     return False
Exemple #3
0
 def log_callback(stats):
     pct_done, pct_comp = calculate_progress(job.info, stats)
     self.log_stats(basename, stats['speed'], pct_comp,
                    pct_done)
     if job.profile.threshold_check < 100:
         if pct_done >= job.profile.threshold_check and pct_comp < job.profile.threshold:
             # compression goal (threshold) not met, kill the job and waste no more time...
             self.log(
                 f'Encoding of {basename} cancelled and skipped due to threshold not met'
             )
             return True
     # continue
     return False
Exemple #4
0
 def log_callback(stats):
     pct_done, pct_comp = calculate_progress(job.info, stats)
     pytranscoder.status_queue.put({ 'host': 'local',
                                     'file': basename,
                                     'speed': stats['speed'],
                                     'comp': pct_comp,
                                     'done': pct_done})
     #self.log(f'{basename}: speed: {stats["speed"]}x, comp: {pct_comp}%, done: {pct_done:3}%')
     if job.profile.threshold_check < 100:
         if pct_done >= job.profile.threshold_check and pct_comp < job.profile.threshold:
             # compression goal (threshold) not met, kill the job and waste no more time...
             self.log(f'Encoding of {basename} cancelled and skipped due to threshold not met')
             return True
     return False