cliamp-terminal-music-player

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cliamp Terminal Music Player

cliamp 终端音乐播放器

Skill by ara.so — Devtools Skills collection.
cliamp is a retro terminal music player inspired by Winamp. It plays local files (MP3, FLAC, WAV, OGG, AAC, ALAC, Opus, WMA), streams (HTTP, HLS, Icecast), podcasts, and integrates with Spotify, YouTube Music, SoundCloud, Bilibili, NetEase Cloud Music, Navidrome, Plex, and Jellyfin. Features include a spectrum visualizer, parametric EQ, playlist management, radio browser, and Lua plugin system.
ara.so开发的技能——Devtools Skills 合集。
cliamp是一款受Winamp启发的复古终端音乐播放器。它支持播放本地文件(MP3、FLAC、WAV、OGG、AAC、ALAC、Opus、WMA)、流媒体(HTTP、HLS、Icecast)、播客,并可与Spotify、YouTube Music、SoundCloud、B站、网易云音乐、Navidrome、Plex、Jellyfin集成。功能包括频谱可视化器、参数均衡器、播放列表管理、广播浏览器和Lua插件系统。

Installation

安装

Quick Install (macOS/Linux)

快速安装(macOS/Linux)

bash
curl -fsSL https://raw.githubusercontent.com/bjarneo/cliamp/HEAD/install.sh | sh
bash
curl -fsSL https://raw.githubusercontent.com/bjarneo/cliamp/HEAD/install.sh | sh

Homebrew (macOS)

Homebrew(macOS)

bash
brew install bjarneo/cliamp/cliamp
The Homebrew formula automatically installs all required codec libraries (FLAC, Vorbis, Ogg).
bash
brew install bjarneo/cliamp/cliamp
Homebrew公式会自动安装所有必需的编解码器库(FLAC、Vorbis、Ogg)。

Arch Linux (AUR)

Arch Linux(AUR)

bash
yay -S cliamp
bash
yay -S cliamp

From Source

从源码安装

Prerequisites:
  • Go 1.25.5 or later
  • Linux: ALSA development headers (
    libasound2-dev
    on Debian/Ubuntu,
    alsa-lib-devel
    on Fedora,
    alsa-lib
    on Arch)
bash
git clone https://github.com/bjarneo/cliamp.git
cd cliamp
make && make install
Or without Make:
bash
go build -o cliamp .
前置依赖:
  • Go 1.25.5或更高版本
  • Linux:ALSA开发头文件(Debian/Ubuntu为
    libasound2-dev
    ,Fedora为
    alsa-lib-devel
    ,Arch为
    alsa-lib
bash
git clone https://github.com/bjarneo/cliamp.git
cd cliamp
make && make install
或不使用Make:
bash
go build -o cliamp .

Optional Runtime Dependencies

可选运行时依赖

Install these for extended format and streaming support:
bash
undefined
安装以下依赖以获得扩展格式和流媒体支持:
bash
undefined

macOS

macOS

brew install ffmpeg yt-dlp
brew install ffmpeg yt-dlp

Debian/Ubuntu

Debian/Ubuntu

sudo apt install ffmpeg yt-dlp
sudo apt install ffmpeg yt-dlp

Arch

Arch

sudo pacman -S ffmpeg yt-dlp

- **ffmpeg**: AAC, ALAC, Opus, WMA playback
- **yt-dlp**: YouTube, YouTube Music, SoundCloud, Bandcamp, Bilibili, NetEase Cloud Music
sudo pacman -S ffmpeg yt-dlp

- **ffmpeg**:支持AAC、ALAC、Opus、WMA播放
- **yt-dlp**:支持YouTube、YouTube Music、SoundCloud、Bandcamp、B站、网易云音乐

Quick Start

快速开始

Basic Playback

基础播放

bash
undefined
bash
undefined

Play a directory

播放目录

cliamp ~/Music
cliamp ~/Music

Play specific files

播放指定文件

cliamp *.mp3 *.flac
cliamp *.mp3 *.flac

Play a stream URL

播放流媒体URL

Play YouTube video/playlist

播放YouTube视频/播放列表

Play SoundCloud track

播放SoundCloud曲目

Interactive Setup Wizard

交互式设置向导

Configure remote providers (Navidrome, Plex, Jellyfin, Spotify, YouTube Music, NetEase Cloud Music):
bash
cliamp setup
The wizard validates connections and writes configuration to
~/.config/cliamp/config.toml
.
配置远程服务提供商(Navidrome、Plex、Jellyfin、Spotify、YouTube Music、网易云音乐):
bash
cliamp setup
向导会验证连接并将配置写入
~/.config/cliamp/config.toml

Key Commands

核心命令

Press
Ctrl+K
in the player to see all keybindings.
在播放器中按
Ctrl+K
查看所有快捷键。

Navigation & Playback

导航与播放

  • Space
    /
    P
    : Play/Pause
  • N
    : Next track
  • Shift+N
    : Previous track
  • S
    : Stop
  • R
    : Open radio browser
  • L
    : Toggle lyrics view
  • F
    : Toggle fullscreen mode
  • Q
    /
    Ctrl+C
    : Quit
  • Space
    /
    P
    :播放/暂停
  • N
    :下一曲
  • Shift+N
    :上一曲
  • S
    :停止
  • R
    :打开广播浏览器
  • L
    :切换歌词视图
  • F
    :切换全屏模式
  • Q
    /
    Ctrl+C
    :退出

Volume & EQ

音量与均衡器

  • +
    /
    -
    : Volume up/down
  • M
    : Mute/unmute
  • E
    : Toggle equalizer
  • Arrow keys in EQ: Adjust frequency bands
  • +
    /
    -
    :音量增加/降低
  • M
    :静音/取消静音
  • E
    :切换均衡器
  • 均衡器中按方向键:调整频段

Playlist Management

播放列表管理

  • A
    : Add to playlist
  • D
    : Remove from playlist
  • C
    : Clear playlist
  • Shift+S
    : Shuffle playlist
  • Ctrl+S
    : Save playlist
  • A
    :添加到播放列表
  • D
    :从播放列表移除
  • C
    :清空播放列表
  • Shift+S
    :随机播放
  • Ctrl+S
    :保存播放列表

Visualizer

可视化器

  • V
    : Cycle visualizer modes (spectrum, bars, dots, etc.)
  • B
    : Toggle visualizer display
  • V
    :切换可视化器模式(频谱、柱状图、点状图等)
  • B
    :切换可视化器显示

Configuration

配置

Configuration file:
~/.config/cliamp/config.toml
配置文件:
~/.config/cliamp/config.toml

Basic Configuration

基础配置

toml
[player]
volume = 80
shuffle = false
repeat = "none"  # none, one, all
visualizer = "spectrum"

[ui]
theme = "winamp"  # winamp, nord, dracula, gruvbox, catppuccin
show_spectrum = true
show_lyrics = true

[audio]
sample_rate = 44100
buffer_size = 4096
toml
[player]
volume = 80
shuffle = false
repeat = "none"  # none, one, all
visualizer = "spectrum"

[ui]
theme = "winamp"  # winamp, nord, dracula, gruvbox, catppuccin
show_spectrum = true
show_lyrics = true

[audio]
sample_rate = 44100
buffer_size = 4096

Spotify Integration

Spotify集成

toml
[spotify]
enabled = true
username = "${SPOTIFY_USERNAME}"
toml
[spotify]
enabled = true
username = "${SPOTIFY_USERNAME}"

Credentials stored separately, configured via 'cliamp setup'

凭证单独存储,通过'cliamp setup'配置


Run `cliamp setup` and select Spotify to authenticate. The wizard handles OAuth flow and stores credentials securely.

运行`cliamp setup`并选择Spotify进行认证。向导会处理OAuth流程并安全存储凭证。

Navidrome Integration

Navidrome集成

toml
[navidrome]
enabled = true
server_url = "https://music.example.com"
username = "${NAVIDROME_USERNAME}"
password = "${NAVIDROME_PASSWORD}"
toml
[navidrome]
enabled = true
server_url = "https://music.example.com"
username = "${NAVIDROME_USERNAME}"
password = "${NAVIDROME_PASSWORD}"

Plex Integration

Plex集成

toml
[plex]
enabled = true
server_url = "https://plex.example.com:32400"
token = "${PLEX_TOKEN}"
toml
[plex]
enabled = true
server_url = "https://plex.example.com:32400"
token = "${PLEX_TOKEN}"

Jellyfin Integration

Jellyfin集成

toml
[jellyfin]
enabled = true
server_url = "https://jellyfin.example.com"
api_key = "${JELLYFIN_API_KEY}"
user_id = "${JELLYFIN_USER_ID}"
toml
[jellyfin]
enabled = true
server_url = "https://jellyfin.example.com"
api_key = "${JELLYFIN_API_KEY}"
user_id = "${JELLYFIN_USER_ID}"

YouTube Music Integration

YouTube Music集成

toml
[youtube_music]
enabled = true
toml
[youtube_music]
enabled = true

Requires yt-dlp and browser cookies

需要yt-dlp和浏览器Cookie

cookies_from_browser = "firefox" # chrome, firefox, safari, etc.

Extract cookies with yt-dlp:
```bash
yt-dlp --cookies-from-browser firefox --print cookies https://music.youtube.com
cookies_from_browser = "firefox" # chrome, firefox, safari等

使用yt-dlp提取Cookie:
```bash
yt-dlp --cookies-from-browser firefox --print cookies https://music.youtube.com

Custom Radio Stations

自定义广播电台

Create
~/.config/cliamp/radios.toml
:
toml
[[stations]]
name = "Soma FM Groove Salad"
url = "https://somafm.com/groovesalad130.pls"
genre = "Ambient"

[[stations]]
name = "NTS Radio 1"
url = "https://stream-relay-geo.ntslive.net/stream"
genre = "Eclectic"

[[stations]]
name = "Jazz24"
url = "https://live.wostreaming.net/direct/ppm-jazz24aac-ibc1"
genre = "Jazz"
创建
~/.config/cliamp/radios.toml
toml
[[stations]]
name = "Soma FM Groove Salad"
url = "https://somafm.com/groovesalad130.pls"
genre = "Ambient"

[[stations]]
name = "NTS Radio 1"
url = "https://stream-relay-geo.ntslive.net/stream"
genre = "Eclectic"

[[stations]]
name = "Jazz24"
url = "https://live.wostreaming.net/direct/ppm-jazz24aac-ibc1"
genre = "Jazz"

Playlist Management

播放列表管理

Save/Load Playlists

保存/加载播放列表

bash
undefined
bash
undefined

Save current playlist

保存当前播放列表

cliamp --save-playlist my-playlist.m3u
cliamp --save-playlist my-playlist.m3u

Load playlist

加载播放列表

cliamp --playlist ~/Music/playlists/favorites.m3u
cliamp --playlist ~/Music/playlists/favorites.m3u

Create M3U playlist manually

手动创建M3U播放列表

cat > my-playlist.m3u << EOF #EXTM3U #EXTINF:180,Artist - Song Title /path/to/song.mp3 #EXTINF:240,Another Artist - Another Song https://example.com/stream.mp3 EOF
cliamp --playlist my-playlist.m3u
undefined
cat > my-playlist.m3u << EOF #EXTM3U #EXTINF:180,Artist - Song Title /path/to/song.mp3 #EXTINF:240,Another Artist - Another Song https://example.com/stream.mp3 EOF
cliamp --playlist my-playlist.m3u
undefined

Supported Playlist Formats

支持的播放列表格式

  • M3U / M3U8
  • PLS
  • Direct URLs (one per line)
  • M3U / M3U8
  • PLS
  • 直接URL(每行一个)

Remote Control (IPC)

远程控制(IPC)

cliamp supports IPC commands when running in daemon mode:
bash
undefined
cliamp在守护进程模式下支持IPC命令:
bash
undefined

Start in headless daemon mode

以无头守护进程模式启动

cliamp --headless ~/Music
cliamp --headless ~/Music

Control from another terminal

在另一个终端中控制

cliamp ipc play cliamp ipc pause cliamp ipc next cliamp ipc previous cliamp ipc volume 75 cliamp ipc seek 30 # seek to 30 seconds cliamp ipc status # get current track info
undefined
cliamp ipc play cliamp ipc pause cliamp ipc next cliamp ipc previous cliamp ipc volume 75 cliamp ipc seek 30 # 跳转到30秒位置 cliamp ipc status # 获取当前曲目信息
undefined

IPC in Scripts

脚本中的IPC

bash
#!/bin/bash
bash
#!/bin/bash

Skip to next track if current track is longer than 10 minutes

如果当前曲目时长超过10分钟则跳至下一曲

status=$(cliamp ipc status --json) duration=$(echo "$status" | jq -r '.duration')
if [ "$duration" -gt 600 ]; then cliamp ipc next fi
undefined
status=$(cliamp ipc status --json) duration=$(echo "$status" | jq -r '.duration')
if [ "$duration" -gt 600 ]; then cliamp ipc next fi
undefined

Lua Plugins

Lua插件

cliamp supports Lua plugins for custom visualizers, audio effects, and UI extensions.
cliamp支持Lua插件,用于自定义可视化器、音频效果和UI扩展。

Plugin Directory Structure

插件目录结构

~/.config/cliamp/plugins/
  └── my-plugin/
      ├── plugin.lua
      └── config.toml (optional)
~/.config/cliamp/plugins/
  └── my-plugin/
      ├── plugin.lua
      └── config.toml(可选)

Example Plugin: Custom Visualizer

示例插件:自定义可视化器

~/.config/cliamp/plugins/pulse-visualizer/plugin.lua
:
lua
-- Plugin metadata
plugin = {
    name = "Pulse Visualizer",
    version = "1.0.0",
    author = "Your Name",
    description = "Pulsing circle visualizer"
}

-- Called on each audio frame
function on_audio_frame(samples, sample_rate)
    -- samples: table of audio samples [-1.0, 1.0]
    -- sample_rate: integer
    
    local sum = 0
    for i, sample in ipairs(samples) do
        sum = sum + math.abs(sample)
    end
    
    local avg = sum / #samples
    local radius = math.floor(avg * 50)
    
    -- Return render data
    return {
        type = "circle",
        x = 40,
        y = 12,
        radius = radius,
        color = {r = 255, g = 100, b = 200}
    }
end

-- Called when plugin loads
function on_load()
    print("Pulse Visualizer loaded")
end

-- Called when plugin unloads
function on_unload()
    print("Pulse Visualizer unloaded")
end
~/.config/cliamp/plugins/pulse-visualizer/plugin.lua
lua
-- 插件元数据
plugin = {
    name = "Pulse Visualizer",
    version = "1.0.0",
    author = "Your Name",
    description = "Pulsing circle visualizer"
}

-- 每个音频帧时调用
function on_audio_frame(samples, sample_rate)
    -- samples: 音频样本表 [-1.0, 1.0]
    -- sample_rate: 整数
    
    local sum = 0
    for i, sample in ipairs(samples) do
        sum = sum + math.abs(sample)
    end
    
    local avg = sum / #samples
    local radius = math.floor(avg * 50)
    
    -- 返回渲染数据
    return {
        type = "circle",
        x = 40,
        y = 12,
        radius = radius,
        color = {r = 255, g = 100, b = 200}
    }
end

-- 插件加载时调用
function on_load()
    print("Pulse Visualizer loaded")
end

-- 插件卸载时调用
function on_unload()
    print("Pulse Visualizer unloaded")
end

Enable Plugin

启用插件

Add to
~/.config/cliamp/config.toml
:
toml
[plugins]
enabled = ["pulse-visualizer"]
添加到
~/.config/cliamp/config.toml
toml
[plugins]
enabled = ["pulse-visualizer"]

Plugin API Reference

插件API参考

Available Lua functions:
lua
-- Audio data
on_audio_frame(samples, sample_rate)

-- Track events
on_track_change(track)  -- track: {title, artist, album, duration}
on_play()
on_pause()
on_stop()

-- Lifecycle
on_load()
on_unload()

-- Drawing functions (available in plugin context)
draw_text(x, y, text, color)
draw_rect(x, y, width, height, color)
draw_circle(x, y, radius, color)
draw_line(x1, y1, x2, y2, color)

-- Utility functions
log(message)
get_config(key)  -- Read plugin config.toml
http_get(url)    -- Simple HTTP request
可用Lua函数:
lua
-- 音频数据
on_audio_frame(samples, sample_rate)

-- 曲目事件
on_track_change(track)  -- track: {title, artist, album, duration}
on_play()
on_pause()
on_stop()

-- 生命周期
on_load()
on_unload()

-- 绘图函数(在插件上下文可用)
draw_text(x, y, text, color)
draw_rect(x, y, width, height, color)
draw_circle(x, y, radius, color)
draw_line(x1, y1, x2, y2, color)

-- 工具函数
log(message)
get_config(key)  -- 读取插件config.toml
http_get(url)    -- 简单HTTP请求

Community Plugins

社区插件

Install community plugins:
bash
cd ~/.config/cliamp/plugins/
git clone https://github.com/bjarneo/cliamp-plugin-soap-bubbles.git soap-bubbles
Enable in config:
toml
[plugins]
enabled = ["soap-bubbles"]
安装社区插件:
bash
cd ~/.config/cliamp/plugins/
git clone https://github.com/bjarneo/cliamp-plugin-soap-bubbles.git soap-bubbles
在配置中启用:
toml
[plugins]
enabled = ["soap-bubbles"]

SSH Streaming

SSH流媒体

Stream audio from a remote server to your local machine:
bash
undefined
将音频从远程服务器流式传输到本地机器:
bash
undefined

On remote server, start cliamp in headless mode

在远程服务器上,以无头模式启动cliamp

cliamp --headless --http-server 0.0.0.0:8080 ~/Music
cliamp --headless --http-server 0.0.0.0:8080 ~/Music

On local machine, forward port and play

在本地机器上,转发端口并播放

ssh -L 8080:localhost:8080 user@remote-server cliamp http://localhost:8080/stream
undefined
ssh -L 8080:localhost:8080 user@remote-server cliamp http://localhost:8080/stream
undefined

Advanced Usage

高级用法

Custom Audio Quality

自定义音频质量

bash
undefined
bash
undefined

High quality playback

高质量播放

cliamp --sample-rate 96000 --buffer-size 8192 ~/Music
cliamp --sample-rate 96000 --buffer-size 8192 ~/Music

Low latency (smaller buffer)

低延迟(更小缓冲区)

cliamp --buffer-size 2048 ~/Music
undefined
cliamp --buffer-size 2048 ~/Music
undefined

Batch Processing with Shell Scripts

Shell脚本批量处理

bash
#!/bin/bash
bash
#!/bin/bash

Play all albums in directory sequentially

按顺序播放目录中的所有专辑

for album_dir in ~/Music/*/; do echo "Playing: $album_dir" cliamp "$album_dir" done
undefined
for album_dir in ~/Music/*/; do echo "正在播放: $album_dir" cliamp "$album_dir" done
undefined

Integration with System Media Controls (Linux)

与系统媒体控制集成(Linux)

Enable MPRIS support to control cliamp with media keys:
toml
[player]
mpris = true
Control with playerctl:
bash
playerctl -p cliamp play-pause
playerctl -p cliamp next
playerctl -p cliamp previous
启用MPRIS支持以使用媒体键控制cliamp:
toml
[player]
mpris = true
使用playerctl控制:
bash
playerctl -p cliamp play-pause
playerctl -p cliamp next
playerctl -p cliamp previous

Now-Playing Display (Quickshell)

正在播放显示(Quickshell)

Example Quickshell widget configuration for displaying currently playing track:
qml
// ~/.config/quickshell/nowplaying.qml
import Quickshell
import Quickshell.Services.Mpris

MprisPlayer {
    player: "cliamp"
    
    Text {
        text: player.metadata.title + " - " + player.metadata.artist
        font.pointSize: 12
    }
}
用于显示当前播放曲目的Quickshell小部件配置示例:
qml
// ~/.config/quickshell/nowplaying.qml
import Quickshell
import Quickshell.Services.Mpris

MprisPlayer {
    player: "cliamp"
    
    Text {
        text: player.metadata.title + " - " + player.metadata.artist
        font.pointSize: 12
    }
}

Troubleshooting

故障排除

No Audio Output (Silence)

无音频输出(静音)

On Linux with PipeWire or PulseAudio, install the ALSA bridge:
bash
undefined
在使用PipeWire或PulseAudio的Linux系统上,安装ALSA桥:
bash
undefined

PipeWire (Arch)

PipeWire(Arch)

sudo pacman -S pipewire-alsa
sudo pacman -S pipewire-alsa

PulseAudio (Arch)

PulseAudio(Arch)

sudo pacman -S pulseaudio-alsa
sudo pacman -S pulseaudio-alsa

PipeWire (Debian/Ubuntu)

PipeWire(Debian/Ubuntu)

sudo apt install pipewire-alsa
sudo apt install pipewire-alsa

PulseAudio (Debian/Ubuntu)

PulseAudio(Debian/Ubuntu)

sudo apt install pulseaudio-alsa
undefined
sudo apt install pulseaudio-alsa
undefined

"Library not loaded" on macOS

macOS上出现“Library not loaded”错误

If you downloaded pre-built binaries directly (not via Homebrew):
bash
brew install flac libvorbis libogg
Or install via Homebrew to avoid this:
bash
brew install bjarneo/cliamp/cliamp
如果直接下载预编译二进制文件(未通过Homebrew安装):
bash
brew install flac libvorbis libogg
或通过Homebrew安装以避免此问题:
bash
brew install bjarneo/cliamp/cliamp

YouTube/SoundCloud Not Playing

YouTube/SoundCloud无法播放

Ensure yt-dlp is installed and up-to-date:
bash
undefined
确保yt-dlp已安装并更新至最新版本:
bash
undefined

Update yt-dlp

更新yt-dlp

pip install --upgrade yt-dlp
pip install --upgrade yt-dlp

or

brew upgrade yt-dlp
brew upgrade yt-dlp

Test yt-dlp

测试yt-dlp

yt-dlp --version
undefined
yt-dlp --version
undefined

Spotify Authentication Failed

Spotify认证失败

Re-run setup wizard:
bash
cliamp setup
Select Spotify and follow the OAuth flow. Ensure your Spotify account is Premium (free accounts are not supported for streaming).
重新运行设置向导:
bash
cliamp setup
选择Spotify并遵循OAuth流程。确保你的Spotify账户为Premium(免费账户不支持流媒体)。

High CPU Usage

CPU占用过高

Reduce visualizer complexity or disable it:
toml
[ui]
show_spectrum = false
Or use a lighter visualizer mode (press
V
to cycle).
降低可视化器复杂度或禁用它:
toml
[ui]
show_spectrum = false
或使用更轻量的可视化器模式(按
V
切换)。

Playlist Not Saving

播放列表无法保存

Ensure the directory exists and is writable:
bash
mkdir -p ~/.config/cliamp/playlists
cliamp --save-playlist ~/.config/cliamp/playlists/my-playlist.m3u
确保目录存在且可写:
bash
mkdir -p ~/.config/cliamp/playlists
cliamp --save-playlist ~/.config/cliamp/playlists/my-playlist.m3u

Remote Server Connection Issues

远程服务器连接问题

Check firewall rules and server URL:
bash
undefined
检查防火墙规则和服务器URL:
bash
undefined

Test Navidrome connection

测试Navidrome连接

curl -u "${NAVIDROME_USERNAME}:${NAVIDROME_PASSWORD}"
"https://music.example.com/rest/ping.view?v=1.16.1&c=cliamp"
curl -u "${NAVIDROME_USERNAME}:${NAVIDROME_PASSWORD}"
"https://music.example.com/rest/ping.view?v=1.16.1&c=cliamp"

Test Plex connection

测试Plex连接

curl -H "X-Plex-Token: ${PLEX_TOKEN}"
"https://plex.example.com:32400/library/sections"
curl -H "X-Plex-Token: ${PLEX_TOKEN}"
"https://plex.example.com:32400/library/sections"

Test Jellyfin connection

测试Jellyfin连接

curl -H "X-Emby-Token: ${JELLYFIN_API_KEY}"
"https://jellyfin.example.com/Users/${JELLYFIN_USER_ID}"
undefined
curl -H "X-Emby-Token: ${JELLYFIN_API_KEY}"
"https://jellyfin.example.com/Users/${JELLYFIN_USER_ID}"
undefined

Common Patterns

常见使用模式

Daily Playlist Rotation

每日播放列表轮换

bash
#!/bin/bash
bash
#!/bin/bash

Rotate through daily playlists

轮换每日播放列表

day=$(date +%u) # 1-7 for Mon-Sun cliamp --playlist ~/.config/cliamp/playlists/day-${day}.m3u
undefined
day=$(date +%u) # 1-7对应周一至周日 cliamp --playlist ~/.config/cliamp/playlists/day-${day}.m3u
undefined

Random Album Playback

随机专辑播放

bash
#!/bin/bash
bash
#!/bin/bash

Play a random album from library

从音乐库中随机播放一张专辑

albums=(~/Music/*/) random_album=${albums[$RANDOM % ${#albums[@]}]} cliamp "$random_album"
undefined
albums=(~/Music/*/) random_album=${albums[$RANDOM % ${#albums[@]}]} cliamp "$random_album"
undefined

Status Bar Integration (i3/polybar)

状态栏集成(i3/polybar)

bash
#!/bin/bash
bash
#!/bin/bash

Display current track in status bar

在状态栏中显示当前曲目

status=$(cliamp ipc status --json 2>/dev/null) if [ $? -eq 0 ]; then title=$(echo "$status" | jq -r '.title // "N/A"') artist=$(echo "$status" | jq -r '.artist // "N/A"') echo "♫ $artist - $title" else echo "" fi
undefined
status=$(cliamp ipc status --json 2>/dev/null) if [ $? -eq 0 ]; then title=$(echo "$status" | jq -r '.title // "N/A"') artist=$(echo "$status" | jq -r '.artist // "N/A"') echo "♫ $artist - $title" else echo "" fi
undefined

Auto-Resume Last Playlist

自动恢复上次播放列表

Add to shell profile:
bash
undefined
添加到shell配置文件:
bash
undefined

~/.bashrc or ~/.zshrc

~/.bashrc 或 ~/.zshrc

alias music='cliamp --playlist ~/.config/cliamp/last-session.m3u'
alias music='cliamp --playlist ~/.config/cliamp/last-session.m3u'

Save on exit (add to cliamp config or wrapper script)

退出时保存(添加到cliamp配置或包装脚本)

trap 'cliamp ipc save-playlist ~/.config/cliamp/last-session.m3u' EXIT

This skill covers installation, configuration, CLI usage, plugin development, remote control, integrations, and troubleshooting for the cliamp terminal music player.
trap 'cliamp ipc save-playlist ~/.config/cliamp/last-session.m3u' EXIT

本技能涵盖了cliamp终端音乐播放器的安装、配置、CLI使用、插件开发、远程控制、集成及故障排除等内容。