Skip to content
professor-leePublic

About

A cross-platform TUI Netease Cloud Music Player, with audio visualization and almost complete functions.

Topics

Resources

Code of conduct

Contributing

Stars

180 stars

Watchers

1 watching

Forks

Latest commit

 

History

622 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English    |    简体中文

A Rust TUI client for NetEase Cloud Music, with an embedded fullscreen playback page.

Rust Platform License Stars Forks Release Last Commit Commit Activity Code Size

Project Overview

CNMPlayer (Customized NetEase Music Player) is a NetEase Cloud Music client that runs in the terminal. A single process carries two UIs:

  • the host UI — login, home recommendations, playlist / artist / search pages, a sliding sidebar and a five-row collapsed player bar;
  • the fullscreen playback page — cover, lyrics, playlist overlay, a 10-band EQ and the visualizers. The fullscreen keybind (default Ctrl+F) opens it; inside, Ctrl+F or Esc returns to the host.

Playback belongs to the host: streaming with a local cache, queue memory, private roam, VIP-aware audio quality and the visualization modes that the other UI draws.

CNMPlayer is an unofficial client; music copyright belongs to the rights holders, and the cache / download features are for personal offline use only. Read DISCLAIMER.md before use.

Screenshots

Host UI: home page   Host UI: home sidebar
Host UI — home recommendations; sidebar with created / collected playlists

Fullscreen playback page: bars spectrum   Fullscreen playback page: oscilloscope waveform
Fullscreen playback page — bars spectrum; oscilloscope waveform

Fullscreen playback page: vector mode   Host UI: search page
Fullscreen vector mode; search results for a suffix query

Features

Account

  • QR code (F1), username / email + password (F2) and phone + SMS code (F3) login
  • The session is persisted to auth/session.toml and validated on the next start
  • Logout from the settings modal (clears the login cookie, playback memory and private-roam data)

Browsing

  • Home: a recommendation tile grid whose first three slots are always 每日推荐 (Daily Recommendations), 私人雷达 (Private Radar) and 私人漫游 (Private Roam); home_more_recommend expands the remaining recommendations
  • Home sidebar (toggle keybind, default P): your created and collected playlists, 100 per fetch and appended when scrolling to the end; Ctrl+Up/Down switches section, Enter opens, Esc collapses
  • Playlist page — also used for albums, there is no separate album page; a header (cover, title, author, description, track count) above a virtualized track list, 100 tracks per fetch. Browsing and playback share one source-bound cursor, so a page fetched by either is appended to both
  • Artist page: avatar, name, hot-song / album / EP / single counts and a tile grid per section
  • Search page: a keyword searches artists, playlists and songs at once, with a trailing suffix to narrow the type (see Search syntax)
  • Private roam: refreshed on the first startup of each UTC day, keeping the last played track at the head; skipped when the restored playback queue comes from private roam and caught up on the next non-roam startup; reaching the end of the list fetches more (three API calls merged and de-duplicated); the tile cover follows the currently playing roam song. On the private roam page M cycles the recommendation mode (Default → Familiar → Explore, shown in the title as Private Roam · Default) and refetches the whole list; while roam is playing the current song stays at the head and the rest of the queue switches to the new mode. The mode is saved with the roam data
  • Navigation: Enter opens or plays, Esc / Left goes back, Tab / Down and Shift+Tab / Up move, PageUp / PageDown jump one page
  • Mouse: the wheel scrolls, a single click focuses, a double click activates; the collapsed player bar's previous / play-pause / next, like and repeat-mode buttons and its progress bar are clickable

Search syntax

The search box (Ctrl+S) searches artists, playlists and songs at once; a trailing suffix narrows it to one type. @author and @artist are synonyms, and an empty keyword with @author lists the artists you follow.

Query Results Enter
keyword most relevant artists, playlists and songs depends on the focused row: play the song, open the artist or the playlist
keyword@single songs plays the song, queueing the result set from that row
keyword@album albums opens the album in the playlist layout
keyword@list playlists opens the playlist
keyword@author / keyword@artist artists opens the artist page
@author (no keyword) followed artists opens the artist page

Artists and playlists are capped at the 5 most relevant hits and never paginate; only the song section appends more when you scroll to the end.

Playback

  • Streaming: the song is downloaded into the local audio cache while it plays, and only becomes the cached file after the complete response is written — a partial or cancelled transfer is never played from the cache. The buffered part of the progress bar shows download progress.
  • Seeking from the progress bar or inside the fullscreen page, with a pulse animation while the position catches up
  • Queue memory (playback_memory): queue, current index, repeat mode, the queue's origin list and, in shuffle mode, the shuffle progress (played history and the rest of the current round) are saved on every track change and restored on startup; the restored track starts from the beginning
  • VIP-aware audio quality (audio_quality): 9 levels from standard to jymaster; a non-VIP account is clamped to exhigh
  • 10-band EQ, ±12 dB (eq_bands_db), edited from the fullscreen EQ modal and applied to the live stream
  • Like / unlike from the fullscreen page and from the collapsed player bar
  • Repeat modes: sequence → shuffle → loop all → loop one; shuffle plays every song in the queue once per round and previous walks back the songs actually played
  • Playlist playback prefetches the next page when entering the last three loaded tracks, and waits for an unfinished page instead of stopping or wrapping early. In shuffle mode the loaded songs are played through first (the next page is prefetched when three of them remain); each newly loaded page is shuffled on its own and played after them
  • System media control with metadata and cover art: MPRIS on Linux (bus suffix cnmplayer), System Media Transport Controls (SMTC) on Windows, Now Playing (Control Center, media keys, headphone buttons) on macOS

Downloads

  • Songs are saved to cnmplayer/ inside the system music directory (download_path overrides it; falls back to ~/Music/cnmplayer/)
  • Entry points: the download button on single-song rows in the host, the button left of the heart on the fullscreen title row, Ctrl+Alt+D (host) and Ctrl+D (fullscreen); pressing again cancels the download and removes the partial file
  • One download runs at a time; extra requests queue up and run in order
  • File name is Title - Artist - Album.<mp3|flac>, with tags written in: title, artists, album, track number, date, embedded cover and lyrics (Vorbis Comment for lossless, ID3v2 for mp3)
  • Download quality and path live in the "Download Settings" page: an absolute path enables downloads; an empty value or the literal Null disables them (the download buttons disappear and the quality row greys out)

Visualization

  • hidden (shown as "Off" in settings) — the fullscreen right-hand side is collapsed: neither the visualizer nor the lyrics are drawn, and the song info panel stretches across the terminal width
  • lyrics (shown as "Lyrics") — lyrics only, no visualizer
  • bars — an internal Rust port of Cava's spectrum algorithm, rendered with eight sub-cell height levels; it is the default and needs no external cava
  • oscilloscope — a real-PCM waveform that smoothly settles to a flat line on pause, stop or audio interruption, and reopens when playback resumes
  • vector — a Lissajous vectorscope: the left channel drives the horizontal axis and the right channel the vertical one (up is always positive), scaled so the track's loudest moment so far fills the panel. On pause or a sudden cut to silence the figure bursts apart into drifting dots that settle and twinkle until playback resumes
  • The collapsed player bar draws a 10-cell braille mini spectrum (blank in lyrics and hidden), and the narrow small window draws a stereo VU meter fed by a 400 ms momentary LUFS meter (−60…0 LUFS)
  • PCM tapping runs only while a visible visualizer needs it; LUFS metering runs only in the narrow small window. Changing visualization modes, resizing or entering/leaving fullscreen updates these consumers during playback without restarting the track.
  • A flat 10-band EQ bypasses filtering without disabling any requested visualization or LUFS consumer. EQ changes apply at complete audio-frame boundaries without restarting playback; returning to flat clears the old filter history.

Bars and the mini spectrum analyze CNMPlayer's own decoded playback PCM, tapped after the 10-band EQ and before the playback volume — not the microphone, the system output or other applications. The spectrum is a faithful Rust port of Cava's algorithm at commit 6d43df3b2c7882122585c02c064b20009842a6f8, and its FFT backend is pure Rust (realfft). See THIRD_PARTY_NOTICES.md for attribution and full license terms.

Small window mode

Enabled by default (small_window_display = false turns it off). It applies to the host's content pages, and takes over as soon as the terminal drops below the thresholds:

Terminal size Behavior
width ≥ 32 and height ≥ 12 normal UI
width ≥ 32, 5 ≤ height < 12 flat layout: page lyrics on top, the 5-row collapsed player bar at the bottom
width ≥ 32, height = 5 flat layout, one panel at a time: the toggle keybind (default Alt+X) slides between the player bar and the lyrics
width < 32, height ≥ 12 narrow layout: full-width stereo LUFS VU bars
both dimensions too small Terminal too small

Entering the mode closes the sidebar and any open overlay. Settings, the search box and the sidebar cannot be opened while it is active, and only quit, previous, next, play-pause, repeat mode, like (collapsed), the small-window toggle key and the flat player bar's mouse targets (previous, play-pause, next, like, repeat mode, progress seek) still respond.

Interface

  • Themes: loaded dynamically from themes/*.toml — 20 built-ins, frappe by default; drop in your own toml and it joins the cycle. Files that fail validation are skipped, and a broken selected theme falls back to the default
  • UI language: zh / en
  • 26 rebindable shortcuts with conflict detection; Ctrl+Alt+R restores the defaults
  • Transparent background, album-cover border and hint lines
  • Startup: a loading page (ASCII title plus progress bar) appears first, while login restore and recommendation fetches run in the background step by step; an unusable saved session hands over to the login page
  • About modal with braille art, and a hidden easter egg inside it (the easter-egg cargo feature, compiled in by default and removable with --no-default-features)

Installation

Install with curl

Linux and macOS, from an empty directory:

curl -fsSL https://github.com/professor-lee/CNMPlayer/releases/latest/download/install.sh -o cnmplayer-install.sh && sh cnmplayer-install.sh

Windows PowerShell (5.1 or later), from an empty directory; no Git Bash or WSL needed:

curl.exe -fsSL https://github.com/professor-lee/CNMPlayer/releases/latest/download/install.ps1 -o cnmplayer-install.ps1
if ($LASTEXITCODE -eq 0) { .\cnmplayer-install.ps1 }

You can inspect the downloaded script before running it. It installs for the current user without changing PATH; follow the path hint it prints. Set CNMPLAYER_VERSION to an exact release tag or CNMPLAYER_INSTALL_DIR to choose a binary directory. To upgrade, run the installer again. It checks the archive against SHA256SUMS from the same tag. If PowerShell policy disallows scripts, use the ZIP below instead.

These release URLs become available with the first tag containing the Unix and Windows installers. Older releases (including v0.7.5) only provide Linux archives; the Unix installer can install those as well.

Arch Linux (AUR)

Package Contents
cnmplayer-bin Prebuilt binary from the latest GitHub Release
cnmplayer Builds the latest release tag from source
cnmplayer-git Builds the develop branch
# with paru
paru -S cnmplayer-bin

Manual installation

On the Releases page, choose CNMPlayer_<tag>_<platform>_<arch>: .tar.xz for GNU/Linux, .tar.gz for macOS, .zip for Windows. amd64 means Intel/AMD x86-64; aarch64 means ARM64 (including Apple silicon). Each archive contains the executable, LICENSE and THIRD_PARTY_NOTICES.md. Verify the archive against the release's SHA256SUMS before extracting. Linux binaries are built on Ubuntu 24.04 for glibc, not Alpine/musl; they need the native runtime libraries below.

# Download SHA256SUMS next to the tarball; verify the downloaded architecture.
sha256sum --check --ignore-missing SHA256SUMS
tar -xJf CNMPlayer_vX.Y.Z_linux_amd64.tar.xz
./cnmplayer

Build from source

git clone https://github.com/professor-lee/CNMPlayer.git
cd CNMPlayer
cargo build --release
./target/release/cnmplayer

Build dependencies on Debian/Ubuntu (the same list is used by CI):

sudo apt update
sudo apt install -y build-essential cmake pkg-config \
  libasound2-dev libchafa-dev libpipewire-0.3-dev libssl-dev libglib2.0-dev libclang-dev

libchafa-dev must be chafa ≥ 1.8.0 (the image renderer probes it through pkg-config), and libclang-dev plus libpipewire-0.3-dev are needed because the PipeWire audio backend generates bindings at build time. libasound2-dev is a build-time requirement only: cpal compiles its ALSA backend unconditionally on Linux, while playback itself goes through PipeWire.

On Windows, cargo build --release needs the Rust MSVC toolchain and linker. chafa is not used there (cover art uses halfblocks), TLS uses SChannel and audio uses WASAPI.

On macOS, cargo build --release needs Rust and the Xcode Command Line Tools. Cover art uses halfblocks, TLS uses the Security framework and audio uses CoreAudio.

Requirements

  • Linux with PipeWire for audio (the ALSA backend is deprecated), and the chafa shared library at runtime; macOS needs no extra runtime library
  • A Nerd Font is required for the playback and navigation icons; the application never guesses glyph availability from TERM

When the system default output changes or disappears (for example, unplugging headphones), playback pauses and keeps its position. It does not resume on its own; press play to continue on the current output. On macOS, if no output is left at all, the system stops the output stream; pressing play once an output is back opens a new stream and continues from the same position (with no output it stays paused and reports that no audio output device is available). Only real output-stream failures stop playback; the failure is reported as an error (see below).

First Run and Asset Root

On first run the app creates an asset directory under your OS config directory; on Linux this is usually ~/.config/cnmplayer, on macOS ~/Library/Application Support/cnmplayer. If CNMPLAYER_ASSET_DIR is set, that directory becomes the asset root instead.

The root holds (files appear as you use the app):

  • config/default.toml — application, playback, keybind and cache settings
  • themes/*.toml — theme files (the key is the file's name field, falling back to the file name); any extra .toml dropped here becomes selectable
  • auth/session.toml — the persisted login cookie (refreshed cookies from the server are written back)
  • auth/device.toml — the persisted device ID; kept across logouts so the client keeps one device identity
  • playback/session.toml — the remembered queue (written while playback_memory is on)
  • private_roam/session.toml — the private-roam list, its last played position, recommendation mode and the cached cover

The cache root defaults to the OS cache directory (~/.cache/cnmplayer on Linux, ~/Library/Caches/cnmplayer on macOS) and can be moved with cache.path. It holds:

  • audio/<song_id>__<quality>.audio — finished downloads; a transfer in flight is a .part file and is removed on failure or cancellation (a hard kill can leave one behind)
  • cover/ — cover images fetched for the now-playing track
  • mpris_art/ — cover files exported for the MPRIS player (Linux only)
  • Player.log and Player.stderr.log — application log and the native audio backends' stderr (both capped at 4 MB). The app shows no status or error text inside its UI: status messages go to Player.log only, and errors are also printed to the terminal after CNMPlayer exits (including fatal errors and panics)

Configuration

The repository's config/default.toml is embedded at build time and is the single source of defaults: first-run configuration, Config::default() and missing-field completion (including nested cache settings). User values override the template, and missing fields are saved back on startup. Unparsable files, invalid enum values and zero ui_fps return an error without replacing the user file; out-of-range page_lyrics_pos_x / page_lyrics_pos_y are clamped.

Key Default Values / notes
theme frappe Any theme key from themes/*.toml (20 built-ins, custom files picked up); a broken file falls back to the default
language zh zh, en
visualize bars hidden (shown as "Off" in settings), lyrics ("Lyrics"), bars, oscilloscope, vector; all visualizers are internal
transparent_background true Use the terminal background
album_border true Border around the fullscreen cover
graphics_protocol halfblocks off (ASCII art) or halfblocks (colored halfblock cover rendering; legacy auto / sixel / kitty / iterm2 values load as this)
show_hints true Hint line on the content pages and in the fullscreen page's panel border
page_lyrics false Two-line lyrics overlay on the content pages
page_lyrics_drag true Lyrics overlay can be dragged with the mouse
page_lyrics_snap true Snap to the nearest edge (left/right/top/bottom, the other axis stays free; only editable while dragging is on)
page_lyrics_pos_x 1.0 Normalized horizontal position of the overlay's top-left (0=left, 1=right)
page_lyrics_pos_y 1.0 Normalized vertical position of the overlay's top-left (0=top, 1=bottom)
word_lyrics true Per-character coloring: YRC word timings when available, otherwise line progress
lyric_translation false Show lyric translations
lyric_frame_divisor 2 Lyric animation sampling divisor on top of ui_fps (1–8); does not change the redraw rate
small_window_display true Compact layouts for small terminals
home_more_recommend false Expand the home page beyond the three pinned tiles
scrobble false General Settings → Scrobble to NetEase: report each listen of 20 s or more (paused time excluded) to NetEase listening history when switching songs, when playback stops and on exit; may carry account risk-control risk
mpris_name "" General Settings → MPRIS Service Name (Linux only): plain text or @play for the current title (retained while paused); empty input or no current title uses CNMPlayer. Windows and macOS have no such row: SMTC takes the source name from the app registration and Control Center takes the app name from the process, so neither reads this value
default_opening_title "" Replaces the ASCII banner on the login and loading pages; supports \n
audio_quality exhigh standard, higher, exhigh, lossless, hires, jyeffect, sky, dolby, jymaster; clamped to exhigh without VIP
download_audio_quality exhigh Download quality: same option set as audio_quality, VIP-aware as well
download_path unset Download directory (absolute; defaults to <music dir>/cnmplayer/, falling back to ~/Music/cnmplayer/); an empty value or the literal Null (case-insensitive) disables downloads
playback_memory false Persist and restore the queue, index and repeat mode
eq_bands_db 10 × 0.0 EQ gains in dB, edited from the fullscreen EQ modal
bar_number auto auto, 16, 32, 48, 64, 80, 96 (fullscreen spectrum)
bar_channels mono stereo, mono
bar_channel_reverse false Draw the right channel on the left (fullscreen spectrum)
bars_gap false Leave a gap between bars
ui_fps 60 Positive integer cap for continuous UI animation on the host and the fullscreen page. Dirty input/content updates are submitted immediately; idle surfaces wake on a one-second heartbeat. Actual FPS depends on terminal speed and processing cost
cache.path unset Cache directory override (defaults to the OS cache directory)
cache.clean_strategy both size, age, both
cache.max_size_mb 500 Size ceiling for the LRU pass
cache.max_age_days 7 Age limit for the TTL pass
cache.clean_on_startup true Run the cleanup while starting
keybind_* see below 26 rebindable shortcuts

Cleanup runs as an age pass followed by a size LRU pass, and only looks at files directly inside the directory.

Keyboard Shortcuts

Rebindable

Rebinding syntax: optional Ctrl / Alt / Shift, then a key name (Esc, Enter, Space, Tab, BackTab, arrows, Home, End, PageUp/PgUp, PageDown/PgDn, Insert, Delete, Backspace, Plus, F1–F12) or a single character. A binding that collides with another slot is rejected, and Ctrl+Alt+R (Ctrl+R on macOS) inside the keybind modal restores every default.

The defaults below are those of Linux and Windows. macOS terminals type special characters with Option unless "Use Option as Meta key" (or the equivalent) is turned on, so the macOS build ships different defaults for the slots that use Option:

Setting macOS default
keybind_prev / keybind_next Shift+Left / Shift+Right
keybind_toggle_play_pause Ctrl+P
keybind_toggle_mode Ctrl+O
keybind_fullscreen_eq_reset Ctrl+E
keybind_toggle_like_collapsed Ctrl+L
keybind_small_window_toggle Ctrl+X
keybind_download Ctrl+D

These only apply to a newly created configuration, to keys missing from it and to restoring the defaults; keys already in your configuration file are kept.

Setting Default Effect
keybind_search_box Ctrl+S Open the search box
keybind_fullscreen Ctrl+F Enter the fullscreen page, or return to the host from it
keybind_settings T Open the settings modal (also closes it)
keybind_sidebar P Toggle the home sidebar / the fullscreen playlist overlay
keybind_quit Q Quit
keybind_page_up pageUP Scroll one page up (search, playlist)
keybind_page_down pageDown Scroll one page down (search, playlist)
keybind_prev Alt+Left Previous track
keybind_next Alt+Right Next track
keybind_toggle_play_pause Alt+Space Play / pause
keybind_toggle_mode Alt+M Cycle the repeat mode (host)
keybind_fullscreen_prev Left Previous track (fullscreen page only)
keybind_fullscreen_next Right Next track (fullscreen page only)
keybind_fullscreen_toggle_play_pause Space Play / pause (fullscreen page only)
keybind_fullscreen_toggle_mode M Cycle the repeat mode (fullscreen page only)
keybind_fullscreen_eq E Open the EQ modal (fullscreen page only)
keybind_fullscreen_eq_reset Alt+R Reset the EQ (fullscreen page only)
keybind_toggle_like_fullscreen L Like / unlike (fullscreen page only)
keybind_toggle_like_collapsed Alt+L Like / unlike from the collapsed player bar
keybind_small_window_toggle Alt+X Switch between the flat small-window panels
keybind_download Ctrl+Alt+D Download the focused song (press again to cancel)
keybind_download_fullscreen Ctrl+D Download the current song (fullscreen page only; press again to cancel)
keybind_toggle_subscribe L Follow / unfollow the artist on the artist page, or collect / uncollect the playlist, album, EP or single on the playlist page (host only; the heart right of the title does the same)
keybind_fullscreen_open_artist Ctrl+A Open the current song's artist page (fullscreen page only). With several artists each press highlights the next one; stop pressing for 0.8 s to open the highlighted artist, any other key cancels
keybind_fullscreen_open_album Ctrl+S Open the current song's album page (fullscreen page only)
keybind_private_roam_mode M Cycle the private roam mode (Default → Familiar → Explore) and refetch the list (private roam page only)

The fullscreen-only slots are inert in the host: there they fall through to page navigation instead, and so does keybind_private_roam_mode outside the private roam page. Conflicts are only checked between slots that act on the same side, so a host-only slot may share a key with a fullscreen-only one (L, Ctrl+S, M). Keys that close a modal follow their slot: the settings modal closes on keybind_settings and the search box on keybind_search_box, so rebinding a slot also retires its old key.

Fixed shortcuts

  • Esc — close the current overlay, or go back from the current page
  • Ctrl+C — quit from any state
  • Ctrl+K — open the keybind list; press it again inside the list to close the whole modal on either UI, not return to settings. Esc retains its parent-navigation behavior. The host list shows every key grouped by function (General, Playback, Like & Download, Jump, Equalizer, Window, Fixed Keys); one-sided entries are tagged (Host) / (Fullscreen), and focus skips the group headers. The fullscreen list shows only the keys that work on the fullscreen page.
  • Ctrl+Up / Ctrl+Down (Left / Right on macOS) — switch the sidebar playlist section (Created / Collected) while the sidebar is open
  • Ctrl+Alt+R (Ctrl+R on macOS) — restore the default keybinds (inside the keybind modal)
  • F1 / F2 / F3 — login method (QR / account / phone)

Per page

Login page:

  • F1 refresh the QR code, F2 account login, F3 phone login
  • Tab / Down next field, Shift+Tab / Up previous field, Enter confirm or submit
  • Q quits while no username / password field is focused

Search box:

  • Enter runs the search, Esc / Ctrl+S closes it
  • Home / End / Left / Right / Backspace / Delete edit the query; clicking positions the caret

Search, playlist and artist pages:

  • Enter opens or plays the focused item, Esc or Left goes back
  • Tab / Down next item, Shift+Tab / Up previous item
  • PageUp / PageDown move a whole page (search and playlist pages)
  • M cycles the recommendation mode on the private roam page

Settings modal:

  • Up / Down / Tab / Shift+Tab move, Left / Right / Enter change a value, Esc steps back
  • Mouse: the wheel moves the selection, a single click focuses a row and a double click activates it — except in the Lyrics Settings subpage, where a single click flips the switch
  • Keybind modal: Enter starts rebinding, Esc cancels it while waiting for input; Ctrl+K closes the whole modal and cancels any pending rebinding without changing the binding. Fixed keys are listed read-only.

Fullscreen page:

  • The host ignores the entry keybind while the terminal is narrower than 50 columns
  • P opens the playlist overlay, Up / Down select, Enter plays, Esc closes it
  • T opens the settings modal, Ctrl+K the keybind list, About is reachable from the settings modal; these modals open and close immediately, including while playback is paused.
  • E opens the EQ modal; arrows move and adjust a band, Alt+R resets it, Esc / E closes it
  • Up / Down adjust the volume, Left / Right change track, Space plays or pauses, M cycles the repeat mode, L likes the song
  • Ctrl+F or Esc returns to the host; the mouse clicks the control buttons, the progress bar, the volume bar (click, or press and drag), the like glyph and the playlist rows; clicking an artist name (each name of a multi-artist line is its own target) or the album name leaves the fullscreen page for that artist's or album's page in the host; an open overlay takes the wheel for row focus, and its rows focus on a single click and activate on a double click (the EQ modal sets a band on click)
  • If small_window_display is on and the terminal drops below 50 columns or 12 rows, the fullscreen page returns to the host by itself
  • Entering and leaving fullscreen slides the player layout up from the bottom like a drawer (and back down on exit); mouse controls are active as soon as the entry transition finishes

Notes

  • There are no command line flags. The environment variables are CNMPLAYER_ASSET_DIR (asset root) and COLORTERM / TERM (color capability detection); on Windows, color detection also reads WT_SESSION (Windows Terminal), TERM_PROGRAM and ConEmuANSI, and defaults to true color when the console accepts VT sequences.
  • AUR packages are for Arch Linux. Media control is MPRIS on Linux, SMTC on Windows (Windows 10 1607 or later) and Now Playing on macOS; other platforms have none. On macOS the program body runs on a worker thread while the main thread runs the Cocoa event loop that Now Playing needs; the app adds no Dock icon and does not take focus from the terminal.
  • API responses and cover downloads have a 30-second deadline covering headers and the complete body; slow audio bodies stay cooperatively cancellable instead of imposing a total song-download deadline.
  • Cover art never falls back to ASCII art: at most a transient halfblock preview is shown while loading, and missing or failed artwork stays blank.

Tech Stack

  • Rust 2024
  • TUI: ratatui + crossterm
  • Async and networking: compio + cyper
  • NetEase API client: CRIA (crate cria-api, imported as cria), split out of this repository; see Related Projects
  • Playback: rodio + symphonia (mp3 / flac) over PipeWire (WASAPI on Windows, CoreAudio on macOS)
  • Metadata, artwork and download tags: image + qrcode + lofty
  • Image rendering: ratatui-image + chafa (built-in halfblocks on Windows and macOS)
  • Visualization: internal Cava Rust spectrum port (realfft) fed by a shared playback PCM tap
  • System media control: mpris-server on Linux, SMTC through the windows crate on Windows, MPNowPlayingInfoCenter / MPRemoteCommandCenter through objc2-media-player on macOS
  • Fullscreen playback: embedded src/tmplayer/ UI using host playback and shared configuration

Development

cargo run                              # development build
cargo build --release                  # release build
cargo test --workspace --all-targets   # all crate tests
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings

CI (ci.yml) runs check and test for the default and --no-default-features builds on stable, then fmt and clippy gates, plus clippy and tests on macOS (Apple silicon and Intel). The API client is checked in the CRIA repository's own CI. Release (release.yml) runs the test gates before publishing, publishes SHA256SUMS alongside the x86_64 and aarch64 tarballs, and maintains the AUR packages.

Windows-only code lives in windows/ and is mounted with #[cfg(windows)] + #[path], so Linux builds never compile it. Check it from Linux with rustup target add x86_64-pc-windows-gnu and cargo clippy --target x86_64-pc-windows-gnu --all-targets --all-features -- -D warnings.

macOS-only code lives in macos/ the same way (#[cfg(target_os = "macos")] + #[path]). Type-check it from Linux with rustup target add aarch64-apple-darwin and cargo clippy --target aarch64-apple-darwin --all-targets --all-features -- -D warnings; linking and running need a Mac (or the macOS CI job).

Related Projects

  • CRIA (Cloud-music Rust Integration API): the NetEase Cloud Music API client CNMPlayer uses, published on crates.io as cria-api. It was developed here as the vendored ncm-api-rs/ crate and split into its own MIT-licensed repository with its history preserved, so other Rust projects can use it. Endpoint changes and request-layer fixes now go to CRIA, and CNMPlayer picks them up by bumping the cria-api version.
  • ncm-api-rs: the earlier Rust port CRIA's code base started from

Disclaimer

The full disclaimer — unofficial client, music copyright, personal-use-only cache and downloads, account risk and liability — is in DISCLAIMER.md.

License

CNMPlayer is licensed under AGPL-3.0-only.

Third-party attributions and license notices for the CRIA dependency, adapted algorithms and the FFT dependencies are documented in THIRD_PARTY_NOTICES.md, which is also included in the prebuilt release archives.

See CITATION.cff for the standard citation metadata and upstream references.


Star History

Star History Chart

About

A cross-platform TUI Netease Cloud Music Player, with audio visualization and almost complete functions.

Topics

Resources

Code of conduct

Contributing

Stars

180 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages