1080*80 ad

cmusfm: Last.fm Scrobbling for cmus

How to Scrobble to Last.fm from cmus: The Ultimate Guide

For fans of the minimalist, command-line music player cmus, efficiency and control are paramount. This powerful tool strips away the graphical clutter, leaving you with a pure, keyboard-driven music experience. However, one popular feature has often required manual workarounds: integrating your listening history with Last.fm.

If you’re a cmus user who wants to keep your Last.fm profile updated without sacrificing your terminal-based workflow, you’re in the right place. A dedicated, lightweight utility makes it incredibly simple to automatically scrobble tracks, bridging the gap between your favorite console player and the world’s largest music tracking service.

This guide will walk you through the entire process of setting up automatic Last.fm scrobbling for cmus.

Why Integrate cmus with Last.fm?

Last.fm is more than just a listening log; it’s a powerful tool for music discovery and analysis. By scrobbling your tracks from cmus, you gain access to:

  • Personalized Music Statistics: Track your most-played artists, albums, and tracks over any period.
  • Tailored Recommendations: Last.fm uses your listening data to suggest new music you’re likely to enjoy.
  • Social Connectivity: Share your music taste with friends and discover what they’re listening to.

Connecting cmus ensures that every track you play in your focused, terminal environment contributes to your rich, long-term listening profile.

The Best Way to Connect cmus and Last.fm

The most reliable method for this integration is using a small Python-based utility designed specifically for the task. This tool acts as a bridge, monitoring cmus for track changes and securely communicating with the Last.fm API.

Its key features make it the ideal solution:

  • “Now Playing” Updates: Instantly updates your Last.fm profile to show what you’re currently listening to.
  • Intelligent Scrobbling: Tracks are only submitted after a certain percentage of the song has been played (typically 50%), preventing accidental scrobbles from quick track skips.
  • Offline Caching: If you lose your internet connection, the tool saves your listening history locally. Once you’re back online, it automatically submits all cached scrobbles, ensuring no track is missed.
  • Lightweight and Efficient: It runs silently in the background with minimal system resource usage, perfectly aligning with the cmus philosophy.

Step-by-Step Setup Guide

Getting this system up and running is straightforward. Follow these four simple steps to enable automatic scrobbling.

Step 1: Install the Scrobbling Utility

First, you need to install the necessary tool. The easiest way is using pip, the Python package installer. Make sure you have Python 3 and pip installed on your system.

Open your terminal and run the following command:

pip install cmusfm

This command downloads and installs the utility and its dependencies, making it available on your system’s PATH.

Step 2: Configure Your Last.fm Account

Next, you need to securely connect the utility to your Last.fm account. The tool includes a simple, interactive configuration command.

Run this in your terminal:

cmusfm configure

You will be prompted to enter your Last.fm username and password. This information is used to create an authenticated session token, which is then stored securely in a local configuration file. Your credentials are used only once for this initial setup.

Step 3: Link the Scrobbler to cmus

This is the final and most crucial step. You need to tell cmus to use this utility as its status display program. cmus will automatically execute this program every time a track changes or playback is paused/resumed.

  1. Open cmus.

  2. Press : to enter the command-line mode within cmus.

  3. Type the following command and press Enter:

    :set status_display_program=cmusfm
    

That’s it! The integration is now active. Your settings are automatically saved in your cmus configuration file, so you only need to do this once.

Step 4: Verify It’s Working

To confirm everything is set up correctly, simply play a track in cmus. After a few seconds, check your Last.fm profile page. You should see the track listed under “Now Playing.” Once the track has played past the halfway mark, it will be officially scrobbled to your library.

Security and Final Tips

  • Password Security: The tool uses your password only to generate a secure session key with Last.fm’s official API. It does not store your plaintext password. The session key is saved in a configuration file located at ~/.config/cmusfm/config.ini.
  • Check the Status: If you ever suspect something isn’t working, you can manually run cmusfm in your terminal to see the status of the last played track and check for any errors.
  • Customization: For advanced users, the config.ini file allows you to tweak settings, such as the percentage of a track that must be played before it’s scrobbled.

By following this guide, you can seamlessly enhance your cmus experience with full Last.fm integration. Enjoy the perfect blend of command-line efficiency and comprehensive music tracking.

Source: https://www.linuxlinks.com/cmusfm-last-fm-scrobbler-cmus-music-player/

900*80 ad

      1080*80 ad