Skip to content

Commit

Permalink
修复 tx 歌单搜索名字、描述出现乱码的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Feb 4, 2025
1 parent f7375c7 commit d0350a4
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 76 deletions.
33 changes: 31 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-clipboard/clipboard": "^1.16.1",
"@react-native-community/slider": "^4.5.5",
"he": "^1.2.0",
"iconv-lite": "^0.6.3",
"lrc-file-parser": "^2.4.1",
"message2call": "^0.1.3",
Expand Down Expand Up @@ -76,6 +77,7 @@
"@react-native/metro-config": "^0.74.88",
"@react-native/typescript-config": "^0.74.88",
"@tsconfig/react-native": "^3.0.5",
"@types/he": "^1.2.3",
"@types/react": "^18.3.18",
"@types/react-native": "^0.72.8",
"@types/react-native-background-timer": "^2.0.2",
Expand Down
55 changes: 1 addition & 54 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
落雪祝大家新年快乐!

### 关于之前提到的新项目

新项目我取名叫 Any Listen,希望它能像它的名字一样让我们能到处任意听歌。
经过一年多的开发,因各种原因,实际进度比预期的慢,但还是赶在年前发布了第一个web服务预览版,第一个版本仅支持播放服务器上的歌曲,扩展功能暂时未能开放,但已趋于完成,一两个月内可以搞定。
目前的版本仅是“能用”的状态,因时间关系,部分UI未能重新设计,但后面会继续完善。
该项目目前的目标用户是拥有自己服务器且上面存储有歌曲的人使用。

项目刚发布,文档未能完善,遇到使用问题或有任何建议欢迎提 issue 交流,
项目地址: https://github.com/any-listen/any-listen

---

*为了防止歌曲缓存被第三方软件当做垃圾意外清理,歌曲缓存不再存储到缓存目录。若想清理缓存,需去「设置 → 其他 → 资源缓存管理」清理。*

*更新到该版本后首次播放歌曲时,会将之前的歌曲缓存迁移到新位置,需要等待的时间取决于你已缓存资源的大小。*

*感谢 @3gf8jv4dv 对 LX 系列项目翻译、文档等文案的大幅修订优化。*

### 新增

- 新增蓝牙歌词支持,可以通过「设置 → 播放设置 → 显示蓝牙歌词」启用(#615
- 新增繁体中文语言(#659, @3gf8jv4dv
- 将 LX Music 设置为「音乐应用」类,允许将 LX Music 设置为系统默认音乐播放器
- 支持在程序外使用 LX Music 打开常见音乐文件及 `.js``.json``.lxmc` 等文件

### 优化

- 防止歌曲缓存被第三方软件当做垃圾意外清理
- 优化正常播放结束时的下一首歌曲播放衔接度,在歌曲即将结束播放时将预获取下一首歌曲的播放链接,减少自动切歌时的等待时间
- 优化歌曲换源机制,提升换源正确率
- 首次使用的提示窗口可以通过点击背景或者返回键关闭(#577
- 上移 Toast 位置避免遮挡播放模式图标(#603, @sibojia
- 优化简体中文文案编排,大幅修订英语文案编排(#658, #660 等, @3gf8jv4dv
- 优化应用图标质量,在高版本系统上使用矢量图标

### 修复

- 修复导出文件到范围存储类型的目录时,扩展名丢失的问题
- 修复切换列表播放歌曲时可能会出现播放的歌曲不对应的问题
- 修复内置列表名称硬编码和语言切换显示的问题(#662
- 修复某些情况下进播放详情页时,详情页不显示或应用界面无响应的问题
- 修复低版本 Android 在某些情况下对 Emoji 字符编码的处理问题

### 变更

- 歌曲缓存不再存储到缓存目录
- 不再长期缓存换源歌曲信息

### 其他

- 更新 Readme 文档,优化文案编排(#651, Thanks @3gf8jv4dv
- 更新 Issue 模板(#652, @3gf8jv4dv
- 更新项目文档(@3gf8jv4dv
- 更新 React Native 到 v0.73.11
- 修复 tx 歌单搜索名字、描述出现乱码的问题
6 changes: 3 additions & 3 deletions src/screens/SonglistDetail/MusicList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default forwardRef<MusicListType, MusicListProps>(({ componentId }, ref)
headerRef.current?.setInfo({
name: (info.name || listDetailInfo.info.name) ?? '',
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
desc: info.desc || listDetailInfo.info.desc || '',
desc: listDetailInfo.info.desc || info.desc || '',
playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '',
imgUrl: info.img ?? listDetailInfo.info.img,
})
Expand All @@ -43,7 +43,7 @@ export default forwardRef<MusicListType, MusicListProps>(({ componentId }, ref)
headerRef.current?.setInfo({
name: (info.name || listDetailInfo.info.name) ?? '',
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
desc: info.desc || listDetailInfo.info.desc || '',
desc: listDetailInfo.info.desc || info.desc || '',
playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '',
imgUrl: info.img ?? listDetailInfo.info.img,
})
Expand All @@ -54,7 +54,7 @@ export default forwardRef<MusicListType, MusicListProps>(({ componentId }, ref)
headerRef.current?.setInfo({
name: (info.name || listDetailInfo.info.name) ?? '',
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
desc: info.desc || listDetailInfo.info.desc || '',
desc: listDetailInfo.info.desc || info.desc || '',
playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '',
imgUrl: info.img ?? listDetailInfo.info.img,
})
Expand Down
12 changes: 0 additions & 12 deletions src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,6 @@ export const formatPlayTime2 = (time: number) => {
}


const encodeNames = {
'&nbsp;': ' ',
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&apos;': "'",
'&#039;': "'",
} as const
export const decodeName = (str: string | null = '') => {
return str?.replace(/(?:&amp;|&lt;|&gt;|&quot;|&apos;|&#039;|&nbsp;)/gm, (s: string) => encodeNames[s as keyof typeof encodeNames]) ?? ''
}

export const isUrl = (path: string) => /https?:\/\//.test(path)

Expand Down
6 changes: 6 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { dateFormat } from './common'
import he from 'he'

export { tranditionalize as langS2T } from '@/utils/simplify-chinese-main'

Expand Down Expand Up @@ -192,3 +193,8 @@ export const formatPlayCount = (num: number): string => {
if (num > 10000) return `${Math.trunc(num / 1000) / 10}万`
return String(num)
}

export const decodeName = (str: string | null = '') => {
if (!str) return ''
return he.decode(str)
}
8 changes: 4 additions & 4 deletions src/utils/musicSdk/tx/songList.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
img: item.cover_url_medium,
// grade: item.favorcnt / 10,
total: item.song_ids?.length,
desc: item.desc,
desc: decodeName(item.desc).replace(/<br>/g, '\n'),
source: 'tx',
})),
total: data.total,
Expand Down Expand Up @@ -307,13 +307,13 @@ export default {
return {
play_count: formatPlayCount(item.listennum),
id: String(item.dissid),
author: item.creator.name,
name: item.dissname,
author: decodeName(item.creator.name),
name: decodeName(item.dissname),
time: dateFormat(item.createtime, 'Y-M-D'),
img: item.imgurl,
// grade: item.favorcnt / 10,
total: item.song_count,
desc: item.introduction,
desc: decodeName(decodeName(item.introduction)).replace(/<br>/g, '\n'),
source: 'tx',
}
}),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/musicSdk/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { stringMd5 } from 'react-native-quick-md5'
import { decodeName } from '../common'
import { decodeName } from '../index'

/**
* 获取音乐音质
Expand Down

0 comments on commit d0350a4

Please sign in to comment.