def _convertMainLoop(self, track_id): '''Function that iterates over tracks to convert them.''' t00 = time.time(); # Get time for start of iteration over tracks self.__cnt = 0; # Reset the count for cnt attribute for track in track_id: # Iterate over all tracks info = self.itunes_data['Tracks'][track]; # Get the information about the track proc = self._processChecker(); # Block to ensure there aren't too many process proc = Thread(target = self._convertThread, args = (info,) ); # Initialize thread proc.start(); # Start thread self.process.append( proc ); # Append thread to process list while len(self.process) > 0: # While there are processes left int he process attribute proc = self.process.pop(); # Pop processes off the process attribute list try: # Try to proc.join(); # Join the process except: # On exception proc.communicate(); # Communicate with process if self.verbose: # If verbose print( 'Elapsed: {} {}'.format( round((time.time()-t00)/60),'min' ) ); # Print elapsed time if verbose is true if self.gui: print( 'Waiting for GUI to close...' );