How roccobalocco/youmusicdownloader works
Purpose and Entry Points
Desktop Python application for downloading YouTube audio, including batches from direct URLs, YouTube playlists, and Spotify playlists. The main executable/UI entry point is youMusicDownloader.py; executor.ipynb appears to be an interactive development or execution notebook.
GUI Orchestration
youMusicDownloader.py owns the PySimpleGUI window, user inputs, option checkboxes, and download actions. It coordinates URL submission, playlist modes, progress/display behavior, and calls into service-specific utilities. GUI rendering support is separated into utils/drawer.py.
YouTube Acquisition Pipeline
YouTube-specific retrieval and audio download logic is concentrated in utils/ytFuns.py. This layer likely isolates pytube interactions: resolving individual video URLs or playlist entries, selecting audio streams, and saving downloaded media. The GUI should treat this as the boundary for YouTube network/API behavior.
Spotify-to-YouTube Resolution
utils/sptFuns.py handles Spotify integration through spotipy. Spotify playlist URLs are expanded into track metadata, then those tracks must be converted into searchable/downloadable YouTube targets through the YouTube pipeline. Spotify authentication is an external-service boundary; the README notes an initial OAuth-style console login flow.
Batch and Concurrent Downloads
utils/threadDownloader.py provides the multi-download execution layer. It is the likely boundary between UI control flow and worker-thread download tasks, allowing playlist and multi-URL requests to run without blocking the desktop interface. It coordinates work derived from utils/ytFuns.py and potentially Spotify-expanded track lists.
Control and Data Flow
1. A user enters one or more YouTube, playlist, or Spotify playlist URLs in youMusicDownloader.py.
2. GUI options determine whether URLs are treated as individual media, YouTube playlists, or Spotify playlists.
3. Spotify inputs pass through utils/sptFuns.py to obtain track candidates.
4. Download targets pass to utils/threadDownloader.py for batch/concurrent execution.
5. Workers invoke utils/ytFuns.py to fetch maximum-bitrate audio and write files locally.
6. UI feedback is rendered or updated through youMusicDownloader.py and utils/drawer.py.
Runtime and External Dependencies
The application runs as a local Python desktop process. Core runtime dependencies are PySimpleGUI for the interface, pytube for YouTube access/downloads, and spotipy for Spotify playlist access and authentication. Network access to YouTube and Spotify is required; downloaded audio is persisted to the local filesystem.
Architectural Boundaries
Keep UI event handling in youMusicDownloader.py, presentation helpers in utils/drawer.py, service adapters in utils/ytFuns.py and utils/sptFuns.py, and concurrency/task execution in utils/threadDownloader.py. These boundaries are important because provider authentication, URL parsing, media extraction, and thread lifecycle failures should not directly leak into GUI event logic.
Components 12
Desktop application
- User
- GUI event controller · Collects URLs, modes, and download options.
youMusicDownloader.py - GUI rendering
utils/drawer.py - Interactive executor
executor.ipynb
Download services
- Batch task executor · Runs multi-target downloads off the UI path.
utils/threadDownloader.py - YouTube acquisition · Resolves videos or playlists and saves maximum-bitrate audio.
utils/ytFuns.py - Spotify playlist resolver · Expands Spotify playlists into track candidates.
utils/sptFuns.py
External systems
- YouTube
- Spotify
- Local audio files
Other components
- URLs and options
- Download targets · Video URLs, playlist entries, or Spotify-derived candidates.
Connections 14
- User → GUI event controller: submits
- GUI event controller → URLs and options: reads
- GUI event controller → GUI rendering: updates UI
- GUI event controller → Spotify playlist resolver: Spotify playlist mode
- GUI event controller → Batch task executor: starts batch
- Spotify playlist resolver → Spotify: OAuth and playlist lookup
- Spotify playlist resolver → Download targets: track candidates
- GUI event controller → Download targets: YouTube URLs or playlists
- Batch task executor → Download targets: consumes
- Batch task executor → YouTube acquisition: worker downloads
- YouTube acquisition → YouTube: resolves and fetches audio
- YouTube acquisition → Local audio files: writes audio
- Batch task executor → GUI event controller: progress and results
- Interactive executor → GUI event controller: interactive execution