taskmasterpeace / Massey

Mass Transcript
1 stars 0 forks source link

Split Files Issue #1

Open taskmasterpeace opened 1 week ago

taskmasterpeace commented 1 week ago

the progress tracking for split files is not being handled correctly. The app is marking some files as "Completed" prematurely, particularly for the split files.

taskmasterpeace commented 1 week ago

the progress tracking for split files is not being handled correctly. The app is marking some files as "Completed" prematurely, particularly for the split files.

Update the file progress tracking: In the split_and_queue_file method, we should update the progress to reflect that the original file is still being processed, not completed. Adjust the completion counting: We need to ensure that the completion count is only incremented when all parts of a split file are processed. Improve the status updates: Provide more accurate status updates for split files. Here's how we plan to modify the relevant parts of the code:

def split_and_queue_file(self, file_path):
    file_name = os.path.basename(file_path)
    self.update_file_progress(file_name, "Splitting", 25)

    # ... (splitting code remains the same)

    self.update_file_progress(file_name, "Processing parts", 75)
    self.queue_file(part1_path, original_file=file_name)
    self.queue_file(part2_path, original_file=file_name)

def queue_file(self, file_path, original_file=None):
    file_name = os.path.basename(file_path)
    self.transcription_queue.put((file_path, original_file))
    self.update_file_progress(file_name, "Queued", 0)

def process_queue(self, client):
    processed_parts = {}
    while not self.transcription_queue.empty() and not self.stop_event.is_set():
        file_path, original_file = self.transcription_queue.get()
        self.transcribe_file(client, file_path, original_file)

        if original_file:
            if original_file not in processed_parts:
                processed_parts[original_file] = 1
            else:
                processed_parts[original_file] += 1

            if processed_parts[original_file] == 2:  # Both parts processed
                self.update_file_progress(original_file, "Completed", 100)
                self.completed_files += 1
        else:
            self.completed_files += 1

        self.update_overall_progress()

def transcribe_file(self, client, file_path, original_file=None):
    file_name = os.path.basename(file_path)
    try:
        # ... (transcription code remains the same)

        if not original_file:
            self.update_file_progress(file_name, "Completed", 100)
        else:
            self.update_file_progress(original_file, f"Part {processed_parts[original_file]}/2 done", 75 + (processed_parts[original_file] * 12.5))
    except Exception as e:
        self.update_file_progress(file_name, f"Failed: {str(e)}", 100)
        if original_file:
            self.update_file_progress(original_file, f"Failed: {str(e)}", 100)

These changes will: Keep track of the original file for split parts. Update the progress more accurately for split files. Only mark a file as completed when all its parts are processed. Adjust the completion count to avoid premature completion of split files. With these modifications, the progress tracking should be more accurate, especially for split files. The app will now show the correct status for files that are split and being processed in parts, and it will only mark them as completed when all parts are finished.