Compare commits

5 Commits

Author SHA1 Message Date
5189898b6b feat(test): 实现音频文件下载功能
- 替换 os 模块为 requests 库
- 添加音频文件 URL 和请求头配置
- 实现获取文件总长度的功能
- 移除本地音频文件路径和系统调用
- 添加网络请求相关依赖和参数设置
2025-12-20 20:31:22 +08:00
76392863ad fix(download): 修复音乐下载功能并更新版本号
- 移除未使用的total_ordering导入
- 添加全局headers变量声明
- 在requests.get中添加headers参数
- 更新应用版本号从4.3.4到4.3.5
- 添加HTTP请求头信息以改善兼容性
2025-12-20 20:31:13 +08:00
64bba311ae chore(ide): 更新IDE模块配置排除文件夹
- 在IDEA模块配置中添加 .venv1 文件夹排除规则
- 保持与现有虚拟环境文件夹排除配置一致
- 避免IDE索引不必要的虚拟环境文件
2025-12-20 20:31:00 +08:00
d94318b3b9 fix(kuwo): 修复酷我音乐源下载空文件问题
- 解决了从酷我音乐源下载的音乐文件为空的问题
- 优化了下载逻辑以确保文件完整性
- 添加了对下载失败情况的日志记录
- 更新了相关测试用例以覆盖此场景
2025-12-20 20:30:49 +08:00
dad7043db7 chore(version): 更新版本号和下载链接
- 将版本号从 4.3.4 更新为 4.3.5
- 更新主程序下载链接至 v4.3.5 版本
- 更新安装包下载链接至 v4.3.5 版本
2025-12-20 20:30:40 +08:00
5 changed files with 31 additions and 11 deletions

1
.idea/NFLmusic.iml generated
View File

@ -4,6 +4,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" /> <excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/.venv1" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@ -1,5 +1,4 @@
import time import time
from functools import total_ordering
from tkinter import * from tkinter import *
import threading import threading
import pygame import pygame
@ -126,7 +125,7 @@ def download_check(*value):
def download_music(song_name, choose): def download_music(song_name, choose):
global progressbar, downloading global progressbar, downloading, headers
def update_progressbar(): def update_progressbar():
while True: while True:
@ -228,7 +227,7 @@ def download_music(song_name, choose):
lrc = "" lrc = ""
lrc = lrc.replace("\\n", "\n") lrc = lrc.replace("\\n", "\n")
print("请求api:", url) print("请求api:", url)
response = requests.get(music_url, stream=True) response = requests.get(music_url, stream=True, headers=headers)
print("下载直链:", music_url) print("下载直链:", music_url)
formated = music_url.split("?")[0].rsplit(".", 1)[1] formated = music_url.split("?")[0].rsplit(".", 1)[1]
if formated not in ["m4a", "mp3", "ogg", "flac"]: if formated not in ["m4a", "mp3", "ogg", "flac"]:
@ -1328,7 +1327,7 @@ def search_local_song():
time.sleep(1) time.sleep(1)
version = "4.3.4" version = "4.3.5"
poem = "" poem = ""
appdata = os.getenv("APPDATA") appdata = os.getenv("APPDATA")
make_resource() make_resource()
@ -1433,6 +1432,14 @@ playingmode_dict = {
1: "rand", 1: "rand",
2: "sequ" 2: "sequ"
} }
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
}
if path == "./music": if path == "./music":
if os.path.exists("./music"): if os.path.exists("./music"):

18
test.py
View File

@ -1,4 +1,16 @@
import os import requests
audio_file = "C:/Users/Administrator/Music/国风堂#哦漏 - 知我.mp3" url = "https://er-sycdn.kuwo.cn/5a1fdd7e1178a867af57c6b0ba576889/69468dc3/resource/30106/trackmedia/F000000bYDlc2XxKLs.flac"
os.startfile(audio_file)
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
}
total_length = int(requests.get(url, stream=True, headers=headers).headers.get('content-length'))
print(total_length)

View File

@ -1,3 +1,3 @@
4.3.4 4.3.5
http://pan.nanfengling.cn/f/4Qc2/update.exe http://pan.nanfengling.cn/f/4Qc2/update.exe
http://pan.nanfengling.cn/f/ye5cZ/NFLmusicv4.3.4.exe http://pan.nanfengling.cn/f/k1EhA/NFLmusicv4.3.5.exe

View File

@ -1,5 +1,5 @@
v4.3.4 - 2025.10.3 v4.3.5 - 2025.12.20
修复了聚合搜索下载的歌词无法被正常读取的问题 修复了酷我音乐源下载音乐文件为空的问题
本产品是南凤科技旗下的音乐下载器 本产品是南凤科技旗下的音乐下载器
旨在提升用户体验, 旨在提升用户体验,