How victornivelo/reproductor_mp3 works
Project Type and Purpose
• The project is a desktop music player application written in Python.
• It uses a graphical user interface (GUI) with both a light and dark mode (as seen in the README images and “modo claro” and “modo oscuro” references).
• The application likely manages audio playback, user-configurable settings, statistical tracking, and playlist management using JSON files stored under the “datos” directory.
Analyzing the File Structure
• Top-level directories include:
• datos – Contains configuration files, statistics (canciones.json, reproduccion.json), and user playlists (favorito, me_gusta).
• prototipo – Appears to hold a prototype with an HTML based (or web-like) interface and associated prototype scripts. These are likely early or alternative UI experiments.
• src – Contains the actual source code organized by MVC principles:
▪ modelo – Contains classes/models such as “biblioteca.py” and “cancion.py.”
▪ vista – Contains the GUI components (main view in vista_principal.py, and additional reusable components like mini_reproductor and tooltips).
▪ controlador – Contains controllers to handle interactions such as file operations, music library management, button interactions, theme changes, and controlling the playback.
▪ Additionally, a “constantes.py” and a “utiles.py” file are present for shared constants and utility functions.
• The test folder indicates there are unit tests for at least some components (e.g., test/test_constantes.py).
• Build/script files like “requirements.txt” provide a list of dependencies which support the technical stack.
a. Main Components:
• GUI (Vista): Represents the user interface elements. Include:
• Main window (vista_principal.py)
• Sub-components (cola_reproduccion, configuracion, estadisticas, mini_reproductor, etc.)
• Controllers: Located in src/controlador.
• Main controller logic (controlador.py)
• Specialized controllers: handling files, library (biblioteca), playback (reproductor), buttons, and theme configurations.
• Models: Located in src/modelo.
• Music library (biblioteca.py)
• Song objects (cancion.py)
• Data Storage: JSON files within the “datos” folder which store persistent configurations, playback statistics, and playlists.
b. Relationships and Interactions:
• The GUI (view) interacts directly with the controllers. For example, when a user clicks on a play button, the GUI forwards this event to the corresponding controlador_reproductor.
• Controllers mediate between the view and the model: user actions in the view lead to changes in the model (e.g., updating playlists, fetching song data).
• The model then reads/writes data to JSON files located in the “datos” directory to persist configurations and statistics.
• The prototipo folder can be visualized as an experimental or alternate interface layer that may share similar underlying logic but is not the main focus.
c. Architectural Patterns or Design Principles:
• MVC (Model-View-Controller): Separation of interface (vista), business logic (controlador), and data (modelo).
• The project also emphasizes modularity, separating concerns into discrete modules and packages (e.g., different controllers for different functionalities).
• Use of JSON for configuration and data persistence indicates a lightweight approach for data storage rather than a full-blown database.
d. Relevant Technologies and Libraries:
• Python is the main programming language.
• Likely uses GUI frameworks (potentially Tkinter or PyQt, inferred from file names and structure – check “vista” components for specifics).
• The requirements.txt will list the actual dependencies, but it likely includes libraries for GUI development, JSON processing, and possibly multimedia handling.
Additional Details to Capture
• Incorporate modularity by identifying each controller’s role (for instance, controlador_biblioteca.py for library management, controlador_reproductor.py for playback).
• Cross-cutting utilities and common functions (like those in src/utiles.py) that support multiple parts of the system.
• Primary entry point (src/principal.py) which likely initializes the application and orchestrates the setup of view, controller, and model.