Urgent.News

What's breaking now, across thousands of outlets.

Tech

How I built a CLI music player in Python and what I learned

After months of learning Python through tutorials, I decided to build something I'd actually use every day and I really want to build instead of todo app. The result: a command line music player that integrates with the Deezer API, plays audio through yt-dlp and VLC, and stores playlists and favorite artists in a local SQLite database. What I used: Deezer API > search artists and songs yt-dlp >…

A Python programmer, who had been mastering the language through tutorials, chose to create a practical application rather than a simple to-do list. The outcome was a command line music player that connected with the Deezer API to search for artists and songs, used yt-dlp for audio fetching and streaming, VLC for playback control, and SQLite for local storage of playlists and favorite artists.

The tools at the programmer's disposal included the Deezer API for accessing music data, yt-dlp for handling audio, VLC for playback management, SQLite for storing playlists and favorite artists, and requests for making API calls.

One aspect stood out as particularly intriguing. When the programmer added the capability to save artists and songs at the same time, they encountered a "database locked" error. Initially, they hypothesized a missing commit, having inadvertently executed two commits following each insertion. Even after merging the commits, the error persisted.

Eventually, it was discovered that a previous development version had left a database connection open. This lingering connection was running in the background, locking the database. By terminating the processes, and ensuring proper connection closure upon exit, the issue was resolved swiftly.

The programmer learned an important lesson: the bug might not always be in the line of code they're currently examining; it could also reside in the system or the environment itself. Their next steps involved developing a graphical user interface, packaging the application for easy installation, conducting extensive testing, and sharing the project on GitHub. Their GitHub repository address is https://github.com/Iheb-eng/music-app. They welcome any feedback or suggestions.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A CSV diff should reject duplicate IDs before it reports changes

Authorship: this article and the linked toolkit were prepared by Codex on behalf of the account owner. The examples use synthetic data.

  • CSV diff tool rejects duplicate IDs before reporting changes
  • Node.js toolkit version 0.2.0 enforces strict rules on duplicates
  • Audit identifies records with missing info and invalid fields

More from Saturday 12 September →