Skip to content

release: v0.8.19 Radio 睡眠定时器功能#3

Merged
ChanMo merged 1 commit into
mainfrom
release/v0.8.19
Mar 18, 2026
Merged

release: v0.8.19 Radio 睡眠定时器功能#3
ChanMo merged 1 commit into
mainfrom
release/v0.8.19

Conversation

@ChanMo
Copy link
Copy Markdown
Owner

@ChanMo ChanMo commented Mar 18, 2026

Summary

  • 新增 /radio 音频播放器页面(队列、循环模式、收藏)
  • 新增睡眠定时器功能:点击月亮按钮循环切换 关→30分钟→1小时→2小时,激活时显示 indigo 高亮倒计时,归零自动暂停
  • 新增 /api/radio/items 接口,支持音频文件扫描
  • 版本号升至 v0.8.19

Test plan

  • 打开 /radio 页面,确认音频列表正常加载
  • 点击定时按钮,确认循环切换并显示倒计时
  • 等待倒计时归零,确认音频自动暂停并按钮恢复月亮图标
  • 再次点击切换至关闭,确认倒计时停止

🤖 Generated with Claude Code

- 新增 /radio 页面与音频播放器
- 新增睡眠定时器:30分钟/1小时/2小时循环切换,倒计时显示,归零自动暂停
- 新增 /api/radio/items 接口
- 支持音频文件扫描(AUDIO_EXTENSIONS)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求通过引入一个功能齐全的音频播放器页面,显著扩展了应用程序的媒体处理能力。它不仅提供了基本的音频播放控制,还包含了队列管理、多种循环模式和收藏功能,并特别加入了用户期待的睡眠定时器,极大地提升了用户体验。这些改变使得应用能够更好地支持本地音频内容的管理和播放。

Highlights

  • 新增音频播放器页面: 引入了一个全新的 /radio 音频播放器页面,支持播放队列、循环模式和收藏功能。
  • 睡眠定时器功能: 实现了睡眠定时器功能,用户可以设置在 30 分钟、1 小时或 2 小时后自动暂停播放,并伴有高亮倒计时显示。
  • 音频文件扫描 API: 新增了 /api/radio/items 接口,用于扫描和获取媒体目录中的音频文件列表。
  • 版本更新: 项目版本号已更新至 v0.8.19。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ChanMo ChanMo merged commit b3554c1 into main Mar 18, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次更新引入了音频播放器(/radio)和睡眠定时器功能,整体实现良好。我主要针对代码中的一些可维护性和健壮性问题提出了建议,例如:处理了重复定义的常量,建议在捕获异常时增加日志记录以方便调试,以及在前端代码中完善了错误处理逻辑。此外,我还建议为音频文件增加时长信息的提取和显示,以提升用户体验。

Comment thread tiklocal/app.py
'media_url': f'/media/{quote(name, safe="/")}',
'thumb_url': f'/thumb?uri={quote(name, safe="")}',
'title': p.stem,
'duration': None,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

duration 字段当前硬编码为 None。对于音频播放器,显示曲目时长是基本功能。建议使用 ffprobe 等工具提取音频文件的真实时长。为了避免性能问题,可以将时长信息与其它元数据一起缓存起来,而不是在每次API请求时都实时获取。

Comment on lines +57 to +58
except Exception:
return []
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

通用的 except Exception: 会静默地捕获所有异常,这使得调试变得困难。建议至少记录下异常信息,以便能够发现文件扫描过程中可能出现的问题(例如权限错误)。

Suggested change
except Exception:
return []
except Exception as e:
# import logging
# logging.error(f"扫描音频文件失败: {e}")
return []

from pathlib import Path
from tiklocal.paths import get_thumbnails_dir, get_thumbs_map_path

AUDIO_EXTENSIONS = {'.mp3', '.flac', '.aac', '.m4a', '.ogg', '.opus', '.wav'}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

AUDIO_EXTENSIONS 常量在 tiklocal/services/__init__.py 中已经定义。在这里重复定义会导致维护上的困难。建议删除此行,并在文件顶部添加 from tiklocal.services import AUDIO_EXTENSIONS 以复用该常量。

Comment on lines +50 to +51
except Exception:
pass
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

except Exception: pass 会静默地忽略 ffmpeg 进程中的任何错误,这使得诊断问题(如 ffmpeg 未安装或音频文件损坏)变得困难。建议记录下异常信息。另外,参数 video_path 现在也用于音频文件,可以考虑重命名为 media_path 以提高清晰度。

Suggested change
except Exception:
pass
except Exception as e:
# import logging
# logging.warning(f"为 {video_path} 提取封面失败: {e}")
pass

updateFavUI(item);
const qItem = document.querySelectorAll('.queue-item')[currentIndex];
if (qItem) qItem.querySelector('.fav-dot')?.classList.toggle('hidden', !item.is_favorite);
} catch {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

空的 catch {} 块会吞掉收藏/取消收藏时发生的所有错误(如网络问题或服务器错误),导致操作失败时没有任何提示,给用户带来困惑。建议至少在控制台打印错误日志,以便于调试。

  } catch (e) {
    console.error('Failed to toggle favorite:', e);
  }

return;
}
}
} catch {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

空的 catch {} 块会忽略 localStorage 中数据损坏或无效导致的解析错误。这会导致播放器无法恢复上次的播放状态,并且没有任何错误提示。建议记录错误并清除损坏的数据,以避免后续问题。

    } catch (e) {
      console.error('Failed to restore radio position from localStorage:', e);
      // 清除损坏的数据以避免重复出错
      localStorage.removeItem(POSITION_KEY);
    }

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