changed method of getting terminal size

This commit is contained in:
Zen 2020-01-12 01:56:30 +02:00
parent 0ded10325c
commit 4d13758df4

View file

@ -10,6 +10,7 @@ DONE make passing your arguments for encoding,
make separate audio and encode it separately, make separate audio and encode it separately,
""" """
import os import os
import shutil
from os.path import join from os.path import join
from psutil import virtual_memory from psutil import virtual_memory
from subprocess import Popen, call from subprocess import Popen, call
@ -42,7 +43,7 @@ class ProgressBar:
self.print() self.print()
def print(self): def print(self):
terminal_size = int(os.popen('stty size', 'r').read().split()[1]) terminal_size, _ = shutil.get_terminal_size()
bar_length = terminal_size - (2 * len(str(self.tasks))) - 13 bar_length = terminal_size - (2 * len(str(self.tasks))) - 13
if self.iteration == 0: if self.iteration == 0: