Skip to content

alibaghernejad/FScrobble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FScrobble

A Music Scrobbling deamon service, written in F# and .NET.
FScrobble aims to be a simple, reliable and efficient D-Bus and MPRIS music scrobbler service,
allowing users to track their music listening habits by automatically submitting track information to Allowed servers.

FScrobble Logo

"Built with ❤ using F# and .NET."

¹ Footnote: The pipe operator (|>) is a core feature of F# that allows you to pass the result of one function as an argument to another, enabling clean and readable functional code. The logo reflects this concept, symbolizing a pipeline of music streams that are meant to be scrobbled.

Highlights

  • 🎵 Real-time Scrobbling — Automatically track your music listening habits.
  • 🔗 Last.fm Integration — Connect your Last.fm account effortlessly.
  • Lightweight and Fast — Built with F# for performance, simplicity and readability.
  • 🖥️ D-Bus and MPRIS-Compatible — Fully compatible with standard media players like Musikcube, YouTube Music, and others on Linux.

Installation

There are two way to install and use FScrobbe:

Install From Binary (Recommended)

Simply run this command:

wget -qO- https://raw.githubusercontent.com/alibaghernejad/FScrobble/main/scripts/fscrobble-install.sh | bash

Install from Source

  1. Clone the repository:
    git clone https://github.com/alibaghernejad/FScrobble.git
  2. Navigate to the project directory:
    cd FScrobble/src/FScrobble.Shell
  3. Build and run the project:
    dotnet run 

Configuration

FScrobble requires linking to at least one scrobbling server to function properly.
Running the application without configuring a server will result in no activity or functionality.

Important: FScrobble does not automatically scrobble music for all MPRIS-compatible media players on your system by default. This is a deliberate design choice to protect your privacy. It is strongly recommended to explicitly allow only the media players you trust. Additionally, FScrobble provides the flexibility to define metadata rules for each allowed media player, enabling fine-grained control over what gets scrobbled. For more details, refer to the Configuration section.

Supported Scrobbling Servers:

  • Last.fm Last.fm (Supported)
  • Libre.fm Libre.fm (Not Implemented yet)
  • ListenBrainz ListenBrainz (Not Implemented yet)
  • Maloja Maloja (Not Implemented yet)

Step-by-Step Workflow:

  1. Obtain your API Key and Secret from Last.fm. Ensure you have a Last.fm account to access these credentials. To configure your Last.fm API keys, use environment variables:

  2. Update the config.json file or set the following environment variables with your credentials:

    Using Environment Variables:

    export LastFm__ApiKey=YOUR_API_KEY
    export LastFm__ApiSecret=YOUR_API_SECRET

    Using config.json: FScrobble automatically create config.json file with default settings at ~/.config/fscrobble/config.json if it not exists. Update ApiKey and ApiSecret of the LastFm file in as showed bellow:

    {
      "LastFm": {
        "ApiKey": "YOUR_API_KEY",
        "ApiSecret": "YOUR_API_SECRET"
      }
    }
  3. Initialize the connection to Last.fm by running the following command and following the on-screen instructions:

    cd  ~/.local/bin/
    fscrobble connect lastfm
  4. If the setup is successful, you will see something like this message: "Connection to .. scrobbling server successfully initialized."

  5. After completing the setup, close the program and restart the FScrobble systemd service.

    systemctl --user restart fscrobble
  6. Verify that scrobbling is working correctly by visiting your scrobbling dashboard and checking if your recently played tracks are being recorded.

By default, FScrobble allows scrobbling for a limited set of MPRIS-compatible media players to ensure user privacy and security.

Default Allowed Media Players:

These are the default allowed media players rules and can be configured as you wish.
Two media players are allowed by default. That means the music streams from these media players are tracked for scrobbling:

There are only two allowed media players by default: Musikcube and YouTube Music (on Firefox).

Why F# and .NET?

To be honest, this is a side project—a hobby project. While listening to Bruce Springsteen and Udo Lindenberg's catchy songs, I felt the need to track my music listening habits and came up with the idea of writing my own script using MPRIS.
Of course, there are other great services that can do this, but I wanted full control over the data being transmitted to the provided servers.
Additionally, working with the F# ecosystem and its unique approach to software development—which combines functional programming with .NET—was a fantastic experience. The seamless improvements in performance, security, and features in recent .NET versions made it even better.
It's not just about F#. It's about exploring alternative approaches to software development, where the resulting product is efficient, easier to develop, deploy, and maintain.

Name Candidates

As you know, naming things is very important for software engineers and developers! There were a few options and considerations for naming the project.
At first, I chose the Nur + Scrobbling pair, resulting in NurScrobbling. Not bad!
Nur is a German word that means only in English and indicates that this service is responsible for scrobbling music only. After that, I came up with NurScrobble, which was succinct, versatile, and easier to remember.
All in all, I decided to use the FS prefix as an indicator that this project is written in F#. The second character in FS, S, also matches the next word, Scrobble. So, FScrobble not only puts F# and Scrobbling into context but also sounds elegant and chic (hopefully!).

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

We welcome contributions! Feel free to open issues, submit pull requests, or suggest new features.
Keep in mind that there is always room for improvement, and there are also known issues that will be addressed in future releases.

Contact

For questions or feedback, reach out to us at alibaghernezhad@gmail.com.

About

FScrobble – A music scrobbling service built in F# and .NET for your Music listening habits!

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published