Skip to content

Commit

Permalink
Ver.2.6.103
Browse files Browse the repository at this point in the history
  • Loading branch information
zlk-sys committed Jul 1, 2024
1 parent 791f60a commit 60646ce
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 173 deletions.
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

10 changes: 6 additions & 4 deletions Interface/playlist.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from PyQt5.QtWidgets import QWidget, QAbstractItemView, QStyleOptionViewItem, QHBoxLayout, QVBoxLayout, QLabel, QHeaderView
from qfluentwidgets import ComboBox, LineEdit, PushButton, SubtitleLabel, TableWidget, ProgressBar, PrimaryPushButton, MessageBoxBase, ProgressRing
from PyQt5 import QtCore
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QAbstractItemView, QHBoxLayout, QVBoxLayout, QHeaderView
from qfluentwidgets import ComboBox, LineEdit, PushButton, SubtitleLabel, TableWidget, ProgressBar, PrimaryPushButton, \
MessageBoxBase
from qfluentwidgets import FluentIcon as FIF

from helper.downloadHelper import downloading, download
from helper.playlistHelper import getlist, FindLists, searchstart, music, search, rundownload
from helper.flyoutmsg import setOK
from helper.playlistHelper import getlist, FindLists, searchstart, music, search, rundownload


class playlist(QWidget):
def __init__(self):
Expand Down
13 changes: 3 additions & 10 deletions Interface/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@
import os
import sys
from helper.inital import setSettingsQss
from PyQt5.QtCore import Qt, QPoint, QSize, QUrl, QRect, QStandardPaths
from PyQt5.QtGui import QIcon, QFont, QColor, QPainter
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QVBoxLayout, QSizePolicy
from PyQt5.QtCore import Qt, QStandardPaths
from PyQt5.QtWidgets import QWidget
from helper.config import cfg
from qfluentwidgets import (SettingCardGroup, SwitchSettingCard, CustomColorSettingCard,
OptionsSettingCard, FolderListSettingCard, PushSettingCard, setTheme, isDarkTheme,
HyperlinkCard, PrimaryPushSettingCard, ScrollArea, PushButton, PrimaryPushButton,
ComboBoxSettingCard, ExpandLayout, Theme, InfoBar, FlyoutView, Flyout)
from qfluentwidgets import FluentIcon as FIF
from qfluentwidgets.components.widgets.acrylic_label import AcrylicBrush
from qfluentwidgets import SettingCardGroup, FolderListSettingCard, ScrollArea, ExpandLayout
from helper.pluginHelper import run_plugins_plugin
import window.main

class plugins(ScrollArea):

Expand Down
59 changes: 24 additions & 35 deletions Interface/searchmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@
from helper.downloadHelper import downloading, download
from helper.searchmusicHelper import getlist, sethotlineEdit, search, searchstart, rundownload

# class Worker(QObject):
# finished = pyqtSignal()
#
# @pyqtSlot()
# def do_work(self, text):
# if helper.config.Config.twitcard.value == True and is_english_and_characters(text):
# try:
# self.key = AZMusicAPI.searchkey(text)mn
# except:
# self.key = []
# return 0
# if "Error" in self.key:
# self.key = []
# return 0
# else:
# self.key = []
#
# self.finished.emit()

class CustomTableItemDelegate(TableItemDelegate):
""" Custom table item delegate """
Expand All @@ -45,6 +27,7 @@ def initStyleOption(self, option: QStyleOptionViewItem, index: QModelIndex):
option.palette.setColor(QPalette.Text, Qt.red)
option.palette.setColor(QPalette.HighlightedText, Qt.red)


class searchmusic(QWidget, QObject):

def __init__(self):
Expand All @@ -58,39 +41,45 @@ def __init__(self):
self.lineEdit = SearchLineEdit(self)
self.lineEdit.setPlaceholderText('搜索音乐')
self.lineEdit.setFixedSize(200, 33)

# self.lineEdit.textEdited.connect(self.keys)
self.lineEdit.returnPressed.connect(lambda: searchstart(lineEdit=self.lineEdit, parent=self, spinBox=self.spinBox, lworker=self.lworker))
self.lineEdit.searchButton.released.connect(lambda: searchstart(lineEdit=self.lineEdit, parent=self, spinBox=self.spinBox, lworker=self.lworker))

self.lineEdit.returnPressed.connect(
lambda: searchstart(lineEdit=self.lineEdit, parent=self, spinBox=self.spinBox, lworker=self.lworker))
self.lineEdit.searchButton.released.connect(
lambda: searchstart(lineEdit=self.lineEdit, parent=self, spinBox=self.spinBox, lworker=self.lworker))

self.numLabel = QLabel('显示数量', self)
self.spinBox = SpinBox(self)
self.spinBox.setValue(15)

# self.worker_thread = QThread()
# self.worker = Worker()
# self.worker.moveToThread(self.worker_thread)

self.lworker = getlist()
self.dworker = downloading(howto="search")
self.dworker = downloading(howto="search")
self.upworker = get_update()
self.lworker.finished.connect(lambda: search(lworker=self.lworker, parent=self,
tableView=self.tableView, spinBox=self.spinBox))
self.dworker.finished.connect(lambda Progress: download(progress = Progress, table = self.tableView, progressbar=self.ProgressBar,
songdata=self.lworker.songInfos, dworker=self.dworker, button=self.primaryButton1, parent=self.window(), howto = "search"))
self.upworker.finished.connect(lambda updata: showup(parent = self.window(), updata = updata, upworker = self.upworker))
tableView=self.tableView, spinBox=self.spinBox))
self.dworker.finished.connect(
lambda Progress: download(progress=Progress, table=self.tableView, progressbar=self.ProgressBar,
songdata=self.lworker.songInfos, dworker=self.dworker, button=self.primaryButton1,
parent=self.window(), howto="search"))
self.upworker.finished.connect(
lambda updata: showup(parent=self.window(), updata=updata, upworker=self.upworker))
# self.worker.finished.connect(self.on_worker_finished)

self.primaryButton1 = PrimaryPushButton('下载', self)
self.primaryButton1.released.connect(lambda: rundownload(parent=self, primaryButton1=self.primaryButton1,
tableView=self.tableView, dworker=self.dworker, lworker=self.lworker, ProgressBar=self.ProgressBar))
tableView=self.tableView, dworker=self.dworker,
lworker=self.lworker, ProgressBar=self.ProgressBar))
self.primaryButton1.setEnabled(False)

self.ProgressBar = ProgressBar(self)
self.ProgressBar.setHidden(True)
self.ProgressBar.setMaximum(100)
self.ProgressBar.setFixedWidth(200)

self.layout1.addStretch(100)
self.layout1.addWidget(self.SearchLabel)
self.layout1.addSpacing(10)
Expand Down Expand Up @@ -131,13 +120,13 @@ def __init__(self):
self.hBoxLayout.addWidget(self.tableView)
self.hBoxLayout.addSpacing(60)
self.hBoxLayout.addLayout(self.layout1)

self.resize(635, 700)

sethotlineEdit(lineEdit=self.lineEdit)
if helper.config.Config.update_card.value == False:
self.upworker.start()

def openbutton(self):
self.primaryButton1.setEnabled(True)

Expand All @@ -151,4 +140,4 @@ def openbutton(self):
# self.completer = QCompleter(self.worker.key, self.lineEdit)
# self.completer.setCaseSensitivity(Qt.CaseInsensitive)
# self.lineEdit.setCompleter(self.completer)
# self.worker_thread.quit()
# self.worker_thread.quit()
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ _✨ 优雅地下载音乐✨_
</div>

> 若您需要二次分发本程序,需经过开发者书面同意,并需在您的项目中注明该项目地址
>
> 祝大家金榜题名,旗开得胜
### 系统要求

Expand All @@ -46,7 +44,7 @@ _✨ 优雅地下载音乐✨_

### 文档

<a href="https://md.azprod.cn/docs/start.html">点我跳转</a>
<a href="https://md.azprod.cn/docs">点我跳转</a>

### 使用条款

Expand Down
5 changes: 2 additions & 3 deletions helper/SettingHelper.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json, os
from helper.getvalue import apilists
from qfluentwidgets import MessageBoxBase, SubtitleLabel, CheckBox, LineEdit, HyperlinkButton, TransparentPushButton, ToolTipFilter, ToolTipPosition
from PyQt5.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QLabel, QHBoxLayout
from qfluentwidgets import FluentIcon as FIF
from helper.getvalue import autoncmaapi, autoqqmaapi

Expand All @@ -21,7 +20,7 @@ def get_all_api(folders_arg):
data = json.loads(u.read())
u.close()
if data["type"] == "api":
apilists.append(filename.replace(".py", ""))
apilists.append(data["name"])
return apilists

class DeleteAllData(MessageBoxBase):
Expand Down
11 changes: 8 additions & 3 deletions helper/downloadHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from helper.getvalue import download_log, playlist_download_log
from helper.flyoutmsg import dlsuc, dlerr, dlwar
from win11toast import toast
from helper.pluginHelper import plugins_items

from helper.loggerHelper import logger
from helper.pluginHelper import plugins_api_items

thread = None

Expand Down Expand Up @@ -41,10 +43,11 @@ def run(self):
url = AZMusicAPI.geturl(id=id, api=api)
elif self.howto == "search":
try:
api_plugin = plugins_items[pfg.apicard.value]
api_plugin = plugins_api_items[pfg.apicard.value]
url = api_plugin.geturl(id=id)
except:
except Exception as e:
url = "PluginAPIImportError"
error_msg = e
else:
url = AZMusicAPI.geturl(id=id, api=api)
if url == "Error 3":
Expand All @@ -58,6 +61,8 @@ def run(self):
self.finished.emit("Error")
elif url == "PluginAPIImportError":
self.show_error = "PluginAPIImportError"
if cfg.debug_card.value:
logger.error(f"插件错误:{error_msg}")
self.finished.emit("Error")

if not "Error" in url:
Expand Down
18 changes: 10 additions & 8 deletions helper/flyoutmsg.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from PyQt5.QtCore import Qt
from qfluentwidgets import InfoBar, InfoBarPosition, PushButton, InfoBarIcon
from helper.getvalue import outputlist, verdetail, VERSION, RELEASE_URL, AZ_URL
from qfluentwidgets import PushButton, PrimaryPushButton, FlyoutView, Flyout
from sys import exit

from PyQt5.QtCore import Qt, QUrl
from qfluentwidgets import FluentIcon as FIF
from PyQt5.QtGui import QDesktopServices
from sys import exit
from qfluentwidgets import FluentIcon as FIF
from qfluentwidgets import InfoBar, InfoBarPosition, InfoBarIcon
from qfluentwidgets import PushButton, PrimaryPushButton, FlyoutView, Flyout

from helper.getvalue import outputlist, verdetail, VERSION, RELEASE_URL, AZ_URL


def getoutputvalue(outid):
try:
Expand Down Expand Up @@ -103,7 +105,7 @@ def restart(parent):
content='设置需要重启程序后生效',
orient=Qt.Vertical,
position=InfoBarPosition.TOP_RIGHT,
duration=1000,
duration=3000,
parent=parent
)
s = PushButton("立即关闭应用程序")
Expand All @@ -114,7 +116,7 @@ def restart(parent):
def setOK(parent, howto="settings"):
if howto == "settings":
content = '设置已保存'
time = 1000
time = 1500
elif howto == "playlists":
content = "导入任务已提交!稍等片刻,歌单就会出现在列表中。"
time = 2500
Expand Down
80 changes: 41 additions & 39 deletions helper/getvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,69 +25,71 @@
apilists = ['NCMA', 'QQMA']

# 古诗
poem = ["天阶夜色凉如水,卧看牵牛织女星。",
"唯有门前镜湖水,春风不改旧时波。",
"三更灯火五更鸡,正是男儿读书时。",
"但屈指西风几时来,又不道流年暗中偷换。",
"俱往矣,数风流人物,还看今朝。",
"水是眼波横,山是眉峰聚。",
"明年此日青云去,却笑人间举子忙。",
"衰兰送客咸阳道,天若有情天亦老。",
"昔去雪如花,今来花似雪。",
"青青子衿,悠悠我心。",
"执子之手,与子偕老。",
"老来情味减,对别酒、怯流年。",
"什么是时光?我们穿上的衣服,却再也脱不下来。",
"但行好事,莫问前程。",
"吾道本无我,未曾嫌世人。如今到尘世,弥觉此心真",
"去年今日此门中,人面桃花相映红。",
"似花还似非花,也无人惜从教坠。",
"墙外行人,墙里佳人笑。",
"海内存知己,天涯若比邻。",
"七八个星天外,两三点雨山前。"]
poem = ["天阶夜色凉如水,卧看牵牛织女星。",
"唯有门前镜湖水,春风不改旧时波。",
"三更灯火五更鸡,正是男儿读书时。",
"但屈指西风几时来,又不道流年暗中偷换。",
"俱往矣,数风流人物,还看今朝。",
"水是眼波横,山是眉峰聚。",
"明年此日青云去,却笑人间举子忙。",
"衰兰送客咸阳道,天若有情天亦老。",
"昔去雪如花,今来花似雪。",
"青青子衿,悠悠我心。",
"执子之手,与子偕老。",
"老来情味减,对别酒、怯流年。",
"什么是时光?我们穿上的衣服,却再也脱不下来。",
"但行好事,莫问前程。",
"吾道本无我,未曾嫌世人。如今到尘世,弥觉此心真",
"去年今日此门中,人面桃花相映红。",
"似花还似非花,也无人惜从教坠。",
"墙外行人,墙里佳人笑。",
"海内存知己,天涯若比邻。",
"七八个星天外,两三点雨山前。"]


def outapoem():
outpoem = poem[randint(0, len(poem) - 1)]
return outpoem


def GetDefaultThemeColor():
dwmapi = ctypes.windll.dwmapi
color = ctypes.c_ulong()
opaque = ctypes.c_bool()

# Call DwmGetColorizationColor
result = dwmapi.DwmGetColorizationColor(ctypes.byref(color), ctypes.byref(opaque))

if result == 0: # S_OK
# Extract the color components (ARGB format)
alpha = (color.value >> 24) & 0xFF
red = (color.value >> 16) & 0xFF
green = (color.value >> 8) & 0xFF
blue = color.value & 0xFF

return(f"#{red:02X}{green:02X}{blue:02X}")
else:
return("#0078D4")

return (f"#{red:02X}{green:02X}{blue:02X}")
else:
return ("#0078D4")


# 错误内容列表
outputlist = ['未搜索到相关的歌曲,换个关键词试试吧',
'你还没有输入噢',
'您选中的行无数据',
'音乐下载路径无法读取\创建失败',
"未配置NeteaseCloudMusicApi地址",
"未配置QQMusicApi地址",
'您可能是遇到了以下其一问题:网络错误 / 服务器宕机 / IP被封禁',
'这首歌曲无版权,暂不支持下载',
'获取链接失败,建议检查API服务器是否配置了账号Cookie',
'插件未成功导入,请检查插件']

verdetail = ("1.优化项目结构,UI与逻辑分离\n2.支持Windows系统通知\n3.修复了部分歌单的已知Bug\n4.重构插件页,无需手动导入插件\n5.添加了插件的更多功能\n7.重构我的音乐库页,提升用户体验\n8"
".重构歌单页,提升用户体验")
'你还没有输入噢',
'您选中的行无数据',
'音乐下载路径无法读取\创建失败',
"未配置NeteaseCloudMusicApi地址",
"未配置QQMusicApi地址",
'您可能是遇到了以下其一问题:网络错误 / 服务器宕机 / IP被封禁',
'这首歌曲无版权,暂不支持下载',
'获取链接失败,建议检查API服务器是否配置了账号Cookie',
'插件未成功导入,请检查插件']

verdetail = "1.修复导航栏插件禁用Bug\n2.优化更新检查\n3.优化部分代码\n热烈庆祝中国共产党建党103周年!"

YEAR = int(date.today().year)
AUTHOR = "AZ Studio"
VERSION = "2.6.0"
VERSION = "2.6.103"
UPDATE_ORDER = 13
HELP_URL = "https://md.azprod.cn/docs/"
FEEDBACK_URL = "https://github.com/AZ-Studio-2023/AZMusicDownloader/issues"
RELEASE_URL = "https://github.com/AZ-Studio-2023/AZMusicDownloader/releases/tag/v2.6.0"
Expand Down
Loading

0 comments on commit 60646ce

Please sign in to comment.