Skip to content

Commit

Permalink
SMTC Imported and Settings Update
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Feb 22, 2024
1 parent 0cc1bb3 commit 20acadd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 12 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ pip install -r requirements_win.txt

___注:区分的原因是 `Windows-Toasts` 库只能在 Windows 下生效!___

如果希望开发 WinRT 相关内容 (如 SMTC), 需要执行...

~~~Bash
pip install winsdk
~~~

此外, 该软件 __不能在含有 CJK 文本 (即中文、日语、韩文) 的路径下正常开发与运行__!

## TODO
Expand All @@ -50,19 +56,21 @@ ___注:区分的原因是 `Windows-Toasts` 库只能在 Windows 下生效!___
- [x] 日志输出 (注: 会产生大量日志信息保存在本地, 提交 issue 请附带该文件)
- [x] 循环播放
- [x] 歌词显示与滚动 (基本完成, 但依旧不兼容逐字歌词, 姑且算完成了)
- [x] 在线获取网易云歌曲 (还有一些 BUG, 慢慢修)
- [x] 歌单 (除了不支持删除和添加在线歌曲以外基本完成)
- [x] 检查更新 (基于 __Github API__)
- [x] 在线获取网易云歌曲 (还有一些 BUG, 慢慢修, 此外 API 比较玄学, 很多逻辑都可能存在问题)
- [x] 歌单 (除了不支持删除列表项和添加在线歌曲以外基本完成)
- [x] 检查更新 (基于 __GitHub API__, 允许在语言文件定义切换为 KKGitHub 镜像源)
- [ ] 进阶逻辑
- [ ] 进阶播放方式选择
- [ ] 进阶播放方式选择 (目前就只支持一个单曲循环)
- [ ] 将主界面迁移至 `pages`
- [ ] 设置 (施工中)
- [ ] 系统托盘 (预计使用 `pystray` 实现)
- [ ] 界面自动取色 (可能使用 __OpenCV__ 实现)
- [ ] 设置 (施工中, 目前还需要研究 JSON 读写, 重写 `i18n/lang.py` 的部分功能才能实现自定义语言)
- [ ] 区间播放 (即 AB 点)
- [ ] 系统托盘 (预计使用 `pystray` 实现, 如果实现了就可以让 `Windows-Toasts` 退役了)
- [ ] 界面自动取色 (可能使用 __OpenCV__ 实现, 或者自己算)
- [ ] 混音器 (目前使用的组件未提供相关接口, 暂时搁置)
- [ ] SMTC 支持 (涉及 WinRT, 仅 Windows 支持)
- [ ] SMTC 支持 (涉及 WinRT, 仅 Windows, 但实现有点麻烦, 调用代码已注释, 代码在 `lib/smtc.py`, 完成后可能会接入热词实现桌面歌词功能)
- [ ] 任务栏进度条与按键操作 (仅 Windows 支持)
- [ ] 多线程支持
- [ ] 多线程支持 (目前的想法只有独立检查更新线程, 其他还需要研究)
- [ ] 拖入文件加载或命令行加载 (命令行应该会简单一点, 另外一个主要是拖入文件找不到接口)

对于其他可能的新功能可以到[本项目 Discussions](https://github.com/WhatDamon/Simplay-Player/discussions) 提交

Expand Down
5 changes: 5 additions & 0 deletions i18n/en_US.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
"immediatelyPlay": "Play the song immediately after loading",
"lyrics": "Lyrics",
"lyricsDefaultVis": "Lyrics display by default",
"webMusic": "Online music",
"inputAPI": "Enter the API URL: ",
"webAPIInfo": "Deployment scenarios from https://github.com/Kevin0z0/Python_NetEaseMusicAPI must be used to ensure compatibility!",
"systemIntegration": "System integration",
"enableSMTC": "Enable SMTC (incomplete)",
"feedback": "Feedback",
"bugReport": "Report a BUG",
"shareIdeas": "Share new feature ideas",
Expand Down
5 changes: 5 additions & 0 deletions i18n/zh_CN.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
"immediatelyPlay": "加载歌曲后立即播放",
"lyrics": "歌词",
"lyricsDefaultVis": "歌词默认显示",
"webMusic": "在线歌曲",
"inputAPI": "输入 API 地址: ",
"webAPIInfo": "必须使用 https://github.com/Kevin0z0/Python_NetEaseMusicAPI 的部署方案以保证兼容性!",
"systemIntegration": "系统集成",
"enableSMTC": "启用 SMTC (未完成)",
"feedback": "反馈",
"bugReport": "报告 BUG",
"shareIdeas": "分享新功能想法",
Expand Down
7 changes: 7 additions & 0 deletions lib/smtc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import winsdk.windows.media.playback as mediaPlayback
import winsdk.windows.media as media

smtc = media.SystemMediaTransportControls
smtc.is_enabled = True

# 有点没头绪怎么处理
33 changes: 32 additions & 1 deletion pages/settingsPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,37 @@
disabled = True
)

onlineAPI_tf = ft.TextField(label = i18n.lang.sets["inputAPI"], value = "https://music.dsb.ink/api/")

onlineSetCard = ft.Card(
content = ft.Container(
content = ft.Column(controls = [
ft.Row(controls = [ft.Icon(ft.icons.MUSIC_NOTE_OUTLINED), ft.Text(value = i18n.lang.sets["webMusic"], size = 18)]),
onlineAPI_tf,
ft.Text(value = i18n.lang.sets["webAPIInfo"], selectable = True)
]
),
padding = 15
),
elevation = 0.5,
disabled = True
)

smtcEnable_switch = ft.Switch(label = i18n.lang.sets["enableSMTC"], value = False)

systemSetCard = ft.Card(
content = ft.Container(
content = ft.Column(controls = [
ft.Row(controls = [ft.Icon(ft.icons.DISPLAY_SETTINGS_OUTLINED), ft.Text(value = i18n.lang.sets["systemIntegration"], size = 18)]),
smtcEnable_switch
]
),
padding = 15
),
elevation = 0.5,
disabled = True
)

feedbackSetCard = ft.Card(
content = ft.Container(
content = ft.Column(controls = [
Expand All @@ -156,4 +187,4 @@
elevation = 0.5
)

settings_pageView = ft.View("/settings", controls = [appBar, constructionNotice, settingsNotice, languageSetCard, appearancesSetCard, playSetCard, lyricsSetCard, feedbackSetCard], scroll = ft.ScrollMode.AUTO)
settings_pageView = ft.View("/settings", controls = [appBar, constructionNotice, settingsNotice, languageSetCard, appearancesSetCard, playSetCard, lyricsSetCard, onlineSetCard, systemSetCard, feedbackSetCard], scroll = ft.ScrollMode.AUTO)
11 changes: 9 additions & 2 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def alwaysOnTop(e):
log_init.logging.info("Page updated")

def windowsToastNotify():
from windows_toasts import Toast, ToastDisplayImage, WindowsToaster
toaster = WindowsToaster('Simplay Player')
sysToast = Toast()
if os.path.exists("./asset/simplay.png"):
Expand Down Expand Up @@ -197,7 +196,7 @@ def audioFromUrlInfo(e):
songID_text = songID_input.value
songID = songID_text
getReturn = work.audioFromUrlInfo(songID)
if getReturn == True:
if getReturn == True:
if firstPlay == True:
page.overlay.append(work.playAudio)
log_init.logging.info("Append playAudio")
Expand Down Expand Up @@ -863,7 +862,15 @@ def viewPop(e):
print(lang.infomation["cygwinWarning"])
log_init.logging.warning("Using Cygwin")
if platform_check.currentOS == "windows":
from windows_toasts import Toast, ToastDisplayImage, WindowsToaster
log_init.logging.info("Lib Windows-Toasts imported")
from sys import getwindowsversion
windowsBuild = getwindowsversion().build
log_init.logging.info("Windows build: " + str(windowsBuild))
if windowsBuild > 10240:
# from lib import smtc
pass
del windowsBuild
else:
print(lang.infomation["nonTestWarning"])
log_init.logging.warning("Non-test OS")
Expand Down

0 comments on commit 20acadd

Please sign in to comment.