How jackaopen/jatubeplayer works
Project type and purpose
• JaTubePlayer is a desktop media‐player application written in Python.
• It supports both local playback (files/folders) and online playback (YouTube videos and live streams), plus features like video archiving, recommendation, and secure OAuth-based access to personal playlists, likes, and subscriptions.
• The public repository only exposes a handful of modules (e.g., get_related_video.py, sub_and_like_public.py) and summary docs—selected “open‐source” pieces—while the core player, GUI, and internal libraries remain closed/obfuscated.
File structure
• Top‐level:
• LICENSE.md, README.md
• get_related_video.py & get_related_video_summary.md
• sub_and_like_public.py & sub_and_like_summary.md
• The absence of folders like frontend/ or _internal/ in this tree indicates that this is a partial open-source slice. The full code (not in this tree) likely contains:
• GUI code (tkinter + sv_ttk)
• Playback engine integration (python-mpv + ffmpeg)
• Settings & token storage modules
• Internal bundling of yt_dlp, ffmpeg.exe, libmpv-2.dll
• Encryption module (Fernet-based, dual-key)
README for additional insights
• Core features listed under “Core Features” and “Advanced Features” reveal the major subsystems:
• Local file player
• Online video search & streaming (yt_dlp + mpv)
• Download/archive manager
• Recommendation engine (get_related_video.py)
• OAuth login & Google API client for playlists, likes, subscriptions (sub_and_like_public.py)
• Token encryption (cryptography + Fernet dual-key)
• Settings panel with version check and cookie management
a. Main components
1. User Interface (Tkinter + sv_ttk)
2. Controller / Event Handlers
3. Playback Engine
– python-mpv binding
– ffmpeg (ffmpeg.exe, ffprobe.exe)
4. Online Video Service
– yt_dlp library (in _internal/yt_dlp)
5. Download Manager
6. Recommendation Service
– get_related_video.py
7. Google API Client
– sub_and_like_public.py
– google-auth & google-api-python-client
8. Encryption Module
– Fernet-based dual-key store
9. Local Storage
– download_output/
– token/key store
10. Version Check Service
11. External Services
– YouTube Data API v3
– YouTube web servers (video streams)
b. Relationships & data flows
• UI ↔ Controller
• Controller → Playback Engine (play local or stream)
• Controller → yt_dlp (search metadata, stream URLs, download)
• Controller → Download Manager → Local Storage
• Controller → Recommendation Service → UI
• Controller → Google API Client ↔ External Google API → Local Storage
• Encryption Module mediates reads/writes of OAuth tokens and API keys
• Version Check Service polls GitHub releases or yt_dlp releases for updates
c. Architectural patterns & principles
• MVC-like separation:
• View = Tkinter UI
• Controller = event handlers mapping UI actions to service calls
• Model = settings, token store, local video metadata
• Service-oriented components for:
• Playback Engine
• Online Video Service
• Download Manager
• Recommendation & History
• API Client & Encryption
• Dependency isolation: bundling of external binaries/libraries under _internal/, root for ffmpeg & mpv DLLs
d. Key technologies
• Python 3.11+, tkinter, sv_ttk
• python-mpv, ffmpeg, ffprobe
• yt_dlp
• cryptography (Fernet), google-auth, google-api-python-client
• Pillow, requests