QTube
QTube is a complete YouTube downloader application with a contemporary GUI in Python, boasting an integrated media player with advanced playback features. The application is crafted for efficient downloading and media playback, utilizing multithreading for seamless performance. It encompasses strong capabilities for video and audio playback, media management, and user engagement.
Features
- YouTube Downloader: Easily download videos from YouTube with a user-friendly interface.
- High-Resolution Video Download: Supports downloading YouTube videos in resolutions up to 8K or 12K if available, ensuring users can access the highest quality video content when possible.
- Integrated Media Player: Play downloaded videos or other media files directly within the application.
- Multithreading: Ensures smooth performance and responsive user experience.
- Drag-and-Drop Support: Enables users to drag and drop files for playback or add links to download videos and playlists.
- Dockable Media Player: Allows users to dock and undock the media player window, providing flexibility in managing video playback space.
- Media Management: Organize and manage your media library with ease.
- Continuous Scanning: Continuously scans the directory for changes.
- Customizable Playback: Control playback speed, volume, and seek within media files.
- Application State Persistence: Automatically saves the application state, including settings, playlists, and playback history, into a JSON file before closing. This allows users to resume their activities seamlessly when reopening the application.
- Theme Toggle: Includes a toggle button to switch between light and dark themes, providing users with customizable visual preferences.
- History Tracking: Keeps a record of downloaded media with other meta information.
- Fullscreen Video Playback: Enjoy videos in fullscreen mode with easy toggling.
- Playback Controls: Includes play, pause, stop, next, previous, seek, repeat, shuffle, and volume control functionalities.
- Playlist Support: Create and manage playlists for seamless media playback.
- Push Notifications: Provides notifications for various states and actions.
- Rich Keyboard Events: Utilizes comprehensive keyboard shortcuts for controlling various aspects of the application, enhancing accessibility and user interaction efficiency.
Images

App Structure
Main Thread
The MainWindow class in this PyQt5 application orchestrates a comprehensive multimedia management interface. It inherits from QMainWindow and integrates various features and functionalities. Upon initialization, it sets up the UI defined in Ui_MainWindow, configures window flags for a frameless appearance, and initializes several default settings and variables related to playback, file management, and UI state. Key components include a media player (MediaPlayer), file-watching system (FileWatcherSystem), history manager (HistoryManager), and internet checker (InternetChecker). Signals and slots are extensively utilized for updating UI elements dynamically and handling user interactions, such as toggling sidebar visibility, managing download actions, updating file lists, and controlling multimedia playback. The class supports drag-and-drop functionality for local file playback and integrates web browser redirections for external links. Notably, it includes state management methods (loadState, saveState) for persisting user preferences and application settings. Overall, MainWindow encapsulates a robust multimedia application interface with responsive user controls and integrated multimedia handling capabilities
- Frameless Window Design: Utilizes
Qt.FramelessWindowHint to create a modern and sleek user interface.
- Multimedia Playback: Integrates MediaPlayer for local media playback and manages playback controls such as play, pause, stop, and volume adjustment.
- Drag-and-Drop Support: Enables users to drag and drop files for playback or to add them to the download queue.
- File Management: Includes features like sorting files, refreshing file lists, and handling default download directories.
- Internet Connectivity: Monitors internet status using
InternetChecker and provides notifications based on connectivity changes.
- Search Functionality: Allows users to search YouTube for videos, displaying results and enabling download directly from search queries.
- Settings and Help Menus: Includes settings for default download directories, notification preferences, and theme selection. Also provides a help menu with additional information.
- Notification System: Implements a notification framework to alert users of events such as download completions and internet connectivity status.
- Theme Customization: Supports loading and switching between dark and light themes based on user preference.
- External Links Integration: Provides buttons to open external links to YouTube, GitHub, LinkedIn, and Instagram profiles for further interaction.
UI Interface
The Ui_MainWindow class in this PyQt5 application serves as the central hub for a multimedia downloader and player interface. It orchestrates a rich set of features, beginning with a responsive menu toggle button that controls the visibility of the menu bar. The class dynamically manages video containers populated with thumbnails and duration labels, facilitating intuitive video browsing. Download functionality is robust, allowing users to initiate downloads with customizable video resolutions, while progress indicators and real-time internet speed updates enhance user feedback during downloads. A comprehensive history display chronicles downloaded items, providing details such as title, URL, elapsed time, and storage location. File management capabilities include playback controls and detailed metadata (size, type, modification time) for listed files. Error handling mechanisms ensure users are promptly notified of download errors, while resume and pause functionalities add flexibility to ongoing downloads. Overall, the Ui_MainWindow class seamlessly integrates PyQt5 widgets and custom components to deliver a user-friendly interface for multimedia management and playback.
- Menu and Toggle Button: Includes a menu toggle button with an icon for toggling the menu bar visibility.
- Video Management: Dynamically adds video containers with thumbnails and duration labels based on provided video data.
- Download Control: Provides buttons for starting downloads with options for different video resolutions.
- Download Progress: Updates download progress, internet speed, and status labels dynamically.
- History Display: Shows a history of downloaded items with details like title, URL, time elapsed, and location.
- File Management: Displays files with options for playback and file details (size, type, last modified time).
- Error Handling: Displays notifications for download errors and handles resume/pause functionalities.
Directory Scanner and File Watcher System
The DirectoryScanner and FileWatcherSystem classes are PyQt5-based components for monitoring and managing directories and files within a PyQt5 application. The DirectoryScanner class scans a specified directory for files and emits a signal when files are changed.
- Continuous Scanning: Continuously scans the directory for changes.
- Rescan Request: Allows requesting a manual rescan of the directory.
- File Information: Emits a signal with detailed information about the files (name, path, type, size, modification time) when changes are detected.
Media Player
MediaPlayer is a PyQt5-based class that manages audio and video playback within a PyQt5 application. It provides a feature-rich media player with capabilities such as full-screen video playback, volume and playback control, and integration with a playlist.
- Fullscreen Video Playback: Supports a separate window for fullscreen video playback.
- Mouse and Keyboard Events: Handles double-click events for toggling fullscreen mode and various keyboard shortcuts for playback control.
- Window Movement: Allows dragging the window using the mouse when not in fullscreen mode.
- Volume Control: Adjust volume and mute/unmute functionality.
- Playback Control: Play, pause, stop, next, previous, seek forward, and seek backward functionality.
- Playlist Management: Supports loading, shuffling, and repeating media files from a specified directory.
- Playback Speed Control: Allows changing the playback speed.
- UI Integration: Connects to a UI with buttons and sliders for interactive control.
Video Window
The video window defines a separate window for fullscreen video playback. It uses QVideoWidget to display video content and manages fullscreen toggling and window movement. Key features include:
- Fullscreen Video: Provides a fullscreen window for video playback.
- Mouse and Keyboard Events: Handles double-click events for toggling fullscreen mode and various keyboard shortcuts for playback control.
- Window Movement: Allows dragging the window using the mouse when not in fullscreen mode.
History Manager
The HistoryManager class manages a history of items with time, elapsed time, location, URL, and title attributes, storing them in a pickle file. It also allows storing and retrieving history items, enabling management of user activity records within an application.
- History Storage: Saves history items including time, elapsed time, location, URL, and title to a file.
- Persistence: Uses pickle serialization for saving and loading history data.
- Data Integrity: Ensures existing data directory and handles file operations safely.
Download Thread
The DownloadThread class is a PyQt5-based thread for downloading media content using yt_dlp. It provides functionality for downloading audio and video files from various sources such as YouTube, with progress reporting and error handling. It enables downloading media content with support for pausing, resuming, and terminating downloads. It integrates with PyQt5 for signals and threading management.
- Download Formats: Supports different download formats based on the type (audio or video) specified during initialization.
- Progress Reporting: Reports download progress including downloaded size, progress percentage, estimated time remaining, and download speed.
- Pause and Resume: Allows pausing and resuming downloads.
- Error Handling: Handles download errors and