├── .gitignore ├── go.mod ├── go.sum ├── .github └── workflows │ └── package.yml ├── README.md ├── main.go └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .vscode -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module yunshu_music_local 2 | 3 | go 1.25.0 4 | 5 | require github.com/unitnotes/audiotag v0.1.0 // indirect 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/hjfreyer/taglib-go v0.0.0-20250508221915-cb3b18d1ad7b h1:205iYsSfmwawdcrADhzrnRSUeujcigFWPl0qbNuAJSs= 2 | github.com/hjfreyer/taglib-go v0.0.0-20250508221915-cb3b18d1ad7b/go.mod h1:eSDoUM0WCOj3y5CUX9yQVbMSlGd4YSd/ukmLIhxLZaI= 3 | github.com/unitnotes/audiotag v0.1.0 h1:HPJ2MxPKJX4NJvv6Zb6bNtyhPGCgATAeVP7fPn4zoW0= 4 | github.com/unitnotes/audiotag v0.1.0/go.mod h1:jc9bJbSj9+6OkJSDJfJv40jWfhOGCi7M4W23dp8frGA= 5 | -------------------------------------------------------------------------------- /.github/workflows/package.yml: -------------------------------------------------------------------------------- 1 | name: Build Multi-Platform Binaries and Upload to Release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | create-release: 8 | runs-on: ubuntu-latest 9 | outputs: 10 | upload_url: ${{ steps.create_release.outputs.upload_url }} 11 | steps: 12 | - name: Create Release 13 | id: create_release 14 | uses: actions/create-release@v1 15 | env: 16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 17 | with: 18 | tag_name: ${{ github.ref }} 19 | release_name: Release ${{ github.ref }} 20 | draft: true 21 | prerelease: false 22 | 23 | build-and-upload: 24 | runs-on: ubuntu-latest 25 | needs: create-release 26 | strategy: 27 | matrix: 28 | os: [linux, windows, darwin] 29 | arch: [amd64, arm64] 30 | 31 | steps: 32 | - name: Checkout Code 33 | uses: actions/checkout@v4 34 | 35 | - name: Set up Go 36 | uses: actions/setup-go@v5 37 | with: 38 | go-version: '1.25.0' 39 | 40 | - name: Build Binary 41 | id: build 42 | run: | 43 | export GOOS=${{ matrix.os }} 44 | export GOARCH=${{ matrix.arch }} 45 | # Determine the output file name with .exe extension for Windows 46 | OUTPUT_FILE="yunshu_music_local-${GOOS}-${GOARCH}${{ matrix.os == 'windows' && '.exe' || '' }}" 47 | echo "Building for ${GOOS}/${GOARCH}..." 48 | go build -o $OUTPUT_FILE main.go 49 | echo "output_file=$OUTPUT_FILE" >> $GITHUB_ENV 50 | 51 | - name: Upload Release Asset 52 | uses: actions/upload-release-asset@v1 53 | env: 54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 55 | with: 56 | upload_url: ${{ needs.create-release.outputs.upload_url }} 57 | asset_path: ${{ env.output_file }} 58 | asset_name: ${{ env.output_file }} 59 | asset_content_type: application/octet-stream 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

云舒音乐本地服务端

2 | 3 |
4 | 5 | [![GitHub stars](https://img.shields.io/github/stars/itning/yunshu_music_local.svg?style=social&label=Stars)](https://github.com/itning/yunshu_music_local/stargazers) 6 | [![GitHub forks](https://img.shields.io/github/forks/itning/yunshu_music_local.svg?style=social&label=Fork)](https://github.com/itning/yunshu_music_local/network/members) 7 | [![GitHub watchers](https://img.shields.io/github/watchers/itning/yunshu_music_local.svg?style=social&label=Watch)](https://github.com/itning/yunshu_music_local/watchers) 8 | [![GitHub followers](https://img.shields.io/github/followers/itning.svg?style=social&label=Follow)](https://github.com/itning?tab=followers) 9 | 10 |
11 | 12 |
13 | 14 | [![GitHub issues](https://img.shields.io/github/issues/itning/yunshu_music_local.svg)](https://github.com/itning/yunshu_music_local/issues) 15 | [![GitHub license](https://img.shields.io/github/license/itning/yunshu_music_local.svg)](https://github.com/itning/yunshu_music_local/blob/master/LICENSE) 16 | [![GitHub last commit](https://img.shields.io/github/last-commit/itning/yunshu_music_local.svg)](https://github.com/itning/yunshu_music_local/commits) 17 | [![GitHub repo size in bytes](https://img.shields.io/github/repo-size/itning/yunshu_music_local.svg)](https://github.com/itning/yunshu_music_local) 18 | [![Hits](https://hitcount.itning.com?u=itning&r=yunshu_music_local)](https://github.com/itning/hit-count) 19 | [![language](https://img.shields.io/badge/language-Dart-green.svg)](https://github.com/itning/yunshu_music_local) 20 | 21 |
22 | 23 | ## 功能概述 24 | 25 | - 自动扫描指定目录下的音频文件(支持 `.flac`, `.mp3`, `.wav`, `.aac`) 26 | - 提取音频元数据(标题、艺术家等) 27 | - 支持通过 HTTP 查询音乐列表 28 | - 支持在线播放、下载音频文件 29 | - 支持查找对应的 `.lrc` 歌词文件 30 | - 支持提取音频封面图(如 ID3 中包含) 31 | 32 | --- 33 | 34 | ## 安装与运行 35 | 36 | ### 启动服务 37 | 38 | ```bash 39 | ./yunshu_music_local -d /path/to/music/dir -p 8080 40 | ``` 41 | 42 | - `-d` 指定音频文件所在目录(必须) 43 | - `-p` 指定监听端口号,默认 `8080` 44 | 45 | --- 46 | 47 | ## API 接口说明 48 | 49 | ### 获取所有音乐信息 50 | 51 | **GET** `/music` 52 | 53 | #### 响应示例: 54 | 55 | ```json 56 | { 57 | "code": 200, 58 | "msg": "查询成功", 59 | "data": [ 60 | { 61 | "musicId": "1", 62 | "name": "歌曲名称", 63 | "singer": "歌手名字", 64 | "lyricId": "1", 65 | "type": 2, 66 | "musicUri": "http://localhost:8080/music/file/1", 67 | "musicDownloadUri": "http://localhost:8080/music/file/download/1", 68 | "lyricUri": "http://localhost:8080/music/lyric/1", 69 | "coverUri": "http://localhost:8080/music/cover/1" 70 | } 71 | ] 72 | } 73 | ``` 74 | 75 | --- 76 | 77 | ### 获取音频文件(在线播放) 78 | 79 | **GET** `/music/file/{musicId}` 80 | 81 | 返回音频文件流,可直接用于 HTML5 `