Skip to content

Feature/play event annual report - #409

Open
GuiltySpark-343 wants to merge 4 commits into
rRemix:composefrom
GuiltySpark-343:feature/play-event-annual-report
Open

GuiltySpark-343 wants to merge 4 commits into
rRemix:composefrom
GuiltySpark-343:feature/play-event-annual-report

Conversation

@GuiltySpark-343

Copy link
Copy Markdown

PR_DESCRIPTION.md

播放事件记录 + 年度听歌报告(Play Event Recording for Annual Report)

摘要

为 APlayer 增加逐次播放事件记录能力,为“年度听歌报告”提供可靠的本地原始数据,同时保留现有 History/最近播放。事件遵循跨平台协议(eventId/deviceId/schemaVersion/canonicalId + UTC ISO 时间),可导出 JSONL,供 PC/桌面端按 eventId 幂等导入合并。

动机

现有 History 只保存累计 play_countlast_play,无法还原“一次播放”的起止、实际收听时长与来源,因此无法准确生成按年/月/时段/来源分布的报告。本改动新增独立的 play_events 表与会话级采集。

主要改动(按提交)

  1. Fix taglib submodule URL to upstream.gitmodules../taglib.git(在当前 fork 下失效)改为 https://github.com/rRemix/taglib.git
  2. Restore original song sorting with TinyPinyin:把 Compose 版的“自然排序”改回原版逐字符排序(英文忽略大小写、中文按拼音、数字按字符序),并引入 io.github.biezhi:TinyPinyin。修复“按文件名排序”与原版不一致的问题。
  3. Add local play event recording for annual listening report
    • 新增数据层:PlayEvent 实体(schema v2)、PlayEventDaoPlayEventRepository、Room 迁移 8→9、DeviceIdProviderCanonicalIdProvider
    • 采集:PlayEventRecorder 会话状态机(位置增量累计、seek 防虚增、单曲循环分轮、<10% 丢弃、>=90%/自然结束记完整),并接入 MusicService;区分播放来源与结束原因。
    • 新增 song_added 事件类型(首次出现登记),支撑“年度新增歌曲”。
    • 新增 MediaType(local/webdav/smb)、sessionIdloopCount、稳定 ID 等 v2 字段;播放类聚合只统计 eventType='playback'
    • UI:设置新增“播放统计”开关/清除与“年度听歌报告”入口;报告页展示核心指标、TOP、月份/来源分布,支持导出 JSONL。
  4. Add play event design, protocol and sample docs:设计文档(v1+v2)、跨平台协议规范、执行文档、JSONL 样例。

测试

  • :app:assembleNormalDebug 构建成功。
  • 采集规则:<10% 不落库、50% → playScore≈0.5、自然结束单条且 completed=true、暂停恢复不重复、拖动不虚增、来源正确。
  • Room 8→9 迁移保留既有数据;JSONL 逐行可读、可按 eventId 幂等合并。

注意

  • local.propertiesapp/buildAplayer.apkbackups/gradle-wrapper.properties 的本地调整均未纳入本 PR。
  • PC 端具体实现步骤由后续基于 PC 代码生成的文档提供;设计契约见 docs/play-event-design.md

@GuiltySpark-343
GuiltySpark-343 force-pushed the feature/play-event-annual-report branch from 2487e77 to 00030bd Compare September 8, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant