diff --git a/AI_AGENT.md b/AI_AGENT.md index bd50a2e..dc1f346 100644 --- a/AI_AGENT.md +++ b/AI_AGENT.md @@ -2,15 +2,18 @@ ## Project Description -This is a Python Terminal User Interface (TUI) application for managing media files. It uses the Textual library to provide a curses-like interface in the terminal. The app allows users to scan directories for video files, display them in a hierarchical tree view, and view detailed metadata information including video, audio, and subtitle tracks. +This is a Python Terminal User Interface (TUI) application for managing media files. It uses the Textual library to provide a curses-like interface in the terminal. The app allows users to scan directories for video files, display them in a hierarchical tree view, view detailed metadata information including video, audio, and subtitle tracks, and rename files based on intelligent metadata extraction. Key features: - Recursive directory scanning -- Tree-based file navigation -- Detailed metadata extraction and display from multiple sources -- Color-coded information +- Tree-based file navigation with expand/collapse functionality +- Detailed metadata extraction from multiple sources +- Intelligent file renaming with proposed names +- Color-coded information display - Keyboard and mouse navigation +- Multiple UI screens (main app, directory selection, help, rename confirmation) - Extensible extractor and formatter architecture +- Loading indicators and error handling ## Technology Stack @@ -19,6 +22,7 @@ Key features: - PyMediaInfo (detailed track information) - Mutagen (embedded metadata) - Python-Magic (MIME type detection) +- Langcodes (language code handling) - UV (package manager) ## Code Structure diff --git a/README.md b/README.md index e748ffb..eae8f5e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # Renamer - Media File Renamer and Metadata Editor -A terminal-based (TUI) application for scanning directories, viewing media file details, and managing file metadata. Built with Python and Textual. +A terminal-based (TUI) application for scanning directories, viewing media file details, and renaming files based on extracted metadata. Built with Python and Textual. ## Features - Recursive directory scanning for video files - Tree view navigation with keyboard and mouse support - Detailed metadata extraction from multiple sources (MediaInfo, filename parsing, embedded metadata) +- Intelligent file renaming with proposed names based on metadata - Color-coded information display - Command-based interface with hotkeys - Extensible extractor and formatter system - Support for video, audio, and subtitle track information +- Confirmation dialogs for file operations ## Installation @@ -50,12 +52,25 @@ renamer /path/to/media/directory - **q**: Quit the application - **o**: Open directory selection dialog - **s**: Rescan current directory +- **f**: Refresh metadata for selected file +- **r**: Rename selected file with proposed name +- **p**: Toggle tree expansion (expand/collapse all) +- **h**: Show help screen ### Navigation - Use arrow keys to navigate the file tree +- Right arrow: Expand directory +- Left arrow: Collapse directory or go to parent - Mouse clicks supported - Select a video file to view its details in the right panel +### File Renaming +1. Select a media file in the tree +2. Press **r** to initiate rename +3. Review the proposed new name +4. Press **y** to confirm or **n** to cancel +5. The file will be renamed and the tree updated automatically + ## Architecture The application uses a modular architecture with separate extractors and formatters: @@ -68,11 +83,18 @@ The application uses a modular architecture with separate extractors and formatt ### Formatters - **MediaFormatter**: Formats extracted data for display +- **ProposedNameFormatter**: Generates intelligent rename suggestions - **TrackFormatter**: Formats video/audio/subtitle track information - **SizeFormatter**: Formats file sizes - **DateFormatter**: Formats timestamps - **DurationFormatter**: Formats time durations - **ResolutionFormatter**: Formats video resolutions +- **TextFormatter**: Text styling utilities + +### Screens +- **OpenScreen**: Directory selection dialog +- **HelpScreen**: Application help and key bindings +- **RenameConfirmScreen**: File rename confirmation dialog ### Setup Development Environment ```bash @@ -117,3 +139,4 @@ uv tool uninstall renamer - pymediainfo: Detailed media track information - mutagen: Embedded metadata extraction - python-magic: MIME type detection +- langcodes: Language code handling diff --git a/ToDo.md b/ToDo.md index 1b4d417..12a611c 100644 --- a/ToDo.md +++ b/ToDo.md @@ -14,5 +14,15 @@ TODO Steps: 11. ✅ Add custom tree styling with file icons and colored guides 12. ✅ Add scrollable details panel 13. ✅ Handle markup escaping for file names with brackets -14. Implement metadata editing capabilities (future steps) -15. Implement file renaming functionality (future steps) \ No newline at end of file +14. ✅ Implement file renaming functionality with confirmation dialog +15. ✅ Add proposed name generation based on metadata extraction +16. ✅ Add help screen with key bindings and usage information +17. ✅ Add tree expansion/collapse toggle functionality +18. ✅ Add file refresh functionality to reload metadata for selected file +19. ✅ Optimize tree updates to avoid full reloads after renaming +20. ✅ Add loading indicators for metadata extraction +21. ✅ Add error handling for file operations and metadata extraction +22. Implement metadata editing capabilities (future enhancement) +23. Add batch rename operations (future enhancement) +24. Add configuration file support (future enhancement) +25. Add plugin system for custom extractors/formatters (future enhancement) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ea47ddc..21a78b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "renamer" -version = "0.1.1" -description = "Add your description here" +version = "0.2.0" +description = "Terminal-based media file renamer and metadata viewer" readme = "README.md" requires-python = ">=3.11" dependencies = [