Skip to content

Amqx/musicpp

Repository files navigation

MusicPP Build

Discord Rich Presence for the Windows Apple Music desktop app written in C++/WinRT.

all tray

Features

  • Rich presence with track title, artist, album, progress bar, and pause state
  • Album art with Apple Music first, then Spotify, then Imgur as fallbacks (cached in LevelDB)
  • Animated album art (Apple Music motion -> GIF) when available
  • Optional Last.fm now playing + scrobbling
  • Tray icon with metadata copy, copy all, force image refresh, and toggles for Discord Rich Presence/Last.fm (with toast notifications)
  • Presence buttons for Apple Music plus Last.fm or Spotify links (when available)
  • Low resource usage (~5–10MB RAM, ~0.1% CPU, ~20MB disk with deps)

Warning: this was built for personal use; there is no runtime UI for changing settings. Anything beyond the built-in configuration flow requires editing the source.

Requirements

  • Windows 10/11 with the Apple Music app installed
  • Microsoft Visual C++ Redistributable x64 (latest)
    • You may already have this: Look in Settings -> Apps -> Installed apps and search for "Microsoft Visual C++ v14 Redistributable"
  • Optional API credentials:

First Run & Configuration

  1. Download the latest release here or build from source ( instructions below).
  2. On first launch (or after reset) you will be prompted in the console for the API keys above.
  3. After 3 seconds the console closes and MusicPP keeps running from the system tray. Right-click the tray icon to exit.

Saved data:

  • Cache/DB: %LOCALAPPDATA%\\musicpp\\song_db
  • Logs: %LOCALAPPDATA%\\musicpp\\logs

Building from Source

When building from source, if you intend to move the final .exe somewhere, make sure to bring the .dlls with it.

CLion

The simplest path is CLion with VCPKG integration.

  1. Install CLion and Microsoft Visual Studio Build Tools (Community works):
    winget install --id=Microsoft.VisualStudio.2022.Community
  2. Clone the project:
    git clone https://github.com/Amqx/musicpp
  3. Install the VCPKG plugin and enable integration for the project (VCPKG -> Edit -> Add Vcpkg integration to existing CMake Profiles).
  4. Install dependencies:
    ~/.vcpkg-clion/vcpkg/vcpkg.exe install curl leveldb cppwinrt nlohmann-json spdlog libxml2 ffmpeg pkgconf
  5. Install the Discord Social SDK into discordsdk/ (see next section).
  6. Build and run from CLion (Shift + F10).

Manual

  1. Install CMake, Ninja, and Visual Studio Build Tools:
    winget install --id=Kitware.CMake
    winget install --id=Ninja-build.Ninja
    winget install --id=Microsoft.VisualStudio.2022.Community
  2. Install vcpkg (example path is C:\vcpkg):
    git clone https://github.com/microsoft/vcpkg C:\vcpkg
    C:\vcpkg\bootstrap-vcpkg.bat
  3. Clone the repository:
    git clone https://github.com/Amqx/musicpp
  4. Install dependencies (manifest mode):
    cd musicpp
    C:\vcpkg\vcpkg.exe install --triplet x64-windows
  5. Install the Discord Social SDK into discordsdk/ (see next section).
  6. Configure and build (run from a VS Developer PowerShell or after vcvars64.bat):
    cmake -S . -B build -G Ninja `
      -DCMAKE_BUILD_TYPE=Release `
      -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\vcpkg.exe\scripts\buildsystems\vcpkg.cmake" `
      -DVCPKG_TARGET_TRIPLET=x64-windows
    cmake --build build

Installing the Discord Social SDK

Download the SDK from the Discord Developer Portal ( log in required). Choose Social SDK (not the unity/unreal package). Extract discord_social_sdk-{version}.zip, copy discord_social_sdk into the project root, rename it to discordsdk, and keep the bin, lib, and include folders intact so CMake can find them.

Customization

Discord Rich Presence

You can change the presence content in src/discordrp.cpp inside void Discordrp::update(). Available metadata has already been extracted for you:

  • Title (title)
  • Artist (artist)
  • Album (album)
  • Image link (imglink)
  • Apple Music link (amlink)
  • Last.fm link (LFMlink)
  • Spotify link (splink)
  • Current playback state (playing)
  • Playback start (start_ts)
  • Projected end (end_ts)
  • Pause timestamp (pause_ts)

Check links for emptiness before using them, and pick timestamps based on the current playback state (start/end when playing, pause when not). Discord buttons are only visible to other users, not on your own profile.

Last.fm Scrobbling Behaviour

Tunables live in include/constants.h under the Last.fm section. Read the Last.fm scrobble docs and guidelines before changing values. Available settings (format: description ( type)(var)(min)):

  • Maximum scrobble attempts (int)(kMaxScrobbleAttempts)
  • Maximum now playing attempts (int)(kMaxSetNowPlayingAttempts)
  • Minimum track length in seconds (int)(kLfmMinTime)(30)
  • Percentage of duration before scrobble (double)(kLfmPercentage)(0.5)
  • Time before auto-scrobble in seconds (int)(kLfmElapsedTime)(240)

About

Apple Music Discord Presence

Resources

License

Stars

Watchers

Forks

Contributors