Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Problem Statement

Add features to both the CLI script (1_Improved_REMUX_Script.py) and GUI script (remux_gui.py) to detect and display available languages in MKV files before prompting the user for language selection.

Changes Required for REMUX Python Scripts/1_Improved_REMUX_Script.py:

  1. Add a new function get_available_languages() after the identify_tracks() function (around line 43):

    • This function should scan all MKV files in the provided list
    • Extract all unique audio and subtitle languages from the tracks
    • Return two sorted lists: audio languages and subtitle languages
    • Display a scanning message using console.print()
  2. Add a new function prompt_language_selection() after get_available_languages():

    • Display the available audio languages found
    • Display the available subtitle languages found
    • Prompt user to enter desired audio languages (comma-separated)
    • Prompt user to enter desired subtitle languages (comma-separated)
    • Validate that entered languages exist in the available languages (show warning if not)
    • Return the selected audio and subtitle language lists
  3. Modify the main() function (starting at line 391):

    • After collecting mkv_files (around line 431), call get_available_languages(mkvmerge_path, mkv_files) to scan files
    • If no audio languages are found, print error and return
    • Call prompt_language_selection() with the available languages to get user's choice
    • Remove the manual input prompts for audio_langs and sub_langs (lines 407-414)
    • The selected languages should be passed to remux_file_and_update() as before
    • Update the log file to include selected audio and subtitle languages (around line 452)

Changes Required for REMUX Python Scripts/remux_gui.py:

  1. Add the same get_available_languages() function after identify_tracks() (around line 37):

    • Same functionality as CLI version but without console.print statements
  2. Add a new method scan_languages() to the RemuxApp class (after browse_output() method around line 220):

    • Check if input directory is valid
    • Get list of MKV files from input directory
    • Show warning if no files found
    • Update status label to show scanning progress
    • Disable the scan button during scanning
    • Run get_available_languages() in a separate thread to avoid freezing GUI
    • Call display_scan_results() when done
  3. Add a new method display_scan_results() to the RemuxApp class:

    • Create a popup window (Toplevel) to display results
    • Show available audio languages in a scrollable Text widget
    • Show available subtitle languages in a scrollable Text widget
    • Add a "Use These Languages" button that populates the language entry fields
    • Add a "Close" button
    • Re-enable the scan button and update status label
  4. Modify the UI in __init__() method (around line 157-164):

    • Add a "Scan Languages" button after the language entry fields
    • This button should call self.scan_languages()
    • Add tooltip or label indicating users can scan files to see available languages
    • Ensure the scan button is disabled if mkvmerge is not found
  5. Update the start_remux() method:

    • Disable the scan button when remuxing starts
    • Re-enable it when finished (in the process_queue method around line 283)

Expected Behavior:

CLI Script:

  • After user selects input/output directories, script scans all MKV files
  • Displays: "Available audio languages: eng, jpn, ger" (example)
  • Displays: "Available subtitle languages: eng, ger, fre" (example)
  • Prompts user to select which languages to keep
  • Shows selected languages before processing begins

GUI Script:

  • User selects input directory
  • User clicks "🔍 Scan Available Languages" button
  • Popup shows all available languages found in the files
  • User can click "Use These Languages" to auto-populate the entry fields
  • User can manually edit the fields before starting remux
  • Scan button is disabled during scanning and remuxing

Important Notes:

  • Keep all existing functionality intact
  • Language codes should be normalized to lowercase
  • Handle the case where language is "und" (undefined)
  • The remux logic already accepts audio_langs and sub_langs parameters, so that doesn't need to change
  • Maintain the existing Rich UI formatting for the CLI script
  • Maintain the existing tkinter UI structure for the GUI script

This pull request was created as a result of the following prompt from Copilot chat.

Problem Statement

Add features to both the CLI script (1_Improved_REMUX_Script.py) and GUI script (remux_gui.py) to detect and display available languages in MKV files before prompting the user for language selection.

Changes Required for REMUX Python Scripts/1_Improved_REMUX_Script.py:

  1. Add a new function get_available_languages() after the identify_tracks() function (around line 43):

    • This function should scan all MKV files in the provided list
    • Extract all unique audio and subtitle languages from the tracks
    • Return two sorted lists: audio languages and subtitle languages
    • Display a scanning message using console.print()
  2. Add a new function prompt_language_selection() after get_available_languages():

    • Display the available audio languages found
    • Display the available subtitle languages found
    • Prompt user to enter desired audio languages (comma-separated)
    • Prompt user to enter desired subtitle languages (comma-separated)
    • Validate that entered languages exist in the available languages (show warning if not)
    • Return the selected audio and subtitle language lists
  3. Modify the main() function (starting at line 391):

    • After collecting mkv_files (around line 431), call get_available_languages(mkvmerge_path, mkv_files) to scan files
    • If no audio languages are found, print error and return
    • Call prompt_language_selection() with the available languages to get user's choice
    • Remove the manual input prompts for audio_langs and sub_langs (lines 407-414)
    • The selected languages should be passed to remux_file_and_update() as before
    • Update the log file to include selected audio and subtitle languages (around line 452)

Changes Required for REMUX Python Scripts/remux_gui.py:

  1. Add the same get_available_languages() function after identify_tracks() (around line 37):

    • Same functionality as CLI version but without console.print statements
  2. Add a new method scan_languages() to the RemuxApp class (after browse_output() method around line 220):

    • Check if input directory is valid
    • Get list of MKV files from input directory
    • Show warning if no files found
    • Update status label to show scanning progress
    • Disable the scan button during scanning
    • Run get_available_languages() in a separate thread to avoid freezing GUI
    • Call display_scan_results() when done
  3. Add a new method display_scan_results() to the RemuxApp class:

    • Create a popup window (Toplevel) to display results
    • Show available audio languages in a scrollable Text widget
    • Show available subtitle languages in a scrollable Text widget
    • Add a "Use These Languages" button that populates the language entry fields
    • Add a "Close" button
    • Re-enable the scan button and update status label
  4. Modify the UI in __init__() method (around line 157-164):

    • Add a "Scan Languages" button after the language entry fields
    • This button should call self.scan_languages()
    • Add tooltip or label indicating users can scan files to see available languages
    • Ensure the scan button is disabled if mkvmerge is not found
  5. Update the start_remux() method:

    • Disable the scan button when remuxing starts
    • Re-enable it when finished (in the process_queue method around line 283)

Expected Behavior:

CLI Script:

  • After user selects input/output directories, script scans all MKV files
  • Displays: "Available audio languages: eng, jpn, ger" (example)
  • Displays: "Available subtitle languages: eng, ger, fre" (example)
  • Prompts user to select which languages to keep
  • Shows selected languages before processing begins

GUI Script:

  • User selects input directory
  • User clicks "🔍 Scan Available Languages" button
  • Popup shows all available languages found in the files
  • User can click "Use These Languages" to auto-populate the entry fields
  • User can manually edit the fields before starting remux
  • Scan button is disabled during scanning and remuxing

Important Notes:

  • Keep all existing functionality intact
  • Language codes should be normalized to lowercase
  • Handle the case where language is "und" (undefined)
  • The remux logic already accepts audio_langs and sub_langs parameters, so that doesn't need to change
  • Maintain the existing Rich UI formatting for the CLI script
  • Maintain the existing tkinter UI structure for the GUI script

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@mlbkumar9 mlbkumar9 marked this pull request as ready for review October 18, 2025 14:11
@mlbkumar9 mlbkumar9 merged commit aa493ea into main Oct 18, 2025
1 check failed
Copilot AI requested a review from mlbkumar9 October 18, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants