15 个版本 (4 个稳定版)
1.1.1 | 2021年1月13日 |
---|---|
1.1.0 | 2020年12月13日 |
1.0.1 | 2020年8月14日 |
1.0.0 | 2019年10月31日 |
0.2.0 | 2017年3月4日 |
在 多媒体 中排名 68
每月下载量 87
用于 connectr
61KB
987 行
rustfm-scrobble
rustfm-scrobble 是一个用于 Rust 的 Last.fm Scrobble API 2.0 库。它通过简单的 Rust API 轻松访问 "scrobble" 和 "now playing" 通知端点。它可以用于记录音乐播放器中的歌曲播放,构建类似 VinylScrobbler 的模拟 scrobbling 工具,或者与物联网设备协同工作。它最初是为了实现一个 Spotify scrobbling 服务 而构建的,使用 Spotify Connect 协议,因为当时 Alexa Spotify 客户端 不支持将播放记录到 Last.fm。
特性
- 将歌曲 scrobble 到 Last.fm ('scrobble' API 端点)
- 将正在播放的歌曲发布到 Last.fm ('now playing' API 端点)
- 支持在
Scrobbler::scrobble_batch
和ScrobbleBatch
中批量 scrobble - 多种身份验证流程以获取发布到 Last.fm 用户资料页面的权限
- 存储预身份验证的会话密钥并在初始身份验证后丢弃秘密数据
- 简单的错误处理;每个 API 操作在失败时返回一个简单的
Result
,包含一个Error
类型 - 单元测试
安装
将 rustfm-scrobble 添加到您的 Cargo.toml 文件中。
[dependencies]
rustfm-scrobble="1.1"
用法
- API 文档
- 代码示例
- 示例 now-playing & scrobbling 客户端
- 示例批量 scrobbling 客户端
cargobuild --examples
./target/debug/examples/example
- 构建:
cargo build
- 运行单元测试:
cargo test
extern crate rustfm_scrobble;
use rustfm_scrobble::{Scrobble, Scrobbler};
let username = "last-fm-username";
let password = "last-fm-password";
let api_key = "client-api-key";
let api_secret = "client-api-secret";
let mut scrobbler = Scrobbler::new(api_key, api_secret);
scrobbler.authenticate_with_password(username, password);
let song = Scrobble::new("Example Artist", "Example Song", "Example Album");
scrobbler.scrobble(song);
使用中
rustfm-scrobble 被用于多个项目,包括 polaris、connectr、rescrobbled 和 rb-scrobbler。
状态
API 是稳定的,所有 1.0 版本都将保证向后兼容性。
许可证
麻省理工学院许可协议,请参阅 ./LICENSE
。
依赖项
~4MB
~111K SLoC