├── .github └── FUNDING.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Interface ├── localmusics.py ├── playlist.py ├── plugin.py ├── searchmusic.py └── settings.py ├── LICENSE ├── MusicDownloader.py ├── README.md ├── helper ├── LoginHelper.py ├── SettingHelper.py ├── config.py ├── downloadHelper.py ├── flyoutmsg.py ├── getvalue.py ├── inital.py ├── localmusicsHelper.py ├── loggerHelper.py ├── playlistHelper.py ├── pluginHelper.py └── searchmusicHelper.py ├── icon.ico ├── requirements.txt ├── resource ├── Splash.png ├── logo.png └── qss │ ├── dark │ ├── demo.qss │ └── setting_interface.qss │ └── light │ ├── demo.qss │ └── setting_interface.qss └── window └── main.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: https://afdian.com/a/chen_mo 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.json 3 | test.py 4 | plugins/* 5 | .vscode/* 6 | .idea/* 7 | /shelf/ 8 | /workspace.xml -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # "AZ音乐下载器"软件使用条款 2 | 3 | 欢迎使用AZ音乐下载器(以下简称"本软件")。在使用本软件之前,请仔细阅读并理解以下条款。只有同意以下条款,您才能继续使用本软件。如果您不同意以下条款,请立即停止使用本软件。通过使用本软件,即表示您同意遵守下述条款。 4 | 5 | ## 使用限制 6 | 7 | 用户不得将本软件用于任何商业目的,包括但不限于销售、分发或以任何形式获取经济利益。 8 | 9 | 用户不得以任何方式更改、复制、传播、展示、执行、再许可、发布、许可或创作与本软件相关的衍生作品,除非事先获得开发者的书面许可。 10 | 11 | ## 二次分发 12 | 13 | 在获得开发者的同意后,用户可以进行二次分发本软件。 14 | 15 | 在进行二次分发时,用户必须明确标注原项目地址,并确保被分发的软件版本与原软件版本保持一致。 16 | 17 | ## 音乐下载使用限制 18 | 19 | 用户下载的音乐仅限个人学习用途。用户不得将下载的音乐用于任何商业目的,包括但不限于销售、分发或以任何形式获取经济利益。 20 | 21 | 用户不得侵犯他人的版权或其他知识产权,使用未经授权的音乐文件属于侵权行为,用户应自行承担由此产生的法律责任。 22 | 23 | ## 免责声明 24 | 25 | 用户使用本软件所造成的一切后果,包括但不限于侵权行为与开发者无关,本工作室不承担任何法律责任。 26 | 27 | 用户使用本软件时应自行承担风险,并采取适当的预防措施,确保下载内容的合法性和安全性。 28 | 29 | ## 条款修改 30 | 31 | 开发者有权随时修改本条款。修改后的条款将在本软件上发布或通过其他适当方式通知用户。 32 | 33 | 如果用户在条款修改后继续使用本软件,则表示用户同意受修改后的条款约束。如果用户不同意修改后的条款,应停止使用本软件。 34 | 35 | ## 免责声明 36 | 37 | 本项目部分功能使用了网易云音乐的第三方 API 服务,仅供个人学习研究使用,禁止用于商业及非法用途。同时,本项目开发者承诺:严格遵守相关法律法规和网易云音乐 API 使用协议,不会利用本项目进行任何违法活动。如因使用本项目而引起的任何纠纷或责任,均由使用者自行承担。本项目开发者不承担任何因使用本项目而导致的任何直接或间接责任,并保留追究使用者违法行为的权利。请使用者在使用本项目时遵守相关法律法规,请勿将本项目用于任何商业及非法用途。如有违反,一切后果由使用者自负。 同时,使用者应该自行承担因使用本项目而带来的风险和责任。本项目开发者不对本项目所提供的服务和内容做出任何保证,感谢您的理解。 38 | 39 | AZ Studio 40 | 41 | 日期:2024年01月10日 42 | -------------------------------------------------------------------------------- /Interface/localmusics.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from PyQt5.QtWidgets import QWidget, QHBoxLayout, QHeaderView, QAbstractItemView 3 | from qfluentwidgets import TableWidget 4 | from helper.config import cfg 5 | from helper.localmusicsHelper import ref, openthemusic 6 | 7 | 8 | class localmusics(QWidget): 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.setObjectName("localmusics") 13 | self.hBoxLayout = QHBoxLayout(self) 14 | self.local_view = TableWidget(self) 15 | self.local_view.setColumnCount(4) 16 | self.local_view.verticalHeader().hide() 17 | self.local_view.setHorizontalHeaderLabels(['路径', '歌曲名', '艺术家', '专辑']) 18 | self.local_view.resizeColumnsToContents() 19 | self.local_view.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) 20 | self.local_view.setEditTriggers(QAbstractItemView.NoEditTriggers) 21 | self.local_view.itemSelectionChanged.connect(lambda: ref(local_view=self.local_view, musicpath=cfg.get(cfg.downloadFolder))) 22 | 23 | ref(local_view=self.local_view, musicpath=cfg.get(cfg.downloadFolder)) 24 | 25 | self.hBoxLayout.setContentsMargins(30, 30, 30, 30) 26 | self.local_view.cellDoubleClicked.connect(lambda: openthemusic(filepath=cfg.get(cfg.downloadFolder))) 27 | self.resize(635, 700) 28 | self.hBoxLayout.addWidget(self.local_view) -------------------------------------------------------------------------------- /Interface/playlist.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtCore import Qt 2 | from PyQt5.QtWidgets import QWidget, QAbstractItemView, QHBoxLayout, QVBoxLayout, QHeaderView 3 | from qfluentwidgets import ComboBox, LineEdit, PushButton, SubtitleLabel, TableWidget, ProgressBar, PrimaryPushButton, \ 4 | MessageBoxBase 5 | from qfluentwidgets import FluentIcon as FIF 6 | 7 | from helper.downloadHelper import downloading, download 8 | from helper.flyoutmsg import setOK 9 | from helper.playlistHelper import getlist, FindLists, searchstart, music, search, rundownload 10 | 11 | 12 | class playlist(QWidget): 13 | def __init__(self): 14 | super().__init__() 15 | self.setObjectName('playlist') 16 | self.resize(635, 700) 17 | self.vBoxLayout = QVBoxLayout(self) 18 | self.hBoxLayout = QHBoxLayout(self) 19 | 20 | self.SubtitleLabel = SubtitleLabel("歌单", self) 21 | self.SubtitleLabel.setObjectName("SubtitleLabel") 22 | 23 | self.ChooseBox = PrimaryPushButton(FIF.ALBUM, "选择歌单", self) 24 | self.ChooseBox.clicked.connect(self.ChangePlaylist) 25 | self.StartBox = PushButton("从第三方平台导入", self) 26 | self.StartBox.clicked.connect(self.StartPutIn) 27 | self.StartDownload = PrimaryPushButton("下载", self) 28 | self.StartDownload.setDisabled(True) 29 | self.StartDownload.setObjectName("PushButton_2") 30 | self.StartDownload.clicked.connect(lambda: rundownload(PushButton_2=self.StartDownload, pro_bar=self.pro_bar, 31 | TableWidget_2=self.TableWidget_2, parent=self, dworker=self.dworker)) 32 | 33 | self.pro_bar = ProgressBar(self) 34 | self.pro_bar.setHidden(True) 35 | self.pro_bar.setMaximum(100) 36 | 37 | self.hBoxLayout.addStretch(10) 38 | self.hBoxLayout.addWidget(self.SubtitleLabel, Qt.AlignLeft) 39 | self.hBoxLayout.addStretch(100) 40 | self.hBoxLayout.addWidget(self.pro_bar, Qt.AlignRight) 41 | self.hBoxLayout.addStretch(5) 42 | self.hBoxLayout.addWidget(self.ChooseBox, Qt.AlignRight) 43 | self.hBoxLayout.addStretch(5) 44 | self.hBoxLayout.addWidget(self.StartBox, Qt.AlignRight) 45 | self.hBoxLayout.addStretch(5) 46 | self.hBoxLayout.addWidget(self.StartDownload, Qt.AlignRight) 47 | self.hBoxLayout.addStretch(10) 48 | 49 | self.TableWidget_2 = TableWidget(self) 50 | self.TableWidget_2.setObjectName("TableWidget_2") 51 | self.TableWidget_2.setWordWrap(False) 52 | self.TableWidget_2.setColumnCount(4) 53 | self.TableWidget_2.verticalHeader().hide() 54 | self.TableWidget_2.setHorizontalHeaderLabels(['ID', '歌曲名', '艺术家', '专辑']) 55 | self.TableWidget_2.setEditTriggers(QAbstractItemView.NoEditTriggers) 56 | self.TableWidget_2.itemSelectionChanged.connect(self.openbutton) 57 | self.TableWidget_2.resizeColumnsToContents() 58 | self.TableWidget_2.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) 59 | 60 | self.vBoxLayout.addLayout(self.hBoxLayout, Qt.AlignTop) 61 | self.vBoxLayout.addStretch(1) 62 | self.vBoxLayout.addWidget(self.TableWidget_2, Qt.AlignBottom) 63 | 64 | self.lworker = getlist() 65 | self.dworker = downloading(howto = "playlist") 66 | self.dworker.finished.connect(lambda Progress: download(progress = Progress, table = self.TableWidget_2, progressbar=self.pro_bar, 67 | songdata=None, dworker=self.dworker, button=self.StartDownload, parent=self.window(), howto = "lists")) 68 | 69 | def openbutton(self): 70 | self.StartDownload.setEnabled(True) 71 | def StartPutIn(self): 72 | w = PutIn(parent=self) 73 | if w.exec(): 74 | setOK(parent=self, howto="playlists") 75 | def ChangePlaylist(self): 76 | w = ChoosePlayList(parent=self) 77 | w.exec() 78 | 79 | class PutIn(MessageBoxBase): 80 | """ Custom message box """ 81 | 82 | def __init__(self, parent=None): 83 | super().__init__(parent.window()) 84 | self.titleLabel = SubtitleLabel('导入歌单', self) 85 | self.api_type = QHBoxLayout(self) 86 | self.howtoin = QHBoxLayout(self) 87 | self.inUID = QHBoxLayout(self) 88 | self.Api_Tips = SubtitleLabel("API:", self) 89 | self.Api_Tips.setObjectName("Api_Tips") 90 | self.SubtitleLabel_2 = SubtitleLabel("导入方式:", self) 91 | self.SubtitleLabel_2.setObjectName("SubtitleLabel_2") 92 | self.SubtitleLabel_3 = SubtitleLabel("ID/UID:", self) 93 | self.SubtitleLabel_3.setObjectName("SubtitleLabel_3") 94 | 95 | self.apiBox = ComboBox(self) 96 | self.apiBox.addItems(["NCMA"]) 97 | self.ComboBox = ComboBox(self) 98 | self.ComboBox.setObjectName("ComboBox") 99 | self.ComboBox.addItems(["用户", "歌单"]) 100 | self.LineEdit = LineEdit(self) 101 | self.LineEdit.setObjectName("LineEdit") 102 | 103 | # add widget to view layout 104 | self.api_type.addWidget(self.Api_Tips) 105 | self.api_type.addWidget(self.apiBox) 106 | self.howtoin.addWidget(self.SubtitleLabel_2) 107 | self.howtoin.addWidget(self.ComboBox) 108 | self.inUID.addWidget(self.SubtitleLabel_3) 109 | self.inUID.addWidget(self.LineEdit) 110 | self.viewLayout.addWidget(self.titleLabel) 111 | self.viewLayout.addLayout(self.api_type) 112 | self.viewLayout.addLayout(self.howtoin) 113 | self.viewLayout.addLayout(self.inUID) 114 | 115 | # change the text of button 116 | self.yesButton.setText('导入') 117 | self.yesButton.setDisabled(True) 118 | self.cancelButton.setText('取消') 119 | self.yesButton.clicked.connect(lambda: searchstart(PushButton=self.yesButton, lworker=parent.lworker, 120 | ComboBox=self.ComboBox, LineEdit=self.LineEdit, parent=parent)) 121 | self.widget.setMinimumWidth(350) 122 | self.LineEdit.textChanged.connect(self._validateText) 123 | 124 | # self.hideYesButton() 125 | 126 | def _validateText(self, text): 127 | if text == None: 128 | self.yesButton.setDisabled(True) 129 | else: 130 | self.yesButton.setEnabled(True) 131 | 132 | class ChoosePlayList(MessageBoxBase): 133 | """ Custom message box """ 134 | 135 | def __init__(self, parent=None): 136 | super().__init__(parent.window()) 137 | self.titleLabel = SubtitleLabel('选择歌单', self) 138 | 139 | self.TableWidget = TableWidget(self) 140 | self.TableWidget.setObjectName("TableWidget") 141 | self.TableWidget.setWordWrap(False) 142 | self.TableWidget.setRowCount(30) 143 | self.TableWidget.setColumnCount(2) 144 | self.TableWidget.verticalHeader().hide() 145 | self.TableWidget.setHorizontalHeaderLabels(['序号', '歌单']) 146 | self.TableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers) 147 | self.TableWidget.resizeColumnsToContents() 148 | self.TableWidget.resizeColumnsToContents() 149 | self.TableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) 150 | 151 | self.TableWidget.itemSelectionChanged.connect(lambda: self.yesButton.setEnabled(True)) 152 | FindLists(TableWidget=self.TableWidget) 153 | 154 | # add widget to view layout 155 | self.viewLayout.addWidget(self.titleLabel) 156 | self.viewLayout.addWidget(self.TableWidget) 157 | 158 | # change the text of button 159 | self.yesButton.setText('确定') 160 | self.yesButton.setDisabled(True) 161 | self.cancelButton.setText('取消') 162 | self.yesButton.clicked.connect(lambda: music(TableWidget=self.TableWidget, TableWidget_2=parent.TableWidget_2, Button=parent.ChooseBox, parent=parent)) 163 | parent.lworker.finished.connect(lambda: search(lworker=parent.lworker, TableWidget=self.TableWidget)) 164 | 165 | self.widget.setMinimumWidth(350) -------------------------------------------------------------------------------- /Interface/plugin.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import sys 4 | from helper.inital import setSettingsQss 5 | from PyQt5.QtCore import Qt, QStandardPaths 6 | from PyQt5.QtWidgets import QWidget 7 | from helper.config import cfg 8 | from qfluentwidgets import FluentIcon as FIF 9 | from qfluentwidgets import SettingCardGroup, FolderListSettingCard, ScrollArea, ExpandLayout, HyperlinkCard 10 | from helper.pluginHelper import run_plugins_plugin 11 | from helper.getvalue import PLU_URL 12 | 13 | class plugins(ScrollArea): 14 | 15 | def __init__(self): 16 | super().__init__() 17 | self.scrollWidget = QWidget() 18 | self.expandLayout = ExpandLayout(self.scrollWidget) 19 | self.setObjectName('plugins') 20 | self.resize(1000, 800) 21 | self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 22 | self.setViewportMargins(0, 20, 0, 20) 23 | self.setWidget(self.scrollWidget) 24 | self.setWidgetResizable(True) 25 | self.scrollWidget.setObjectName('scrollWidget') 26 | 27 | self.ListsGroup = SettingCardGroup(self.tr('已导入的插件'), self.scrollWidget) 28 | self.PluginsGroup = SettingCardGroup(self.tr('管理插件'), self.scrollWidget) 29 | run_plugins_plugin(parent=self, PluginsGroup=self.PluginsGroup) 30 | setSettingsQss(parent=self) 31 | 32 | self.PluginListCard = FolderListSettingCard( 33 | cfg.PluginFolders, 34 | "插件", 35 | directory=QStandardPaths.writableLocation(QStandardPaths.DesktopLocation), 36 | parent=self.ListsGroup 37 | ) 38 | self.StoreCard = HyperlinkCard( 39 | PLU_URL, 40 | self.tr('浏览器打开'), 41 | FIF.TAG, 42 | self.tr('插件商店'), 43 | self.tr('AZ Studio制作的AZMusicDownloader官方插件商店(暂未上线)'), 44 | self.ListsGroup 45 | ) 46 | self.StoreCard.setEnabled(False) 47 | 48 | self.ListsGroup.addSettingCard(self.PluginListCard) 49 | self.ListsGroup.addSettingCard(self.StoreCard) 50 | self.expandLayout.setSpacing(28) 51 | self.expandLayout.setContentsMargins(60, 10, 60, 0) 52 | self.expandLayout.addWidget(self.ListsGroup) 53 | self.expandLayout.addWidget(self.PluginsGroup) 54 | 55 | 56 | -------------------------------------------------------------------------------- /Interface/searchmusic.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from PyQt5.QtCore import QModelIndex, Qt 3 | from PyQt5.QtGui import QPalette 4 | from PyQt5.QtWidgets import QStyleOptionViewItem, QWidget, QHBoxLayout, QVBoxLayout, QLabel, QHeaderView, \ 5 | QAbstractItemView 6 | from qfluentwidgets import TableWidget, isDarkTheme, TableItemDelegate, SearchLineEdit, \ 7 | PrimaryPushButton, SpinBox, ProgressBar, BodyLabel, IndeterminateProgressBar 8 | from PyQt5.QtCore import QObject 9 | import helper.config 10 | from helper.inital import get_update, showup 11 | from helper.downloadHelper import downloading, download 12 | from helper.searchmusicHelper import getlist, sethotlineEdit, search, searchstart, rundownload 13 | class CustomTableItemDelegate(TableItemDelegate): 14 | """ Custom table item delegate """ 15 | 16 | def initStyleOption(self, option: QStyleOptionViewItem, index: QModelIndex): 17 | super().initStyleOption(option, index) 18 | if index.column() != 1: 19 | return 20 | 21 | if isDarkTheme(): 22 | option.palette.setColor(QPalette.Text, Qt.white) 23 | option.palette.setColor(QPalette.HighlightedText, Qt.white) 24 | else: 25 | option.palette.setColor(QPalette.Text, Qt.red) 26 | option.palette.setColor(QPalette.HighlightedText, Qt.red) 27 | 28 | 29 | class searchmusic(QWidget, QObject): 30 | 31 | def __init__(self): 32 | super().__init__() 33 | # setTheme(Theme.DARK) 34 | self.setObjectName("searchmusic") 35 | self.hBoxLayout = QHBoxLayout(self) 36 | self.layout1 = QVBoxLayout(self) 37 | 38 | self.SearchLabel = BodyLabel('输入歌曲名/歌手/专辑名', self) 39 | self.lineEdit = SearchLineEdit(self) 40 | self.lineEdit.setPlaceholderText('搜索音乐') 41 | self.lineEdit.setFixedSize(200, 33) 42 | 43 | # self.lineEdit.textEdited.connect(self.keys) 44 | StartSearch = lambda: searchstart(lineEdit=self.lineEdit, parent=self, spinBox=self.spinBox, lworker=self.lworker, progressbar=self.IndeterminateProgressBar) 45 | self.lineEdit.returnPressed.connect(StartSearch) 46 | self.lineEdit.searchButton.released.connect(StartSearch) 47 | 48 | self.numLabel = BodyLabel('显示数量', self) 49 | self.spinBox = SpinBox(self) 50 | self.spinBox.setValue(15) 51 | 52 | # self.worker_thread = QThread() 53 | # self.worker = Worker() 54 | # self.worker.moveToThread(self.worker_thread) 55 | 56 | self.lworker = getlist() 57 | self.dworker = downloading(howto="search") 58 | self.upworker = get_update() 59 | self.lworker.finished.connect(lambda: search(progressbar=self.IndeterminateProgressBar, lworker=self.lworker, parent=self, 60 | tableView=self.tableView, spinBox=self.spinBox)) 61 | self.dworker.finished.connect( 62 | lambda Progress: download(progress=Progress, table=self.tableView, progressbar=self.ProgressBar, 63 | songdata=self.lworker.songInfos, dworker=self.dworker, button=self.primaryButton1, 64 | parent=self.window(), howto="search")) 65 | self.upworker.finished.connect( 66 | lambda updata: showup(parent=self.window(), updata=updata, upworker=self.upworker)) 67 | # self.worker.finished.connect(self.on_worker_finished) 68 | 69 | self.primaryButton1 = PrimaryPushButton('下载', self) 70 | self.primaryButton1.released.connect(lambda: rundownload(parent=self, primaryButton1=self.primaryButton1, 71 | tableView=self.tableView, dworker=self.dworker, 72 | lworker=self.lworker, ProgressBar=self.ProgressBar)) 73 | self.primaryButton1.setEnabled(False) 74 | 75 | self.ProgressBar = ProgressBar(self) 76 | self.ProgressBar.setHidden(True) 77 | self.ProgressBar.setMaximum(100) 78 | self.ProgressBar.setFixedWidth(200) 79 | 80 | self.IndeterminateProgressBar = IndeterminateProgressBar(self, start=True) 81 | self.IndeterminateProgressBar.setHidden(True) 82 | self.IndeterminateProgressBar.setMaximum(100) 83 | self.IndeterminateProgressBar.setFixedWidth(200) 84 | 85 | self.layout1.addStretch(100) 86 | self.layout1.addWidget(self.SearchLabel) 87 | self.layout1.addSpacing(10) 88 | self.layout1.addWidget(self.lineEdit) 89 | self.layout1.addSpacing(10) 90 | self.layout1.addWidget(self.numLabel) 91 | self.layout1.addSpacing(10) 92 | self.layout1.addWidget(self.spinBox) 93 | self.layout1.addSpacing(10) 94 | self.layout1.addWidget(self.primaryButton1) 95 | self.layout1.addSpacing(10) 96 | self.layout1.addWidget(self.ProgressBar) 97 | self.layout1.addWidget(self.IndeterminateProgressBar) 98 | self.layout1.addStretch(100) 99 | 100 | self.tableView = TableWidget(self) 101 | 102 | # self.tableView.setItemDelegate(CustomTableItemDelegate(self.tableView)) 103 | 104 | self.tableView.setWordWrap(False) 105 | self.tableView.setColumnCount(4) 106 | # songInfos = [] 107 | # songInfos += songInfos 108 | # for i, songInfo in enumerate(songInfos): 109 | # for j in range(4): 110 | # self.tableView.setItem(i, j, QTableWidgetItem(songInfo[j])) 111 | 112 | self.tableView.verticalHeader().hide() 113 | self.tableView.setHorizontalHeaderLabels(['ID', '歌曲名', '艺术家', '专辑']) 114 | self.tableView.resizeColumnsToContents() 115 | self.tableView.itemSelectionChanged.connect(self.openbutton) 116 | self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) 117 | self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers) 118 | # self.tableView.setSortingEnabled(True) 119 | # self.tableView.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) 120 | 121 | self.setStyleSheet("Demo{background: rgb(249, 249, 249)} ") 122 | self.hBoxLayout.setContentsMargins(30, 20, 60, 20) 123 | self.hBoxLayout.addWidget(self.tableView) 124 | self.hBoxLayout.addSpacing(60) 125 | self.hBoxLayout.addLayout(self.layout1) 126 | 127 | self.resize(635, 700) 128 | 129 | sethotlineEdit(lineEdit=self.lineEdit) 130 | if helper.config.Config.update_card.value == False: 131 | self.upworker.start() 132 | 133 | def openbutton(self): 134 | self.primaryButton1.setEnabled(True) 135 | 136 | # @pyqtSlot() 137 | # def keys(self): 138 | # self.worker_thread.started.connect(lambda: self.worker.do_work(text=self.lineEdit.text())) 139 | # self.worker_thread.start() 140 | 141 | # @pyqtSlot() 142 | # def on_worker_finished(self): 143 | # self.completer = QCompleter(self.worker.key, self.lineEdit) 144 | # self.completer.setCaseSensitivity(Qt.CaseInsensitive) 145 | # self.lineEdit.setCompleter(self.completer) 146 | # self.worker_thread.quit() 147 | -------------------------------------------------------------------------------- /Interface/settings.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from helper.LoginHelper import UserLogin 3 | from helper.config import cfg, pfg 4 | from qfluentwidgets import * 5 | from qfluentwidgets import FluentIcon as FIF 6 | from PyQt5.QtCore import Qt, pyqtSignal, QUrl, QThreadPool 7 | from PyQt5.QtGui import QDesktopServices 8 | from PyQt5.QtWidgets import QWidget, QLabel, QFileDialog 9 | from sys import platform, getwindowsversion 10 | from helper.getvalue import YEAR, AUTHOR, VERSION, HELP_URL, FEEDBACK_URL, autopath, apilists, SERVER_URL, \ 11 | audio_quality_list 12 | from helper.inital import delfin, get_update, showup, setSettingsQss 13 | from helper.localmusicsHelper import ref 14 | from helper.SettingHelper import DeleteAllData, editapi 15 | from sys import exit 16 | from helper.flyoutmsg import changelog, restart,setOK 17 | 18 | class LoginMessageBox(MessageBoxBase): 19 | 20 | def __init__(self, parent=None): 21 | super().__init__(parent) 22 | self.titleLabel = SubtitleLabel('添加游戏账号') 23 | self.type_Label = QLabel("API:", self) 24 | self.type_Label.setStyleSheet("QLabel{font-size:15px;font-weight:normal;font-family:Microsoft YaHei;}") 25 | self.type_Box = ComboBox() 26 | self.type_Box.addItems(["NCMA"]) 27 | self.tipLabel = StrongBodyLabel(self.tr("请在浏览器中扫码登录,大约5-10秒后将打开页面"), self) 28 | 29 | 30 | self.viewLayout.addWidget(self.titleLabel) 31 | self.viewLayout.addWidget(self.type_Label) 32 | self.viewLayout.addWidget(self.type_Box) 33 | self.viewLayout.addWidget(self.tipLabel) 34 | 35 | self.login = UserLogin() 36 | self.pool = QThreadPool() 37 | self.login.signals.progress.connect(self.refresh) 38 | self.pool.start(self.login) 39 | 40 | self.widget.setMinimumWidth(350) 41 | def refresh(self, code): 42 | if code == 200: 43 | self.tipLabel.setText("登录成功") 44 | else: 45 | self.tipLabel.setText("二维码已过期") 46 | 47 | def stop(self): 48 | self.pool.clear() 49 | 50 | class SettingInterface(ScrollArea): 51 | micaEnableChanged = pyqtSignal(bool) 52 | 53 | def __init__(self, parent=None): 54 | super().__init__(parent=parent) 55 | self.scrollWidget = QWidget() 56 | self.expandLayout = ExpandLayout(self.scrollWidget) 57 | self.setObjectName('settings') 58 | self.settingLabel = QLabel(self.tr("设置"), self) 59 | self.upworker = get_update() 60 | self.upworker.finished.connect(lambda updata: showup(parent = self, updata = updata, upworker = self.upworker)) 61 | 62 | # Personalize 63 | self.personalGroup = SettingCardGroup(self.tr('个性化'), self.scrollWidget) 64 | self.themeCard = OptionsSettingCard( 65 | cfg.themeMode, 66 | FIF.BRUSH, 67 | self.tr('深浅模式'), 68 | self.tr("更改应用程序的外观"), 69 | texts=[ 70 | self.tr('浅色'), self.tr('深色'), 71 | self.tr('使用系统设置') 72 | ], 73 | parent=self.personalGroup 74 | ) 75 | self.themeColorCard=CustomColorSettingCard( 76 | cfg.themeColor, 77 | FIF.PALETTE, 78 | self.tr('主题颜色'), 79 | self.tr('更改应用程序的主题颜色'), 80 | self.personalGroup 81 | ) 82 | self.languageCard = ComboBoxSettingCard( 83 | cfg.language, 84 | FIF.LANGUAGE, 85 | self.tr('语言'), 86 | self.tr('当前仅支持简体中文'), 87 | texts=['简体中文', self.tr('使用系统设置')], 88 | parent=self.personalGroup 89 | ) 90 | self.micaCard = SwitchSettingCard( 91 | FIF.TRANSPARENT, 92 | self.tr('云母效果'), 93 | self.tr('应用Mica半透明效果(仅支持Windows11)'), 94 | cfg.micaEnabled, 95 | self.personalGroup 96 | ) 97 | 98 | # Folders 99 | self.DownloadSettings = SettingCardGroup(self.tr("下载设置"), self.scrollWidget) 100 | 101 | self.downloadFolderCard = ExpandGroupSettingCard( 102 | FIF.FOLDER, 103 | self.tr('修改目录'), 104 | self.tr("修改下载目录"), 105 | self.personalGroup 106 | ) 107 | self.LabelFolder = SubtitleLabel(f"\n 当前路径为:{cfg.downloadFolder.value}\n", self) 108 | self.LabelAuto = SubtitleLabel(f"\n 默认路径为:{autopath}\n", self) 109 | self.changeFolder = PrimaryPushButton("选择目录", self) 110 | self.AutoFolder = PushButton("恢复默认", self) 111 | self.ApiUrlCard = PushSettingCard( 112 | self.tr('修改'), 113 | FIF.EDIT, 114 | self.tr("自定义API地址"), 115 | self.tr("修改NCMA或QQMA的API地址"), 116 | self.DownloadSettings 117 | ) 118 | 119 | # Application 120 | self.appGroup = SettingCardGroup(self.tr('应用程序设置'), self.scrollWidget) 121 | self.beta = SwitchSettingCard( 122 | FIF.DEVELOPER_TOOLS, 123 | self.tr('Beta实验功能'), 124 | self.tr('开启后会启用实验功能'), 125 | configItem=cfg.beta, 126 | parent=self.appGroup 127 | ) 128 | self.beta.checkedChanged.connect(self.beta_enable) 129 | self.Update_Card = SwitchSettingCard( 130 | FIF.FLAG, 131 | self.tr('禁用更新检查'), 132 | self.tr('开启后启动将不会检查版本更新'), 133 | configItem=cfg.update_card, 134 | parent=self.appGroup 135 | ) 136 | self.backtoinit = PushSettingCard( 137 | self.tr('重置'), 138 | FIF.CANCEL, 139 | self.tr("重置应用"), 140 | self.tr('重置操作重启后生效'), 141 | self.appGroup 142 | ) 143 | 144 | # Search 145 | self.searchGroup = SettingCardGroup(self.tr('搜索设置'), self.scrollWidget) 146 | self.twitCard = SwitchSettingCard( 147 | FIF.TAG, 148 | self.tr('搜索时展示相关的预选项'), 149 | self.tr('关闭后会更加节省资源'), 150 | configItem=cfg.twitcard, 151 | parent=self.searchGroup 152 | ) 153 | self.twitCard.setEnabled(False) 154 | self.hotCard = SwitchSettingCard( 155 | FIF.TAG, 156 | self.tr('搜索时展示热门歌曲预选项'), 157 | self.tr('关闭后启动会更快'), 158 | configItem=cfg.hotcard, 159 | parent=self.searchGroup 160 | ) 161 | self.apiCard = ComboBoxSettingCard( 162 | pfg.apicard, 163 | FIF.GLOBE, 164 | self.tr('第三方音乐API'), 165 | self.tr('仅会修改搜索下载页使用的API。由于QQMA需要账号COOKIE才能进行调用,请自行部署。'), 166 | texts=apilists, 167 | parent=self.searchGroup 168 | ) 169 | 170 | self.levelCard = ComboBoxSettingCard( 171 | pfg.level, 172 | FIF.ALBUM, 173 | self.tr('默认下载音质'), 174 | self.tr('仅对NCMA生效。该项仅保证程序发出的请求无误,无法确保上游API返回的是对应音质的音频。'), 175 | texts=audio_quality_list, 176 | parent=self.searchGroup 177 | ) 178 | self.loginCard = PushSettingCard( 179 | self.tr('登录'), 180 | FIF.PEOPLE, 181 | self.tr('登录音乐平台账号'), 182 | self.tr('当用户拥有VIP,可在此登录以下载完整音频'), 183 | parent=self.searchGroup 184 | ) 185 | self.loginCard.button.clicked.connect(self.showMessage) 186 | 187 | #BetaOnly 188 | if cfg.beta.value: 189 | self.betaonly() 190 | 191 | # About 192 | self.aboutGroup = SettingCardGroup(self.tr('关于'), self.scrollWidget) 193 | self.helpCard = HyperlinkCard( 194 | HELP_URL, 195 | self.tr('打开帮助页面'), 196 | FIF.HELP, 197 | self.tr('帮助'), 198 | self.tr('从帮助页面上获取帮助与支持'), 199 | self.aboutGroup 200 | ) 201 | self.feedbackCard = PushSettingCard( 202 | self.tr('提供反馈'), 203 | FIF.FEEDBACK, 204 | self.tr('提供反馈'), 205 | self.tr('通过提供反馈来帮助我们打造更好的应用'), 206 | self.aboutGroup 207 | ) 208 | self.sponsor = ExpandGroupSettingCard( 209 | FIF.HEART, 210 | self.tr("赞助名单"), 211 | self.tr("给本项目赞助的热心人"), 212 | self.aboutGroup 213 | ) 214 | self.serverCard = HyperlinkCard( 215 | SERVER_URL, 216 | self.tr('领创云'), 217 | FIF.IOT, 218 | self.tr('云计算支持'), 219 | self.tr('本项目由 领创云 提供云计算支持'), 220 | self.sponsor 221 | ) 222 | self.sponsor.addGroupWidget(self.serverCard) 223 | self.aboutCard = PushSettingCard( 224 | self.tr('更新日志'), 225 | FIF.INFO, 226 | self.tr('关于'), 227 | '© ' + self.tr(' ') + f" {YEAR}, {AUTHOR}. " + 228 | self.tr('Version') + f" {VERSION}", 229 | self.aboutGroup 230 | ) 231 | 232 | self.micaCard.setEnabled(False) 233 | if cfg.beta.value: 234 | self.toast_Card.setEnabled(platform == 'win32' and getwindowsversion().build >= 17763) 235 | self.__initWidget() 236 | 237 | def betaonly(self): 238 | self.BetaOnlyGroup = SettingCardGroup(self.tr('Beta Only'), self.scrollWidget) 239 | self.debug_Card = SwitchSettingCard( 240 | FIF.CODE, 241 | self.tr('Debug Mode'), 242 | self.tr('The global exception capture will be disabled, and there will be outputs in the commandline.(Code Running Only)'), 243 | configItem=cfg.debug_card, 244 | parent=self.BetaOnlyGroup 245 | ) 246 | self.plugin_Card = SwitchSettingCard( 247 | FIF.DICTIONARY_ADD, 248 | self.tr('Enable Plugins'), 249 | self.tr('You can use more APIs or other features through using plugins.'), 250 | configItem=cfg.PluginEnable, 251 | parent=self.BetaOnlyGroup 252 | ) 253 | self.toast_Card = SwitchSettingCard( 254 | FIF.MEGAPHONE, 255 | self.tr('Enable Windows Toast'), 256 | self.tr( 257 | 'Use System Notification to notice you when the process is finished. ( Windows 10.0.17763 or later)'), 258 | configItem=cfg.toast, 259 | parent=self.BetaOnlyGroup 260 | ) 261 | 262 | def beta_enable(self): 263 | if cfg.beta.value: 264 | self.betaonly() 265 | self.toast_Card.setEnabled(platform == 'win32' and getwindowsversion().build >= 17763) 266 | self.expandLayout.addWidget(self.BetaOnlyGroup) 267 | self.BetaOnlyGroup.addSettingCard(self.debug_Card) 268 | self.BetaOnlyGroup.addSettingCard(self.plugin_Card) 269 | self.BetaOnlyGroup.addSettingCard(self.toast_Card) 270 | self.debug_Card.setVisible(True) 271 | self.plugin_Card.setVisible(True) 272 | self.toast_Card.setVisible(True) 273 | self.BetaOnlyGroup.setVisible(True) 274 | else: 275 | self.debug_Card.setValue(False) 276 | self.plugin_Card.setValue(False) 277 | self.toast_Card.setValue(False) 278 | self.debug_Card.setVisible(False) 279 | self.plugin_Card.setVisible(False) 280 | self.toast_Card.setVisible(False) 281 | self.BetaOnlyGroup.setVisible(False) 282 | def __initWidget(self): 283 | self.resize(1000, 800) 284 | self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 285 | self.setViewportMargins(0, 120, 0, 20) 286 | self.setWidget(self.scrollWidget) 287 | self.setWidgetResizable(True) 288 | 289 | # initialize style sheet 290 | self.scrollWidget.setObjectName('scrollWidget') 291 | self.settingLabel.setObjectName('settingLabel') 292 | setSettingsQss(parent=self) 293 | 294 | # initialize layout 295 | self.__initLayout() 296 | self.__connectSignalToSlot() 297 | 298 | def __initLayout(self): 299 | self.settingLabel.move(60, 63) 300 | 301 | # ExpandCard 302 | self.downloadFolderCard.addGroupWidget(self.LabelFolder) 303 | self.downloadFolderCard.addGroupWidget(self.LabelAuto) 304 | self.downloadFolderCard.addWidget(self.changeFolder) 305 | self.downloadFolderCard.addWidget(self.AutoFolder) 306 | 307 | # add cards to group 308 | self.DownloadSettings.addSettingCard(self.downloadFolderCard) 309 | self.DownloadSettings.addSettingCard(self.ApiUrlCard) 310 | 311 | self.personalGroup.addSettingCard(self.themeCard) 312 | self.personalGroup.addSettingCard(self.themeColorCard) 313 | self.personalGroup.addSettingCard(self.languageCard) 314 | self.personalGroup.addSettingCard(self.micaCard) 315 | 316 | self.appGroup.addSettingCard(self.beta) 317 | self.appGroup.addSettingCard(self.Update_Card) 318 | self.appGroup.addSettingCard(self.backtoinit) 319 | 320 | if cfg.beta.value: 321 | self.BetaOnlyGroup.addSettingCard(self.debug_Card) 322 | self.BetaOnlyGroup.addSettingCard(self.plugin_Card) 323 | self.BetaOnlyGroup.addSettingCard(self.toast_Card) 324 | 325 | self.aboutGroup.addSettingCard(self.sponsor) 326 | self.aboutGroup.addSettingCard(self.helpCard) 327 | self.aboutGroup.addSettingCard(self.feedbackCard) 328 | self.aboutGroup.addSettingCard(self.aboutCard) 329 | 330 | self.searchGroup.addSettingCard(self.twitCard) 331 | self.searchGroup.addSettingCard(self.hotCard) 332 | self.searchGroup.addSettingCard(self.apiCard) 333 | self.searchGroup.addSettingCard(self.loginCard) 334 | self.searchGroup.addSettingCard(self.levelCard) 335 | 336 | # add setting card group to layout 337 | self.expandLayout.setSpacing(28) 338 | self.expandLayout.setContentsMargins(60, 10, 60, 0) 339 | self.expandLayout.addWidget(self.DownloadSettings) 340 | self.expandLayout.addWidget(self.searchGroup) 341 | self.expandLayout.addWidget(self.personalGroup) 342 | if cfg.beta.value: 343 | self.expandLayout.addWidget(self.BetaOnlyGroup) 344 | self.expandLayout.addWidget(self.appGroup) 345 | self.expandLayout.addWidget(self.aboutGroup) 346 | 347 | def __onDownloadFolderCardClicked(self): 348 | """ download folder card clicked slot """ 349 | folder = QFileDialog.getExistingDirectory( 350 | self, self.tr("Choose folder"), "./") 351 | if not folder or cfg.get(cfg.downloadFolder) == folder: 352 | return 353 | cfg.set(cfg.downloadFolder, folder) 354 | self.LabelFolder.setText(f"\n 当前路径为:{folder}\n") 355 | ref(musicpath=folder) 356 | setOK(parent=self.window()) 357 | 358 | def __FolederAutoCardClicked(self): 359 | cfg.set(cfg.downloadFolder, autopath) 360 | self.LabelFolder.setText(f"\n 当前路径为:{autopath}\n") 361 | ref(musicpath=autopath) 362 | setOK(parent=self.window()) 363 | 364 | def __customapis(self): 365 | w = editapi(parent=self.window(), ncmaapi=cfg.ncma_api.value, qqmaapi=cfg.qqma_api.value) 366 | if w: 367 | cfg.set(cfg.ncma_api, w[0]) 368 | cfg.set(cfg.qqma_api, w[1]) 369 | setOK(parent=self.window()) 370 | 371 | def __backtoinitClicked(self): 372 | w = DeleteAllData(self.window()) 373 | if not w.exec(): 374 | delfin(IfMusicPath=w.DataCheckBox.isChecked()) 375 | exit(0) 376 | 377 | def __onThemeChanged(self, theme: Theme): 378 | """ theme changed slot """ 379 | # change the theme of qfluentwidgets 380 | setTheme(theme) 381 | 382 | # chang the theme of setting interface 383 | setSettingsQss(parent=self) 384 | setOK(parent=self.window()) 385 | 386 | def beta_not(self): 387 | if not cfg.beta.value: 388 | self.debug_Card.setValue(False) 389 | self.plugin_Card.setValue(False) 390 | self.toast_Card.setValue(False) 391 | self.debug_Card.setVisible(False) 392 | self.plugin_Card.setVisible(False) 393 | self.toast_Card.setVisible(False) 394 | self.BetaOnlyGroup.setVisible(False) 395 | 396 | def __connectSignalToSlot(self): 397 | """ connect signal to slot """ 398 | cfg.appRestartSig.connect(lambda: restart(parent=self.window())) 399 | pfg.appRestartSig.connect(lambda: restart(parent=self.window())) 400 | cfg.themeChanged.connect(self.__onThemeChanged) 401 | pfg.themeChanged.connect(self.__onThemeChanged) 402 | self.micaCard.checkedChanged.connect(self.micaEnableChanged) 403 | self.AutoFolder.clicked.connect(self.__FolederAutoCardClicked) 404 | self.changeFolder.clicked.connect(self.__onDownloadFolderCardClicked) 405 | self.backtoinit.clicked.connect(self.__backtoinitClicked) 406 | self.beta.checkedChanged.connect(self.beta_not) 407 | self.aboutCard.clicked.connect(lambda: changelog(parent=self)) 408 | self.feedbackCard.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(FEEDBACK_URL))) 409 | self.ApiUrlCard.clicked.connect(self.__customapis) 410 | def showMessage(self): 411 | global ms_login_data 412 | w = LoginMessageBox(self.window()) 413 | if w.exec(): 414 | w.stop() 415 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MusicDownloader.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtWidgets import QApplication, QSplashScreen, QMessageBox, QWidget 2 | from qfluentwidgets import FluentTranslator 3 | from helper.config import cfg 4 | from window.main import Window 5 | import sys 6 | from PyQt5.QtCore import Qt, QTranslator 7 | from PyQt5.QtGui import QPixmap 8 | from helper.inital import mkf 9 | 10 | if not cfg.debug_card.value: 11 | def global_exception_handler(exc_type, exc_value, exc_traceback): 12 | msesg = '{}\n{}\n{}'.format(str(exc_type), str(exc_value), str(exc_traceback)) 13 | QMessageBox.critical(w, "There's an error ! ! !", msesg, QMessageBox.Yes) 14 | sys.excepthook = global_exception_handler 15 | 16 | if __name__ == '__main__' and sys.platform == 'win32' and sys.getwindowsversion().build >= 17763: 17 | QApplication.setHighDpiScaleFactorRoundingPolicy( 18 | Qt.HighDpiScaleFactorRoundingPolicy.PassThrough) 19 | QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) 20 | QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) 21 | app = QApplication(sys.argv) 22 | 23 | splash_pix = QPixmap('resource/splash.png') 24 | splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) 25 | splash.setAttribute(Qt.WA_TranslucentBackground) 26 | splash.show() 27 | screen_resolution = app.desktop().screenGeometry() 28 | screen_width, screen_height = screen_resolution.width(), screen_resolution.height() 29 | splash_width = 260 30 | splash_height = 260 31 | splash.setFixedSize(splash_width, splash_height) 32 | splash.move((screen_width - splash_width) // 2, (screen_height - splash_height) // 2) 33 | 34 | mkf() 35 | 36 | locale = cfg.get(cfg.language).value 37 | fluentTranslator = FluentTranslator(locale) 38 | settingTranslator = QTranslator() 39 | settingTranslator.load(locale, "settings", ".", "resource/i18n") 40 | 41 | app.installTranslator(fluentTranslator) 42 | app.installTranslator(settingTranslator) 43 | app.processEvents() 44 | 45 | w = Window() 46 | w.show() 47 | splash.finish(w) 48 | app.exec_() 49 | else: 50 | app = QApplication(sys.argv) 51 | w = QWidget() 52 | text = "Unsupported operating system: " + sys.platform 53 | QMessageBox.critical(w, "There is an error when the Application is starting !", text, QMessageBox.Yes) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | AZ Studio 5 | 6 | 7 | # AZ音乐下载器 | AZMusicDownloader 8 | 9 | _✨ 优雅地下载音乐✨_ 10 | 11 |

12 | Python 13 | WinOnly 14 | 15 | AZMusicAPI 16 | 17 | 18 | PyQt-Fluent-Widgets 19 | 20 | 21 | 22 | qq group 23 | 24 |

25 | 26 |
27 | 28 | > 若您需要二次分发本程序,需经过开发者书面同意,并需在您的项目中注明该项目地址 29 | > 30 | > 近期工作室全力开发 Redstone Launcher 项目,本项目更新较缓 31 | > 32 | > 本程序是通过调用 NeteaseCloudMusicApi 及其他音乐API实现的音乐下载,并未使用非法技术手段破解音乐平台 33 | 34 | ### 系统要求 35 | 36 | 仅支持 Windows(因为使用了dwmapi) 37 | 38 | 仅支持 Windows 10.0.17763 以上的版本 39 | 40 | ### 赞助 41 | 42 | > 程序维护需要巨大的时间和精力,如果您觉得本程序对您有帮助,欢迎赞助以支持开发者 43 | 44 | 欢迎Fork并Pull Requests 45 | 46 | 同时欢迎 47 | 爱发电 48 | 49 | ### 文档 50 | 51 | 点我跳转 52 | 53 | ### 使用条款 54 | 55 | [使用条款](https://md.azteam.cn/docs/rule) 56 | 57 | 若您不同意本条款,请退出本页面。您使用本软件即代表您同意本条款。 58 | 59 | ### 免责声明 60 | 61 | > 本项目部分功能使用了网易云音乐的第三方 API 服务,仅供个人学习研究使用,禁止用于商业及非法用途。同时,本项目开发者承诺:严格遵守相关法律法规和网易云音乐 API 使用协议,不会利用本项目进行任何违法活动。 如因使用本项目而引起的任何纠纷或责任,均由使用者自行承担。本项目开发者不承担任何因使用本项目而导致的任何直接或间接责任,并保留追究使用者违法行为的权利。请使用者在使用本项目时遵守相关法律法规,请勿将本项目用于任何商业及非法用途。如有违反,一切后果由使用者自负。 同时,使用者应该自行承担因使用本项目而带来的风险和责任。本项目开发者不对本项目所提供的服务和内容做出任何保证,感谢您的理解。 62 | 63 | ### 云计算支持 64 | 65 | [领创云](https://www.lcyidc.com/) 66 | 67 | ![Star History Chart](https://api.star-history.com/svg?repos=AZ-Studio-2023/AZMusicDownloader&type=Date) 68 | 69 | ![Alt](https://repobeats.axiom.co/api/embed/c3811b9d467134f4fe12b9dd9e1c3f72030e2e7f.svg "Repobeats analytics image") 70 | 71 | 72 | 73 | ## License 74 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FAZ-Studio-2023%2FAZMusicDownloader.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FAZ-Studio-2023%2FAZMusicDownloader?ref=badge_large) 75 | -------------------------------------------------------------------------------- /helper/LoginHelper.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tempfile 3 | import time 4 | import webbrowser 5 | 6 | import requests 7 | from PyQt5.QtCore import QRunnable, QObject, pyqtSignal, pyqtSlot 8 | 9 | from helper.config import cfg 10 | 11 | 12 | class WorkerSignals(QObject): 13 | progress = pyqtSignal(int) 14 | 15 | class UserLogin(QRunnable): 16 | def __init__(self): 17 | super(UserLogin, self).__init__() 18 | self.signals = WorkerSignals() 19 | @pyqtSlot() 20 | def run(self): 21 | key = requests.get(cfg.ncma_api.value + f"login/qr/key?timestamp={int(time.time())}").json()["data"]["unikey"] 22 | img = requests.get(cfg.ncma_api.value + f"login/qr/create?key={key}&qrimg=1×tamp={int(time.time())}").json()["data"]["qrimg"] 23 | html_code = f""" 24 | 25 | 26 | 27 | 28 | 29 | Login 30 | 31 | 32 | 33 | 34 | 35 | """ 36 | 37 | with tempfile.NamedTemporaryFile(delete=False, suffix='.html') as temp_file: 38 | temp_file.write(html_code.encode('utf-8')) 39 | temp_file_path = temp_file.name 40 | 41 | webbrowser.open(f'file://{temp_file_path}') 42 | t = 0 43 | while True: 44 | d = requests.get(cfg.ncma_api.value + f"login/qr/check?key={key}×tamp={int(time.time())}").json() 45 | if d["code"] == 803: 46 | cfg.set(cfg.cookie, d["cookie"]) 47 | self.signals.progress.emit(200) 48 | break 49 | elif d["code"] == 800: 50 | self.signals.progress.emit(100) 51 | break 52 | time.sleep(1) 53 | t = t + 1 54 | if t == 5: 55 | os.remove(temp_file_path) -------------------------------------------------------------------------------- /helper/SettingHelper.py: -------------------------------------------------------------------------------- 1 | import json, os 2 | from helper.getvalue import apilists 3 | from qfluentwidgets import MessageBoxBase, SubtitleLabel, CheckBox, LineEdit, HyperlinkButton, TransparentPushButton, ToolTipFilter, ToolTipPosition 4 | from PyQt5.QtWidgets import QLabel, QHBoxLayout 5 | from qfluentwidgets import FluentIcon as FIF 6 | from helper.getvalue import autoncmaapi, autoqqmaapi 7 | 8 | ncma_edited_api = None 9 | qqma_edited_api = None 10 | 11 | 12 | 13 | def get_all_api(folders_arg): 14 | global apilists 15 | for folder in folders_arg: 16 | for filename in os.listdir(folder): 17 | last_path = os.path.basename(folder) 18 | if filename.endswith('.py') and os.path.exists(folder) and os.path.exists( 19 | folder + "/index.json") and filename.replace(".py", "") == last_path and not os.path.exists( 20 | folder + "/plugin.lock"): 21 | u = open(folder + "/index.json", "r", encoding="utf-8") 22 | data = json.loads(u.read()) 23 | u.close() 24 | if data["type"] == "api": 25 | apilists.append(data["name"]) 26 | return apilists 27 | 28 | class DeleteAllData(MessageBoxBase): 29 | def __init__(self, parent): 30 | super().__init__(parent) 31 | self.titleLabel = SubtitleLabel('重置应用', self) 32 | self.contentLabel = QLabel("你确定要重置应用吗?\n重置应用将会删除你的设置等数据,\n同时你将会回到初始化时的状态。\n重置后将会直接关闭应用,\n请确保没有任何正在执行的下载任务。", self) 33 | self.contentLabel.setStyleSheet("QLabel{color:rgb(225,0,0);font-size:17px;font-weight:normal;font-family:SimHei;}") 34 | 35 | self.PrimiseCheckBox = CheckBox('我已悉知以上影响', self) 36 | self.DataCheckBox = CheckBox('同时删除下载的音乐', self) 37 | self.DataCheckBox.setDisabled(True) 38 | 39 | # add widget to view layout 40 | self.viewLayout.addWidget(self.titleLabel) 41 | self.viewLayout.addWidget(self.contentLabel) 42 | self.viewLayout.addWidget(self.PrimiseCheckBox) 43 | self.viewLayout.addWidget(self.DataCheckBox) 44 | 45 | # change the text of button 46 | self.yesButton.setText('取消') 47 | self.cancelButton.setText('重置') 48 | 49 | self.widget.setMinimumWidth(350) 50 | self.cancelButton.setDisabled(True) 51 | #self.urlLineEdit.textChanged.connect(self._validateUrl) 52 | self.PrimiseCheckBox.stateChanged.connect(self.IfPrimise) 53 | 54 | def IfPrimise(self): 55 | self.cancelButton.setEnabled(self.PrimiseCheckBox.isChecked()) 56 | 57 | class CustomAPIs(MessageBoxBase): 58 | def __init__(self, parent, ncmaapi, qqmaapi): 59 | super().__init__(parent) 60 | self.titleLabel = SubtitleLabel('自定义NCMA/QQMA的API地址', self) 61 | self.contentLabel = QLabel("API地址是一个完整的,包含协议头的地址。\nNCMA地址必须填写,QQMA由于没有默认值可以不填\n填写错误会导致下载失败,有任何问题请查阅文档", self) 62 | self.contentLabel.setStyleSheet("QLabel{font-size:15px;font-weight:normal;font-family:Microsoft YaHei;}") 63 | 64 | # NCMA配置 65 | self.ncmaLabel = QLabel("NCMA:", self) 66 | self.ncmaLabel.setStyleSheet("QLabel{font-size:15px;font-weight:normal;font-family:Microsoft YaHei;}") 67 | self.NCMAedit = LineEdit(self) 68 | self.NCMAedit.setPlaceholderText('输入NCMA的API地址配置') 69 | self.NCMAedit.setText(ncmaapi) 70 | self.NCMAedit.setClearButtonEnabled(True) 71 | 72 | self.NCMAtoInit = TransparentPushButton('恢复默认值', self) 73 | self.NCMAtoInit.setToolTip(f'NCMA的默认值为 {autoncmaapi}') 74 | self.NCMAtoInit.installEventFilter(ToolTipFilter(self.NCMAtoInit, 0, ToolTipPosition.TOP)) 75 | self.NCMAdoc = HyperlinkButton( 76 | url='https://md.azprod.cn/docs/use_api.html', 77 | text='查阅文档', 78 | parent=self, 79 | icon=FIF.LINK 80 | ) 81 | 82 | self.ncmaHLayout = QHBoxLayout(self) 83 | self.ncmaHLayout.addWidget(self.NCMAtoInit) 84 | self.ncmaHLayout.addWidget(self.NCMAdoc) 85 | 86 | # QQMA配置 87 | self.qqmaLabel = QLabel("QQMA:", self) 88 | self.qqmaLabel.setStyleSheet("QLabel{font-size:15px;font-weight:normal;font-family:SimHei;font-family:Microsoft YaHei;}") 89 | self.QQMAedit = LineEdit(self) 90 | self.QQMAedit.setPlaceholderText('输入QQMA的API地址配置') 91 | self.QQMAedit.setText(qqmaapi) 92 | self.QQMAedit.setClearButtonEnabled(True) 93 | 94 | self.QQMAtoInit = TransparentPushButton('恢复默认值', self) 95 | self.QQMAtoInit.setToolTip('QQMA可以不填,同时没有默认值') 96 | self.QQMAtoInit.installEventFilter(ToolTipFilter(self.QQMAtoInit, 0, ToolTipPosition.TOP)) 97 | self.QQMAdoc = HyperlinkButton( 98 | url='https://md.azprod.cn/docs/use_api.html', 99 | text='查阅文档', 100 | parent=self, 101 | icon=FIF.LINK 102 | ) 103 | 104 | self.qqmaHLayout = QHBoxLayout(self) 105 | self.qqmaHLayout.addWidget(self.QQMAtoInit) 106 | self.qqmaHLayout.addWidget(self.QQMAdoc) 107 | 108 | # 添加布局 109 | self.viewLayout.addWidget(self.titleLabel) 110 | self.viewLayout.addWidget(self.contentLabel) 111 | self.viewLayout.addWidget(self.ncmaLabel) 112 | self.viewLayout.addWidget(self.NCMAedit) 113 | self.viewLayout.addLayout(self.ncmaHLayout) 114 | self.viewLayout.addWidget(self.qqmaLabel) 115 | self.viewLayout.addWidget(self.QQMAedit) 116 | self.viewLayout.addLayout(self.qqmaHLayout) 117 | 118 | # 对按钮进行设置 119 | self.yesButton.setText('保存') 120 | self.cancelButton.setText('取消') 121 | self.widget.setMinimumWidth(350) 122 | self.NCMAtoInit.clicked.connect(self.ncmabacktoinit) 123 | self.QQMAtoInit.clicked.connect(self.qqmabacktoinit) 124 | self.yesButton.clicked.connect(self.save) 125 | 126 | def ncmabacktoinit(self): 127 | self.NCMAedit.setText(autoncmaapi) 128 | def qqmabacktoinit(self): 129 | self.QQMAedit.setText(autoqqmaapi) 130 | 131 | def save(self): 132 | # 设置修改操作 133 | global ncma_edited_api 134 | global qqma_edited_api 135 | ncma_edited_api = self.NCMAedit.text() 136 | qqma_edited_api = self.QQMAedit.text() 137 | 138 | def editapi(parent, ncmaapi, qqmaapi): 139 | w = CustomAPIs(parent=parent, ncmaapi=ncmaapi, qqmaapi=qqmaapi) 140 | w.show() 141 | if w.exec(): 142 | new_api = [] 143 | new_api.append(ncma_edited_api) 144 | new_api.append(qqma_edited_api) 145 | return new_api 146 | else: 147 | w = False 148 | -------------------------------------------------------------------------------- /helper/config.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from enum import Enum 3 | from sys import platform, getwindowsversion 4 | from helper.getvalue import configpath, autopath, autoncmaapi, autoqqmaapi, GetDefaultThemeColor 5 | from helper.SettingHelper import get_all_api 6 | from PyQt5.QtCore import QLocale 7 | from qfluentwidgets import (qconfig, QConfig, ConfigItem, OptionsConfigItem, BoolValidator,ColorConfigItem, EnumSerializer, 8 | OptionsValidator, FolderValidator, ConfigSerializer, FolderListValidator, Theme) 9 | 10 | class Language(Enum): 11 | """ Language enumeration """ 12 | 13 | CHINESE_SIMPLIFIED = QLocale(QLocale.Chinese, QLocale.China) 14 | CHINESE_TRADITIONAL = QLocale(QLocale.Chinese, QLocale.HongKong) 15 | ENGLISH = QLocale(QLocale.English) 16 | AUTO = QLocale() 17 | 18 | 19 | class LanguageSerializer(ConfigSerializer): 20 | """ Language serializer """ 21 | 22 | def serialize(self, language): 23 | return language.value.name() if language != Language.AUTO else "Auto" 24 | 25 | def deserialize(self, value: str): 26 | return Language(QLocale(value)) if value != "Auto" else Language.AUTO 27 | 28 | from enum import Enum 29 | 30 | class AudioQuality(Enum): 31 | STANDARD = "standard" 32 | HIGHER = "higher" 33 | EXHIGH = "exhigh" 34 | LOSSLESS = "lossless" 35 | HIRES = "hires" 36 | JYEFFECT = "jyeffect" 37 | SKY = "sky" 38 | JYMASTER = "jymaster" 39 | 40 | 41 | class AudioQualitySerializer: 42 | """ Audio Quality serializer """ 43 | 44 | @staticmethod 45 | def serialize(audio_quality: AudioQuality) -> str: 46 | """ 47 | Serialize the audio quality enum into its English string representation. 48 | """ 49 | return audio_quality.value 50 | 51 | @staticmethod 52 | def deserialize(value: str) -> AudioQuality: 53 | """ 54 | Deserialize an English string into the appropriate AudioQuality enum. 55 | """ 56 | try: 57 | return AudioQuality(value.lower()) 58 | except ValueError: 59 | return AudioQuality.STANDARD 60 | 61 | 62 | 63 | 64 | class Config(QConfig): 65 | # Download 66 | downloadFolder = ConfigItem( 67 | "Download", "Folder", autopath, FolderValidator()) 68 | ncma_api = ConfigItem( 69 | "Download", "ncma_api", autoncmaapi, None) 70 | qqma_api = ConfigItem( 71 | "Download", "qqma_api", autoqqmaapi, None) 72 | level = OptionsConfigItem( 73 | "Download", "level", AudioQuality.STANDARD, validator=OptionsValidator(AudioQuality), serializer=AudioQualitySerializer()) 74 | 75 | # Application 76 | beta = ConfigItem( 77 | "Application", "beta", False, BoolValidator()) 78 | update_card = ConfigItem( 79 | "Application", "update_card", False, BoolValidator(), restart=True) 80 | 81 | #pluginsFolders 82 | PluginFolders = ConfigItem( 83 | "Plugins", "Folders", [], FolderListValidator(), restart=True) 84 | 85 | # Search 86 | twitcard = ConfigItem( 87 | "Search", "twitcard", False, BoolValidator(), restart=True) 88 | hotcard = ConfigItem( 89 | "Search", "hotcard", False, BoolValidator(), restart=True) 90 | cookie = ConfigItem( 91 | "Search", "cookie", "" 92 | ) 93 | 94 | # Personalize 95 | language = OptionsConfigItem( 96 | "Personalize", "Language", Language.CHINESE_SIMPLIFIED, OptionsValidator(Language), LanguageSerializer(), restart=True) 97 | micaEnabled = ConfigItem("Personalize", "MicaEnabled", platform == 'win32' and getwindowsversion().build >= 22000, BoolValidator()) 98 | themeMode = OptionsConfigItem( 99 | "Personalize", "ThemeMode", Theme.LIGHT, OptionsValidator(Theme), EnumSerializer(Theme)) 100 | themeColor = ColorConfigItem("Personalize", "ThemeColor", GetDefaultThemeColor()) 101 | 102 | #BetaOnly 103 | toast = ConfigItem( 104 | "BetaOnly", "toast", False, BoolValidator()) 105 | PluginEnable = ConfigItem( 106 | "BetaOnly", "EnablePlugins", False, BoolValidator(), restart=True) 107 | debug_card = ConfigItem( 108 | "BetaOnly", "debug_card", False, BoolValidator(), restart=True) 109 | 110 | cfg = Config() 111 | qconfig.load(configpath, cfg) 112 | 113 | class Plufig(Config): 114 | apicard = OptionsConfigItem( 115 | "Search", "apicard", "NCMA", OptionsValidator(get_all_api(folders_arg=cfg.PluginFolders.value))) 116 | 117 | pfg = Plufig() 118 | qconfig.load(configpath, pfg) -------------------------------------------------------------------------------- /helper/downloadHelper.py: -------------------------------------------------------------------------------- 1 | import json, AZMusicAPI 2 | from PyQt5.QtCore import QThread 3 | from PyQt5.QtCore import pyqtSignal, pyqtSlot 4 | import requests, os 5 | from mutagen.easyid3 import EasyID3 6 | from helper.config import cfg, pfg 7 | from helper.getvalue import get_download_playlist_song, get_download_search_song 8 | from helper.flyoutmsg import dlsuc, dlerr, dlwar 9 | from win11toast import toast 10 | 11 | from helper.loggerHelper import logger 12 | from helper.pluginHelper import plugins_api_items 13 | 14 | thread = None 15 | 16 | 17 | class downloading(QThread): 18 | finished = pyqtSignal(str) 19 | 20 | def __init__(self, howto): 21 | super().__init__() 22 | self.howto = howto 23 | 24 | @pyqtSlot() 25 | def run(self): 26 | musicpath = cfg.get(cfg.downloadFolder) 27 | if self.howto == "search": 28 | data = get_download_search_song() 29 | elif self.howto == "playlist": 30 | data = get_download_playlist_song() 31 | 32 | id = data["id"] 33 | if pfg.apicard.value == "NCMA" or pfg.apicard.value == "QQMA": 34 | api = data["api"] 35 | song = data["song"] 36 | singer = data["singer"] 37 | 38 | if pfg.apicard.value == "QQMA" and self.howto == "search": 39 | url = AZMusicAPI.geturl(id=id, api=api, server="qqma") 40 | elif pfg.apicard.value == "NCMA" and self.howto == "search": 41 | url = AZMusicAPI.geturl(id=id, api=api, cookie=cfg.cookie.value, level=cfg.level.value.value) 42 | elif self.howto == "search": 43 | try: 44 | api_plugin = plugins_api_items[pfg.apicard.value] 45 | url = api_plugin.geturl(id=id) 46 | except Exception as e: 47 | url = "PluginAPIImportError" 48 | error_msg = e 49 | else: 50 | url = AZMusicAPI.geturl(id=id, api=api, cookie=cfg.cookie.value, level=cfg.level.value.value) 51 | if url == "Error 3": 52 | self.show_error = "Error 3" 53 | self.finished.emit("Error") 54 | elif url == "Error 4": 55 | self.show_error = "Error 4" 56 | self.finished.emit("Error") 57 | elif url == "NetworkError": 58 | self.show_error = "NetworkError" 59 | self.finished.emit("Error") 60 | elif url == "PluginAPIImportError": 61 | self.show_error = "PluginAPIImportError" 62 | if cfg.debug_card.value: 63 | logger.error(f"插件错误:{error_msg}") 64 | self.finished.emit("Error") 65 | 66 | if not "Error" in url: 67 | response = requests.get(url, stream=True) 68 | file_size = int(response.headers.get('content-length', 0)) 69 | chunk_size = file_size // 100 70 | if ".mp3" in url: 71 | endName = "mp3" 72 | elif ".acc" in url: 73 | endName = "acc" 74 | elif ".flac" in url: 75 | endName = "flac" 76 | elif ".wav" in url: 77 | endName = "wav" 78 | elif ".m4a" in url: 79 | endName = "m4a" 80 | else: 81 | endName = "mp3" 82 | path = "{}\\{} - {}.{}".format(musicpath, singer, song, endName) 83 | with open(path, 'wb') as f: 84 | for chunk in response.iter_content(chunk_size=chunk_size): 85 | f.write(chunk) 86 | downloaded_bytes = f.tell() 87 | progress = downloaded_bytes * 100 // file_size 88 | if downloaded_bytes % chunk_size == 0: 89 | self.finished.emit(str(progress)) 90 | 91 | self.finished.emit(str(200)) 92 | 93 | 94 | class show_toast(QThread): 95 | def __init__(self, content, path, musicpath): 96 | super().__init__() 97 | self.content = content 98 | self.path = path 99 | self.musicpath = musicpath 100 | 101 | def run(self): 102 | buttons = [ 103 | {'activationType': 'protocol', 'arguments': self.path, 'content': '播放'}, 104 | {'activationType': 'protocol', 'arguments': self.musicpath, 'content': '打开文件夹'}] 105 | 106 | toast('AZMusicDownloader', self.content, buttons=buttons) 107 | 108 | 109 | class download(QThread): 110 | def __init__(self, progress, table, progressbar, songdata, dworker, button, parent, howto): 111 | self.progress = progress 112 | self.table = table 113 | self.progressbar = progressbar 114 | self.songdata = songdata 115 | self.dworker = dworker 116 | self.button = button 117 | self.parent = parent 118 | self.howto = howto 119 | self.run() 120 | 121 | def run(self): 122 | musicpath = cfg.get(cfg.downloadFolder) 123 | if self.progress == "200": 124 | self.progressbar.setValue(100) 125 | 126 | if self.howto == "search": 127 | row = self.table.currentIndex().row() 128 | try: 129 | data = self.songdata[row] 130 | except: 131 | dlwar(outid=2, parent=self.parent) 132 | return 0 133 | 134 | song_id = data["id"] 135 | song = data["name"] 136 | singer = data["artists"] 137 | album = data["album"] 138 | self.dworker.quit() 139 | elif self.howto == "lists": 140 | data = get_download_playlist_song() 141 | song = data["song"] 142 | singer = data["singer"] 143 | album = data["album"] 144 | 145 | self.table.clearSelection() 146 | self.button.setEnabled(False) 147 | path = "{}\\{} - {}.mp3".format(musicpath, singer, song) 148 | path = os.path.abspath(path) 149 | 150 | audio = EasyID3(path) 151 | audio['title'] = song 152 | audio['album'] = album 153 | audio["artist"] = singer 154 | audio.save() 155 | 156 | self.progressbar.setHidden(True) 157 | text = '音乐下载完成!\n歌曲名:{}\n艺术家:{}\n保存路径:{}'.format(song, singer, path) 158 | dlsuc(content=text, parent=self.parent) 159 | if cfg.toast.value: 160 | global thread 161 | thread = show_toast(content=text, path=path, musicpath=musicpath) 162 | thread.start() 163 | #thread.wait() 164 | thread.finished.connect(thread.quit) 165 | 166 | elif self.progress == "Error": 167 | error = self.dworker.show_error 168 | self.dworker.quit() 169 | self.progressbar.setHidden(True) 170 | self.button.setEnabled(False) 171 | self.table.clearSelection() 172 | 173 | if error == "Error 3": 174 | dlerr(outid=7, parent=self.parent) 175 | elif error == "Error 4": 176 | dlerr(outid=8, parent=self.parent) 177 | elif error == "NetworkError": 178 | dlerr(outid=6, parent=self.parent) 179 | elif error == "PluginAPIImportError": 180 | dlerr(9, self.parent) 181 | else: 182 | self.progressbar.setValue(int(self.progress)) 183 | -------------------------------------------------------------------------------- /helper/flyoutmsg.py: -------------------------------------------------------------------------------- 1 | from sys import exit 2 | 3 | from PyQt5.QtCore import Qt, QUrl 4 | from PyQt5.QtGui import QDesktopServices 5 | from qfluentwidgets import FluentIcon as FIF 6 | from qfluentwidgets import InfoBar, InfoBarPosition, InfoBarIcon 7 | from qfluentwidgets import PushButton, PrimaryPushButton, FlyoutView, Flyout 8 | 9 | from helper.getvalue import outputlist, verdetail, VERSION, RELEASE_URL, AZ_URL 10 | 11 | 12 | def getoutputvalue(outid): 13 | try: 14 | out=outputlist[int(outid)] 15 | except: 16 | out=outid 17 | return out 18 | 19 | def changelog(parent): 20 | view = FlyoutView( 21 | title=f'AZMusicDownloader {VERSION}更新日志 ', 22 | content=verdetail, 23 | #image='resource/splash.png', 24 | isClosable=True 25 | ) 26 | 27 | # add button to view 28 | button1 = PushButton(FIF.GITHUB, 'GitHub') 29 | button1.setFixedWidth(120) 30 | button1.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(RELEASE_URL))) 31 | view.addWidget(button1, align=Qt.AlignRight) 32 | 33 | button2 = PushButton('AZ Studio') 34 | button2.setFixedWidth(120) 35 | button2.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(AZ_URL))) 36 | view.addWidget(button2, align=Qt.AlignRight) 37 | 38 | button3 = PrimaryPushButton('检查更新') 39 | button3.setFixedWidth(120) 40 | button3.clicked.connect(parent.upworker.start) 41 | view.addWidget(button3, align=Qt.AlignRight) 42 | 43 | # adjust layout (optional) 44 | view.widgetLayout.insertSpacing(1, 5) 45 | view.widgetLayout.addSpacing(5) 46 | 47 | # show view 48 | w = Flyout.make(view, parent.aboutCard, parent) 49 | view.closed.connect(w.close) 50 | 51 | def dlsuc(parent, content, title="", show_time=3000): 52 | # convenient class mothod 53 | InfoBar.success( 54 | title=title, 55 | content=content, 56 | orient=Qt.Horizontal, 57 | isClosable=True, 58 | position=InfoBarPosition.TOP, 59 | duration=show_time, 60 | parent=parent) 61 | 62 | 63 | def dlerr(outid, parent, title="错误", show_time=3000): 64 | InfoBar.error( 65 | title=title, 66 | content=getoutputvalue(outid=outid), 67 | orient=Qt.Horizontal, 68 | isClosable=True, 69 | position=InfoBarPosition.TOP, 70 | duration=show_time, 71 | parent=parent) 72 | 73 | 74 | def dlwar(outid, parent, title="警告", show_time=3000): 75 | InfoBar.warning( 76 | title=title, 77 | content=getoutputvalue(outid=outid), 78 | orient=Qt.Horizontal, 79 | isClosable=True, 80 | position=InfoBarPosition.TOP, 81 | duration=show_time, 82 | parent=parent) 83 | 84 | 85 | def flyout_bottom(parent, title, content, button_content, button_todo, duration=3000): 86 | w = InfoBar( 87 | icon=InfoBarIcon.INFORMATION, 88 | title=title, 89 | content=content, 90 | orient=Qt.Vertical, 91 | isClosable=True, 92 | position=InfoBarPosition.BOTTOM_RIGHT, 93 | duration=duration, 94 | parent=parent 95 | ) 96 | 97 | s = PushButton(button_content) 98 | w.addWidget(s) 99 | s.clicked.connect(button_todo) 100 | w.show() 101 | 102 | def restart(parent): 103 | w = InfoBar.warning( 104 | title='', 105 | content='设置需要重启程序后生效', 106 | orient=Qt.Vertical, 107 | position=InfoBarPosition.TOP_RIGHT, 108 | duration=3000, 109 | parent=parent 110 | ) 111 | s = PushButton("立即关闭应用程序") 112 | w.addWidget(s) 113 | s.clicked.connect(lambda: exit(0)) 114 | w.show() 115 | 116 | def setOK(parent, howto="settings"): 117 | if howto == "settings": 118 | content = '设置已保存' 119 | time = 1500 120 | elif howto == "playlists": 121 | content = "导入任务已提交!稍等片刻,歌单就会出现在列表中。" 122 | time = 2500 123 | InfoBar.success( 124 | '', 125 | content, 126 | parent=parent, 127 | duration=time 128 | ) -------------------------------------------------------------------------------- /helper/getvalue.py: -------------------------------------------------------------------------------- 1 | from datetime import date 2 | from random import randint 3 | from PyQt5.QtCore import QStandardPaths 4 | import ctypes 5 | 6 | config_path_value = QStandardPaths.writableLocation(QStandardPaths.AppDataLocation) 7 | allpath = "{}\\AZMusicDownload".format(config_path_value) 8 | playlistpath = "{}\\playlists.json".format(allpath) 9 | 10 | configpath = "{}\\config.json".format(allpath) 11 | upurl = "https://json.zenglingkun.cn/update/md/index.json" 12 | 13 | music_path_value = QStandardPaths.writableLocation(QStandardPaths.MusicLocation) 14 | autopath = "{}\\AZMusicDownload".format(music_path_value) 15 | localView = None 16 | 17 | autoncmaapi = "https://md.azteam.cn/" # API为ncma的克隆项目 18 | autoqqmaapi = "" 19 | apilists = ['NCMA', 'QQMA'] 20 | playlistSong = "" 21 | searchSong = "" 22 | download_search_song = "" 23 | download_playlist_song = "" 24 | 25 | # 古诗 26 | poem = ["天阶夜色凉如水,卧看牵牛织女星。", 27 | "唯有门前镜湖水,春风不改旧时波。", 28 | "三更灯火五更鸡,正是男儿读书时。", 29 | "但屈指西风几时来,又不道流年暗中偷换。", 30 | "俱往矣,数风流人物,还看今朝。", 31 | "水是眼波横,山是眉峰聚。", 32 | "明年此日青云去,却笑人间举子忙。", 33 | "衰兰送客咸阳道,天若有情天亦老。", 34 | "昔去雪如花,今来花似雪。", 35 | "青青子衿,悠悠我心。", 36 | "执子之手,与子偕老。", 37 | "老来情味减,对别酒、怯流年。", 38 | "什么是时光?我们穿上的衣服,却再也脱不下来。", 39 | "但行好事,莫问前程。", 40 | "吾道本无我,未曾嫌世人。如今到尘世,弥觉此心真", 41 | "去年今日此门中,人面桃花相映红。", 42 | "似花还似非花,也无人惜从教坠。", 43 | "墙外行人,墙里佳人笑。", 44 | "海内存知己,天涯若比邻。", 45 | "七八个星天外,两三点雨山前。"] 46 | 47 | 48 | def outapoem(): 49 | outpoem = poem[randint(0, len(poem) - 1)] 50 | return outpoem 51 | 52 | 53 | def GetDefaultThemeColor(): 54 | dwmapi = ctypes.windll.dwmapi 55 | color = ctypes.c_ulong() 56 | opaque = ctypes.c_bool() 57 | 58 | # Call DwmGetColorizationColor 59 | result = dwmapi.DwmGetColorizationColor(ctypes.byref(color), ctypes.byref(opaque)) 60 | 61 | if result == 0: # S_OK 62 | # Extract the color components (ARGB format) 63 | alpha = (color.value >> 24) & 0xFF 64 | red = (color.value >> 16) & 0xFF 65 | green = (color.value >> 8) & 0xFF 66 | blue = color.value & 0xFF 67 | 68 | return (f"#{red:02X}{green:02X}{blue:02X}") 69 | else: 70 | return ("#0078D4") 71 | 72 | 73 | # 错误内容列表 74 | outputlist = ['未搜索到相关的歌曲,换个关键词试试吧', 75 | '你还没有输入噢', 76 | '您选中的行无数据', 77 | '音乐下载路径无法读取\创建失败', 78 | "未配置NeteaseCloudMusicApi地址", 79 | "未配置QQMusicApi地址", 80 | '您可能是遇到了以下其一问题:网络错误 / 服务器宕机 / IP被封禁', 81 | '这首歌曲无版权,暂不支持下载', 82 | '获取链接失败,建议检查API服务器是否配置了账号Cookie', 83 | '插件未成功导入,请检查插件'] 84 | 85 | verdetail = "1.修复API及部分网址\n2.支持设置下载音质(但好像上游API返回的都是普通音质?)\n3.优化搜索UI\n4.修复我的音乐库自动刷新\5.窗口自动适配屏幕分辨率" 86 | 87 | audio_quality_list = [ 88 | "标准", 89 | "较高", 90 | "极高", 91 | "无损", 92 | "Hi-Res", 93 | "高清环绕声", 94 | "沉浸环绕声", 95 | "超清母带" 96 | ] 97 | 98 | # 全局变量处理 99 | def get_download_search_song(): 100 | global download_search_song 101 | return download_search_song 102 | 103 | def set_download_search_song(value): 104 | global download_search_song 105 | download_search_song=value 106 | 107 | def get_download_playlist_song(): 108 | global download_playlist_song 109 | return download_playlist_song 110 | 111 | def set_download_playlist_song(value): 112 | global download_playlist_song 113 | download_playlist_song=value 114 | 115 | 116 | YEAR = int(date.today().year) 117 | AUTHOR = "AZ Studio" 118 | VERSION = "2.8.0" 119 | UPDATE_ORDER = 16 120 | HELP_URL = "https://md.azteam.cn/docs/" 121 | FEEDBACK_URL = "https://github.com/AZ-Studio-2023/AZMusicDownloader/issues" 122 | RELEASE_URL = "https://github.com/AZ-Studio-2023/AZMusicDownloader/releases/tag/v2.8.0" 123 | AZ_URL = "https://azteam.cn/" 124 | PLU_URL = "https://plugins.md.azprod.cn/" 125 | SERVER_URL = "https://www.lcyidc.com/" 126 | -------------------------------------------------------------------------------- /helper/inital.py: -------------------------------------------------------------------------------- 1 | import json, requests, webbrowser 2 | from PyQt5.QtCore import pyqtSignal, pyqtSlot, QThread 3 | from os import path, mkdir, remove, chdir 4 | import os 5 | from json import loads 6 | from helper.flyoutmsg import dlsuc, dlwar, flyout_bottom 7 | from helper.getvalue import outapoem 8 | from PyQt5.QtCore import QThread 9 | from helper.config import cfg 10 | from qfluentwidgets import isDarkTheme 11 | from helper.getvalue import configpath, upurl, VERSION, playlistpath, UPDATE_ORDER, allpath 12 | from subprocess import Popen 13 | 14 | 15 | # 初始化创建文件 16 | def mkf(): 17 | dlpath = cfg.get(cfg.downloadFolder) 18 | if not path.exists(allpath): 19 | mkdir(allpath) 20 | if not path.exists(dlpath): 21 | mkdir(dlpath) 22 | if not path.exists(playlistpath): 23 | chdir(allpath) 24 | w = open("playlists.json", 'w') 25 | w.write(json.dumps([])) 26 | w.close() 27 | 28 | 29 | # 删除用户数据 30 | def delfin(IfMusicPath=False): 31 | if path.exists(configpath): 32 | remove(configpath) 33 | if IfMusicPath: 34 | downloadFolder = cfg.get(cfg.downloadFolder) 35 | if path.exists(downloadFolder): 36 | remove(downloadFolder) 37 | 38 | 39 | # 检查更新 40 | def getup(): 41 | url = upurl 42 | try: 43 | ud = requests.get(url).text 44 | data = loads(ud) 45 | msg = data 46 | except: 47 | poem = "在等待的过程中,来读句古诗词吧:" + outapoem() 48 | ud = {"latest": "0.0.0", "title": "(⊙o⊙)?", 49 | "text": "呀!获取不到更新数据了 >﹏< 请检查您的网络连接\n{}".format(poem), "time": 200000, 50 | "button": "(;´д`)ゞ", "link": "https://azstudio.net.cn"} 51 | msg = ud 52 | return msg 53 | 54 | 55 | class get_update(QThread): 56 | finished = pyqtSignal(dict) 57 | 58 | @pyqtSlot() 59 | def run(self): 60 | data = getup() 61 | self.finished.emit(data) 62 | 63 | 64 | def showup(parent, updata, upworker): 65 | up = updata 66 | if not VERSION == up["latest"] and up["latest"] != "0.0.0": 67 | if UPDATE_ORDER < up["update_order"]: 68 | # 等级可为:normal(普通的),important(重要的),fix(修复版),special(特殊意义版) 69 | if up["level"] == "normal": 70 | text = "我们检测到了新的版本,版本号:{}\n本次更新为日常版本迭代,更新了新功能,可选择性进行更新。".format( 71 | str(up["latest"])) 72 | dlwar("检测到有新版本 {} ,本次更新为日常版本迭代,可选择进行更新。".format(str(up["latest"])), 73 | parent, title="更新提示", show_time=up["flag_time"]) 74 | elif up["level"] == "important": 75 | text = "我们检测到了新的版本,版本号:{}\n本次更新为重要版本迭代,修复了Bug,更新了新功能,强烈建议进行更新。".format( 76 | str(up["latest"])) 77 | dlwar("检测到有新版本 {} ,本次更新为重要版本迭代,强烈建议进行更新。".format(str(up["latest"])), 78 | parent, title="更新提示", show_time=up["flag_time"]) 79 | elif up["level"] == "fix": 80 | text = "我们检测到了新的版本,版本号:{}\n本次更新为Bug修复版本,修复了重大Bug,强烈建议进行更新。".format( 81 | str(up["latest"])) 82 | dlwar("检测到有新版本 {} ,本次更新为Bug修复版本,强烈建议进行更新。".format(str(up["latest"])), 83 | parent, title="更新提示", show_time=up["flag_time"]) 84 | elif up["level"] == "special": 85 | text = "我们检测到了新的版本,版本号:{}\n{}".format( 86 | str(up["latest"]), up["special"]) 87 | dlwar("检测到有新版本 {} \n{}".format(str(up["latest"]), up["special"]), 88 | parent, title="更新提示", show_time=up["flag_time"]) 89 | else: 90 | text = "我们检测到了新的版本,版本号:{}\n本次更新类型未知,可能是后续版本的新更新类型。".format( 91 | str(up["latest"])) 92 | dlwar("检测到有新版本 {} ,本次更新类型未知,可能是后续版本的新更新类型。".format(str(up["latest"])), 93 | parent, title="更新提示", show_time=up["flag_time"]) 94 | flyout_bottom(parent=parent, title="有新版本可用", content=text, button_content=up["button"], 95 | button_todo=lambda: webbrowser.open_new_tab(up["link"]), duration=up["time"]) 96 | elif UPDATE_ORDER > up["update_order"]: 97 | dlsuc(content="您正在使用测试版本", parent=parent, title="提示", show_time=5000) 98 | else: 99 | dlsuc(content="您使用的版本是最新版本", parent=parent, title="恭喜", show_time=5000) 100 | elif up["latest"] == "0.0.0": 101 | flyout_bottom(parent=parent, title=up["title"], content=up["text"], button_content=up["button"], 102 | button_todo=lambda: webbrowser.open_new_tab(up["link"]), duration=up["time"]) 103 | else: 104 | dlsuc(content="您使用的版本是最新版本", parent=parent, title="恭喜", show_time=5000) 105 | upworker.quit() 106 | 107 | 108 | # qss设置 109 | def setSettingsQss(parent, which="setting_interface"): 110 | theme = 'dark' if isDarkTheme() else 'light' 111 | with open(f'resource/qss/{theme}/{which}.qss', encoding='utf-8') as f: 112 | parent.setStyleSheet(f.read()) 113 | -------------------------------------------------------------------------------- /helper/localmusicsHelper.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | from os import listdir 3 | from os.path import join, isfile 4 | 5 | from PyQt5.QtWidgets import QTableWidgetItem 6 | from mutagen.easyid3 import EasyID3 7 | from mutagen.id3 import ID3NoHeaderError 8 | 9 | from helper.inital import mkf 10 | 11 | mkf() 12 | 13 | oldIn = [] 14 | 15 | def get_all_music(path): 16 | all_music = [] 17 | for file_name in listdir(path): 18 | file_path = f"{path}\{file_name}" 19 | if isfile(file_path): 20 | all_music.append(file_name) 21 | return all_music 22 | 23 | 24 | def ref(musicpath, local_view=None): 25 | global localView, oldIn 26 | if local_view: 27 | localView = local_view 28 | if not local_view: 29 | local_view = localView 30 | 31 | data = get_all_music(path=musicpath) 32 | if data == oldIn: 33 | return 34 | else: 35 | oldIn = data 36 | local_view.clear() 37 | local_view.setHorizontalHeaderLabels(['文件名', '歌曲名', '艺术家', '专辑']) 38 | songInfos = [] 39 | for stand in data: 40 | path = join(musicpath, stand) 41 | try: 42 | audio = EasyID3(path) 43 | except ID3NoHeaderError: 44 | continue 45 | songinfo = [stand] 46 | try: 47 | songinfo.append(audio['title'][0]) 48 | except KeyError: 49 | songinfo.append("Unknown") 50 | try: 51 | songinfo.append(audio['artist'][0]) 52 | except KeyError: 53 | songinfo.append("Unknown") 54 | try: 55 | songinfo.append(audio['album'][0]) 56 | except KeyError: 57 | songinfo.append("Unknown") 58 | songInfos.append(songinfo) 59 | 60 | local_view.setRowCount(len(songInfos)) 61 | 62 | for i, songInfo in enumerate(songInfos): 63 | for j, info in enumerate(songInfo): 64 | local_view.setItem(i, j, QTableWidgetItem(info)) 65 | 66 | 67 | def openthemusic(filepath): 68 | global localView 69 | row = localView.currentIndex().row() 70 | data = get_all_music(path=filepath) 71 | name = data[row] 72 | file_path = join(filepath, name) 73 | cmd = f'start "" "{file_path}"' 74 | localView.clearSelection() 75 | subprocess.Popen(cmd, shell=True) 76 | -------------------------------------------------------------------------------- /helper/loggerHelper.py: -------------------------------------------------------------------------------- 1 | import logging, colorlog 2 | from helper.config import cfg 3 | 4 | 5 | # logger日志 6 | def get_logger(level=logging.INFO): 7 | # 创建logger对象 8 | logger = logging.getLogger() 9 | logger.setLevel(level) 10 | console_handler = logging.StreamHandler() 11 | console_handler.setLevel(level) 12 | 13 | # 定义颜色输出格式 14 | color_formatter = colorlog.ColoredFormatter( 15 | '%(asctime)s - %(log_color)s[%(levelname)s]: %(message)s', 16 | log_colors={ 17 | 'DEBUG': 'cyan', 18 | 'INFO': 'green', 19 | 'WARNING': 'yellow', 20 | 'ERROR': 'red', 21 | 'CRITICAL': 'red,bg_white', 22 | }, 23 | datefmt='%Y-%m-%d %H:%M:%S' 24 | ) 25 | console_handler.setFormatter(color_formatter) 26 | 27 | # 修改Handler 28 | for handler in logger.handlers: 29 | logger.removeHandler(handler) 30 | logger.addHandler(console_handler) 31 | return logger 32 | 33 | 34 | if cfg.debug_card.value: 35 | logger = get_logger(logging.DEBUG) 36 | else: 37 | logger = get_logger() 38 | -------------------------------------------------------------------------------- /helper/playlistHelper.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | import requests 5 | from PyQt5.QtCore import QThread 6 | from PyQt5.QtCore import pyqtSignal, pyqtSlot 7 | from PyQt5.QtWidgets import QTableWidgetItem 8 | 9 | from helper.config import cfg 10 | from helper.flyoutmsg import dlerr, dlwar 11 | from helper.getvalue import playlistSong, playlistpath, set_download_playlist_song 12 | 13 | api = cfg.ncma_api.value 14 | 15 | class getlist(QThread): 16 | finished = pyqtSignal() 17 | 18 | @pyqtSlot() 19 | def run(self): 20 | data = playlistSong 21 | type_value = data["type_value"] 22 | value = data["value"] 23 | api_value = data["api_value"] 24 | keywords = value 25 | if type_value == "用户": 26 | api_v = api_value + "user/playlist" 27 | params = {"uid": str(value)} 28 | data = requests.get(api_v, params=params).json() 29 | data = data["playlist"] 30 | for playlist in data: 31 | id_v = playlist["id"] 32 | api_v = api_value + "playlist/detail" 33 | params = {"id": id_v} 34 | data_y = requests.get(api_v, params=params).json() 35 | data = data_y["playlist"] 36 | if data_y["code"] != 400: 37 | name = data["name"] 38 | data = data["tracks"] 39 | f = open(playlistpath, "r", encoding='utf-8') 40 | old_data = json.loads(f.read()) 41 | f.close() 42 | data_v = [] 43 | try: 44 | for i in range(len(data)): 45 | artists = "" 46 | for y in range(len(data[i]["ar"])): 47 | if y != 0: 48 | artists = artists + "," 49 | artists = artists + data[i]["ar"][y]["name"] 50 | data_v.append({"id": data[i]['id'], "name": data[i]['name'], "artists": artists, 51 | "album": data[i]['al']["name"]}) 52 | except: 53 | data_v.append({"id": '-1', "name": 'error', "artists": 'error', 54 | "album": 'error'}) 55 | old_data.append({"id": id_v, "name": name, "data": data_v}) 56 | f = open(playlistpath, "w", encoding='utf-8') 57 | f.write(json.dumps(old_data)) 58 | f.close() 59 | else: 60 | id_v = value 61 | api_v = api_value + "playlist/detail" 62 | params = {"id": id_v} 63 | data_y = requests.get(api_v, params=params).json() 64 | data = data_y["playlist"] 65 | 66 | if data_y["code"] == 200: 67 | name = data["name"] 68 | data = data["tracks"] 69 | data_v = [] 70 | f = open(playlistpath, "r", encoding='utf-8') 71 | old_data = json.loads(f.read()) 72 | f.close() 73 | try: 74 | for i in range(len(data)): 75 | artists = "" 76 | for y in range(len(data[i]["ar"])): 77 | if y != 0: 78 | artists = artists + "," 79 | artists = artists + data[i]["ar"][y]["name"] 80 | data_v.append({"id": data[i]['id'], "name": data[i]['name'], "artists": artists, 81 | "album": data[i]['al']["name"]}) 82 | except: 83 | data_v.append({"id": '-1', "name": 'error', "artists": 'error', 84 | "album": 'error'}) 85 | old_data.append({"id": id_v, "name": name, "data": data_v}) 86 | f = open(playlistpath, "w", encoding='utf-8') 87 | f.write(json.dumps(old_data)) 88 | f.close() 89 | self.finished.emit() 90 | 91 | 92 | def FindLists(TableWidget): 93 | data = get_playlists() 94 | TableWidget.setRowCount(len(data)) 95 | TableWidget.clearContents() 96 | 97 | for i in range(len(data)): 98 | data_v = [] 99 | data_v.append(str(i + 1)) 100 | data_v.append(data[i]) 101 | for j in range(2): 102 | TableWidget.setItem(i, j, QTableWidgetItem(data_v[j])) 103 | 104 | 105 | def searchstart(PushButton, lworker, ComboBox, LineEdit, parent): 106 | global playlistSong 107 | if LineEdit.text() != '': 108 | PushButton.setEnabled(False) 109 | # self.getlist_worker.started.connect( 110 | # lambda: self.lworker.run(type_value=self.ComboBox.text(), value=self.LineEdit.text(), api_value=api)) 111 | playlistSong = {"type_value": ComboBox.text(), "value": LineEdit.text(), "api_value": api} 112 | lworker.start() 113 | else: 114 | dlerr(outid=1, parent=parent) 115 | 116 | 117 | def music(TableWidget, TableWidget_2, Button, parent): 118 | try: 119 | name = get_playlists()[TableWidget.currentIndex().row()] 120 | with open(playlistpath, 'r', encoding='utf-8') as f: 121 | playlist = json.load(f) 122 | for item in playlist: 123 | if item.get('name') == name: 124 | data = item['data'] 125 | TableWidget_2.clearContents() 126 | TableWidget_2.setRowCount(len(data)) 127 | 128 | #All = [] 129 | for i in range(len(data)): 130 | #add = [] 131 | id_v = str(data[i]["id"]) 132 | name_v = str(data[i]["name"]) 133 | artists_v = str(data[i]["artists"]) 134 | album_v = str(data[i]["album"]) 135 | 136 | TableWidget_2.setItem(i, 0, QTableWidgetItem(id_v)) 137 | TableWidget_2.setItem(i, 1, QTableWidgetItem(name_v)) 138 | TableWidget_2.setItem(i, 2, QTableWidgetItem(artists_v)) 139 | TableWidget_2.setItem(i, 3, QTableWidgetItem(album_v)) 140 | 141 | TableWidget_2.resizeColumnsToContents() 142 | Button.setText(name) 143 | except: 144 | dlerr(outid=2, parent=parent) 145 | 146 | 147 | def search(lworker, TableWidget): 148 | data = get_playlists() 149 | TableWidget.setRowCount(len(data)) 150 | TableWidget.clearContents() 151 | 152 | for i in range(len(data)): 153 | data_v = [] 154 | data_v.append(str(i + 1)) 155 | data_v.append(data[i]) 156 | for j in range(2): 157 | TableWidget.setItem(i, j, QTableWidgetItem(data_v[j])) 158 | 159 | TableWidget.resizeColumnsToContents() 160 | lworker.quit() 161 | 162 | 163 | def rundownload(PushButton_2, pro_bar, TableWidget_2, parent, dworker): 164 | PushButton_2.setEnabled(False) 165 | pro_bar.setValue(0) 166 | pro_bar.setHidden(False) 167 | 168 | try: 169 | row = TableWidget_2.currentIndex().row() 170 | id_v = str(TableWidget_2.item(row, 0).text()) 171 | except AttributeError: 172 | TableWidget_2.clearSelection() 173 | PushButton_2.setEnabled(False) 174 | dlwar(outid=2, parent=parent) 175 | pro_bar.setHidden(True) 176 | return 0 177 | 178 | if id_v != "": 179 | song_id = id_v 180 | song = str(TableWidget_2.item(row, 1).text()) 181 | singer = str(TableWidget_2.item(row, 2).text()) 182 | album = str(TableWidget_2.item(row, 3).text()) 183 | 184 | try: 185 | if os.path.exists(cfg.get(cfg.downloadFolder)) == False: 186 | os.mkdir(cfg.get(cfg.downloadFolder)) 187 | except: 188 | dlerr(outid=3, parent=parent) 189 | return 0 190 | 191 | # self.download_worker.started.connect( 192 | # lambda: self.dworker.run(id=song_id, api=api, song=song, singer=singer)) 193 | set_download_playlist_song(value={"id": song_id, "api": api, "song": song, "singer": singer, "album": album}) 194 | dworker.start() 195 | else: 196 | TableWidget_2.clearSelection() 197 | PushButton_2.setEnabled(False) 198 | dlwar(outid=2, parent=parent) 199 | 200 | 201 | def get_playlists(): 202 | with open(playlistpath, 'r', encoding='utf-8') as f: 203 | playlist = json.load(f) 204 | names = [item['name'] for item in playlist] 205 | return names 206 | -------------------------------------------------------------------------------- /helper/pluginHelper.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | import importlib, sys, json, os 3 | from qfluentwidgets import SwitchSettingCard, PushSettingCard 4 | from helper.config import cfg 5 | from helper.flyoutmsg import dlerr 6 | from helper.loggerHelper import logger 7 | from qfluentwidgets import FluentIcon as FIF 8 | 9 | plugins_items = {} 10 | plugins_api_items = {} 11 | folders = cfg.PluginFolders.value 12 | 13 | 14 | def get_folders(directory): 15 | folders = [] 16 | for item in os.listdir(directory): 17 | item_path = os.path.join(directory, item) 18 | if os.path.isdir(item_path): 19 | folders.append(item) 20 | return folders 21 | 22 | 23 | def load_plugins(parent): 24 | global plugins_items 25 | global plugins_api_items 26 | # 遍历插件目录中的文件 27 | num = 0 28 | if cfg.debug_card.value: 29 | logger.info("开始导入插件") 30 | for dirname in folders: 31 | sys.path.append(dirname) 32 | for filename in os.listdir(dirname): 33 | last_path = os.path.basename(dirname) 34 | if filename.endswith('.py') and os.path.exists(dirname) and os.path.exists( 35 | dirname + "/index.json") and filename.replace(".py", "") == last_path and not os.path.exists( 36 | dirname + "/plugin.lock"): 37 | plugin_name = filename[:-3] 38 | module_name = f"{plugin_name}" 39 | try: 40 | module = importlib.import_module(module_name) 41 | plugin_class = getattr(module, plugin_name) 42 | u = open(dirname + "/index.json", encoding='utf-8') 43 | data = json.loads(u.read()) 44 | u.close() 45 | if data["type"] == "api": 46 | plugins_api_items[data["name"]] = plugin_class() 47 | plugins_items[plugin_name] = plugin_class() 48 | if cfg.debug_card.value: 49 | logger.info(f"导入插件: {data['name']}") 50 | num = num + 1 51 | except Exception as e: 52 | logger.error(f"导入{plugin_name}插件错误: {e}") 53 | #if cfg.debug_card.value: 54 | # print("添加Plugins中的API") 55 | #get_all_api() 56 | if cfg.debug_card.value: 57 | logger.info(f"成功导入了{str(num)}个插件") 58 | 59 | 60 | def run_plugins(parent): 61 | global plugins_items 62 | num = 0 63 | for plugin_name, plugin_instance in plugins_items.items(): 64 | folder = folders[num] 65 | num = num + 1 66 | get_v = open(f"{folder}/index.json", "r", encoding="utf-8") 67 | data = json.loads(get_v.read()) 68 | get_v.close() 69 | if data["type"] == "Bar" and os.path.basename(folder) == plugin_name: 70 | #icon = f'plugins/{plugin_name}/{data["icon"]}' 71 | icon = data["show_icon"] 72 | #icon = "resource/logo.png" 73 | name = data["name"] 74 | if cfg.debug_card.value: 75 | logger.info(f"将插件添加至导航栏: {data['name']}") 76 | exec(f"parent.addSubInterface(plugin_instance, {icon}, '{name}')") 77 | 78 | 79 | def set_plugin_disable(folder, state): 80 | if not state: 81 | w = open(f"{folder}/plugin.lock", "w") 82 | w.close() 83 | else: 84 | if os.path.exists(f"{folder}/plugin.lock"): 85 | os.remove(f"{folder}/plugin.lock") 86 | 87 | 88 | def run_plugins_plugin(parent, PluginsGroup): 89 | folders = cfg.PluginFolders.value 90 | for folder in folders: 91 | if os.path.exists(folder + "/index.json"): 92 | get_json = open(f"{folder}/index.json", "r", encoding="utf-8") 93 | data = json.loads(get_json.read()) 94 | get_json.close() 95 | if os.path.exists(data["icon"]): 96 | icon = data["icon"] 97 | else: 98 | icon = os.path.join(folder, data["icon"]) 99 | addCard(parent, PluginsGroup, icon, data["name"], data["desc"], data["type"], folder) 100 | 101 | 102 | def open_plugin_window(plugin, parent): 103 | try: 104 | plugin_name = os.path.basename(plugin) 105 | new = plugins_items[plugin_name] 106 | if os.path.exists(plugin + "/index.json"): 107 | get_json = open(f"{plugin}/index.json", "r", encoding="utf-8") 108 | data = json.loads(get_json.read()) 109 | new.setWindowTitle(data["name"]) 110 | new.show() 111 | except Exception as e: 112 | dlerr(outid=9, parent=parent) 113 | if cfg.debug_card.value: 114 | logger.error(f"插件错误:{e}") 115 | 116 | 117 | def addCard(parent, PluginsGroup, icon, title, content, type, uuid): 118 | if type == "Bar": 119 | PluginCard_Bar = SwitchSettingCard( 120 | icon, 121 | title, 122 | content, 123 | None, 124 | PluginsGroup 125 | ) 126 | PluginCard_Bar.checkedChanged.connect(lambda: set_plugin_disable(uuid, PluginCard_Bar.isChecked())) 127 | if not os.path.exists(uuid + "/plugin.lock"): 128 | PluginCard_Bar.setValue(True) 129 | else: 130 | PluginCard_Bar.setValue(False) 131 | PluginCard_Bar.setObjectName(os.path.basename(uuid)) 132 | parent.PluginsGroup.addSettingCard(PluginCard_Bar) 133 | elif type == "api": 134 | PluginCard_api = SwitchSettingCard( 135 | icon, 136 | title, 137 | content, 138 | None, 139 | PluginsGroup 140 | ) 141 | PluginCard_api.checkedChanged.connect(lambda: set_plugin_disable(uuid, PluginCard_api.isChecked())) 142 | if not os.path.exists(uuid + "/plugin.lock"): 143 | PluginCard_api.setValue(True) 144 | else: 145 | PluginCard_api.setValue(False) 146 | PluginCard_api.setObjectName(os.path.basename(uuid)) 147 | parent.PluginsGroup.addSettingCard(PluginCard_api) 148 | elif type == "Window": 149 | PluginCard_window = PushSettingCard( 150 | '打开', 151 | icon, 152 | title, 153 | content, 154 | PluginsGroup 155 | ) 156 | PluginCard_window.setObjectName(os.path.basename(uuid)) 157 | PluginCard_window.clicked.connect(lambda: open_plugin_window(uuid, parent=parent)) 158 | parent.PluginsGroup.addSettingCard(PluginCard_window) 159 | -------------------------------------------------------------------------------- /helper/searchmusicHelper.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | import AZMusicAPI 3 | import json 4 | 5 | import os 6 | import requests 7 | from PyQt5.QtCore import Qt, QThread 8 | from PyQt5.QtCore import pyqtSignal, pyqtSlot 9 | from PyQt5.QtWidgets import QTableWidgetItem, QCompleter 10 | 11 | import helper.config 12 | from helper.config import cfg, pfg 13 | from helper.flyoutmsg import dlerr, dlwar 14 | from helper.getvalue import searchSong, set_download_search_song 15 | from helper.inital import mkf 16 | from helper.loggerHelper import logger 17 | from helper.pluginHelper import plugins_api_items 18 | 19 | api = cfg.ncma_api.value 20 | q_api = cfg.qqma_api.value 21 | mkf() 22 | 23 | 24 | def is_english_and_characters(input_string): 25 | return all(char.isalpha() or not char.isspace() for char in input_string) 26 | 27 | 28 | class getlist(QThread): 29 | finished = pyqtSignal() 30 | 31 | @pyqtSlot() 32 | def run(self): 33 | data = searchSong 34 | text = data["text"] 35 | value = data["value"] 36 | api_value = data["api_value"] 37 | keywords = text 38 | 39 | if pfg.apicard.value == "NCMA": 40 | self.songInfos = AZMusicAPI.getmusic(keywords, number=value, api=api_value, cookie=cfg.cookie.value) 41 | elif pfg.apicard.value == "QQMA": 42 | self.songInfos = AZMusicAPI.getmusic(keywords, number=value, api=api_value, server="qqma") 43 | else: 44 | try: 45 | api_plugin = plugins_api_items[pfg.apicard.value] 46 | self.songInfos = api_plugin.getmusic(keyword=keywords, number=value) 47 | except Exception as e: 48 | if cfg.debug_card.value: 49 | logger.error(f"插件错误:{e}") 50 | self.songInfos = "PluginAPIImportError" 51 | self.finished.emit() 52 | 53 | 54 | def sethotlineEdit(lineEdit): 55 | if helper.config.cfg.hotcard.value: 56 | try: 57 | data = requests.get(api + "search/hot").json()["result"]["hots"] 58 | hot_song = [] 59 | for i in data: 60 | hot_song.append(i["first"]) 61 | completer = QCompleter(hot_song, lineEdit) 62 | completer.setCaseSensitivity(Qt.CaseInsensitive) 63 | completer.setMaxVisibleItems(10) 64 | lineEdit.setCompleter(completer) 65 | except: 66 | pass 67 | 68 | 69 | def searchstart(lineEdit, parent, spinBox, lworker, progressbar): 70 | global searchSong 71 | if pfg.apicard.value == "NCMA": 72 | if api == "" or api is None: 73 | dlerr(outid=4, parent=parent) 74 | return "Error" 75 | searchSong = {"text": lineEdit.text(), "api_value": api, "value": spinBox.value()} 76 | elif pfg.apicard.value == "QQMA": 77 | if q_api == "" or q_api is None: 78 | dlerr(outid=5, parent=parent) 79 | return "Error" 80 | searchSong = {"text": lineEdit.text(), "api_value": q_api, "value": spinBox.value()} 81 | else: 82 | searchSong = {"text": lineEdit.text(), "api_value": "", "value": spinBox.value()} 83 | progressbar.setHidden(False) 84 | lworker.start() 85 | 86 | 87 | def rundownload(primaryButton1, ProgressBar, tableView, parent, dworker, lworker): 88 | global download_search_song 89 | musicpath = cfg.get(cfg.downloadFolder) 90 | primaryButton1.setEnabled(False) 91 | ProgressBar.setHidden(False) 92 | ProgressBar.setValue(0) 93 | 94 | row = tableView.currentIndex().row() 95 | if "Error" in lworker.songInfos: 96 | dlwar(3, parent=parent) 97 | return 0 98 | try: 99 | songdata = lworker.songInfos 100 | data = songdata[row] 101 | except: 102 | dlwar(3, parent=parent) 103 | return 0 104 | 105 | song_id = data["id"] 106 | song = data["name"] 107 | singer = data["artists"] 108 | 109 | try: 110 | if os.path.exists(musicpath) == False: 111 | os.mkdir(musicpath) 112 | except: 113 | dlerr(outid=3, parent=parent) 114 | return 0 115 | 116 | # self.dworker.started.connect(lambda: self.dworker.run(id=song_id, api=api, song=song, singer=singer)) 117 | if pfg.apicard.value == "NCMA": 118 | if api == "" or api is None: 119 | dlerr(outid=4, parent=parent) 120 | return "Error" 121 | download_search_song = {"id": song_id, "api": api, "song": song, "singer": singer} 122 | elif pfg.apicard.value == "QQMA": 123 | if q_api == "" or q_api is None: 124 | dlerr(outid=5, parent=parent) 125 | return "Error" 126 | download_search_song = {"id": song_id, "api": q_api, "song": song, "singer": singer} 127 | else: 128 | download_search_song = {"id": song_id, "song": song, "singer": singer} 129 | set_download_search_song(value=download_search_song) 130 | dworker.start() 131 | 132 | 133 | def search(lworker, parent, tableView, spinBox, progressbar): 134 | songInfos = lworker.songInfos 135 | progressbar.setHidden(True) 136 | if songInfos == "Error 0": 137 | dlwar(outid=0, parent=parent) 138 | return 0 139 | elif songInfos == "Error 1": 140 | dlwar(outid=1, parent=parent) 141 | return 0 142 | elif songInfos == "NetworkError": 143 | dlerr(outid=6, parent=parent) 144 | return 0 145 | elif songInfos == "PluginAPIImportError": 146 | dlerr(9, parent) 147 | return 0 148 | tableView.setRowCount(spinBox.value()) 149 | for i in range(len(songInfos)): 150 | data = songInfos[i] 151 | num = i + 1 152 | song_id = data["id"] 153 | title = data["name"] 154 | Artist = data["artists"] 155 | Album = data["album"] 156 | 157 | # if len(title) > 8: 158 | # title = title[:8] + "..." 159 | # if len(Artist) > 8: 160 | # Artist = Artist[:8] + "..." 161 | # if len(Album) > 8: 162 | # Album = Album[:8] + "..." 163 | 164 | data = [] 165 | data.append(str(song_id)) 166 | data.append(title) 167 | data.append(Artist) 168 | data.append(Album) 169 | for j in range(4): 170 | tableView.setItem(i, j, QTableWidgetItem(data[j])) 171 | 172 | tableView.resizeColumnsToContents() 173 | lworker.quit() -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AZ-Studio-2023/AZMusicDownloader/0a4526ee327f56dd3ed1c0d9915516492d977fc6/icon.ico -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | AZMusicAPI==1.5.1 2 | mutagen==1.47.0 3 | PyQt5==5.15.9 4 | PyQt5_sip==12.13.0 5 | PyQt_Fluent_Widgets==1.5.6 6 | Requests==2.32.2 7 | colorlog 8 | win11toast 9 | -------------------------------------------------------------------------------- /resource/Splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AZ-Studio-2023/AZMusicDownloader/0a4526ee327f56dd3ed1c0d9915516492d977fc6/resource/Splash.png -------------------------------------------------------------------------------- /resource/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AZ-Studio-2023/AZMusicDownloader/0a4526ee327f56dd3ed1c0d9915516492d977fc6/resource/logo.png -------------------------------------------------------------------------------- /resource/qss/dark/demo.qss: -------------------------------------------------------------------------------- 1 | MinimizeButton { 2 | qproperty-normalColor: white; 3 | qproperty-normalBackgroundColor: transparent; 4 | qproperty-hoverColor: white; 5 | qproperty-hoverBackgroundColor: rgba(255, 255, 255, 26); 6 | qproperty-pressedColor: white; 7 | qproperty-pressedBackgroundColor: rgba(255, 255, 255, 51) 8 | } 9 | 10 | 11 | MaximizeButton { 12 | qproperty-normalColor: white; 13 | qproperty-normalBackgroundColor: transparent; 14 | qproperty-hoverColor: white; 15 | qproperty-hoverBackgroundColor: rgba(255, 255, 255, 26); 16 | qproperty-pressedColor: white; 17 | qproperty-pressedBackgroundColor: rgba(255, 255, 255, 51) 18 | } 19 | 20 | CloseButton { 21 | qproperty-normalColor: white; 22 | qproperty-normalBackgroundColor: transparent; 23 | } 24 | 25 | StandardTitleBar > QLabel { 26 | color: white; 27 | } -------------------------------------------------------------------------------- /resource/qss/dark/setting_interface.qss: -------------------------------------------------------------------------------- 1 | SettingInterface, #scrollWidget { 2 | background-color: transparent; 3 | } 4 | 5 | QScrollArea { 6 | border: none; 7 | background-color: transparent; 8 | } 9 | 10 | 11 | /* 标签 */ 12 | QLabel#settingLabel { 13 | font: 33px 'Microsoft YaHei Light'; 14 | background-color: transparent; 15 | color: white; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /resource/qss/light/demo.qss: -------------------------------------------------------------------------------- 1 | MinimizeButton { 2 | qproperty-normalColor: black; 3 | qproperty-normalBackgroundColor: transparent; 4 | qproperty-hoverColor: black; 5 | qproperty-hoverBackgroundColor: rgba(0, 0, 0, 26); 6 | qproperty-pressedColor: black; 7 | qproperty-pressedBackgroundColor: rgba(0, 0, 0, 51) 8 | } 9 | 10 | 11 | MaximizeButton { 12 | qproperty-normalColor: black; 13 | qproperty-normalBackgroundColor: transparent; 14 | qproperty-hoverColor: black; 15 | qproperty-hoverBackgroundColor: rgba(0, 0, 0, 26); 16 | qproperty-pressedColor: black; 17 | qproperty-pressedBackgroundColor: rgba(0, 0, 0, 51) 18 | } 19 | 20 | CloseButton { 21 | qproperty-normalColor: black; 22 | qproperty-normalBackgroundColor: transparent; 23 | } -------------------------------------------------------------------------------- /resource/qss/light/setting_interface.qss: -------------------------------------------------------------------------------- 1 | SettingInterface, #scrollWidget { 2 | background-color: transparent; 3 | } 4 | 5 | QScrollArea { 6 | background-color: transparent; 7 | border: none; 8 | } 9 | 10 | 11 | /* 标签 */ 12 | QLabel#settingLabel { 13 | font: 33px 'Microsoft YaHei Light'; 14 | background-color: transparent; 15 | } 16 | -------------------------------------------------------------------------------- /window/main.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | import sys 3 | 4 | from PyQt5.QtGui import QIcon 5 | from PyQt5.QtWidgets import QApplication, QDesktopWidget 6 | from qfluentwidgets import FluentIcon as FIF 7 | from qfluentwidgets import MSFluentWindow, NavigationItemPosition 8 | 9 | from Interface.localmusics import localmusics 10 | from Interface.playlist import playlist 11 | from Interface.plugin import plugins 12 | from Interface.searchmusic import searchmusic 13 | from Interface.settings import SettingInterface 14 | from helper.config import cfg, pfg 15 | from helper.loggerHelper import logger 16 | from helper.pluginHelper import run_plugins, load_plugins 17 | from helper.getvalue import VERSION, UPDATE_ORDER 18 | 19 | api = cfg.ncma_api.value 20 | q_api = cfg.qqma_api.value 21 | 22 | # Print logs | 日志输出 23 | logger.info("欢迎使用AZMusicDownloader") 24 | logger.info(f"程序版本:{VERSION}") 25 | logger.info(f"更新编号:{UPDATE_ORDER}") 26 | if cfg.beta.value: 27 | logger.warning("Beta实验功能:启用") 28 | else: 29 | logger.warning("Beta实验功能:禁用") 30 | logger.debug("Debug模式:启用") 31 | logger.debug("使用的NeteaseCloudMusicApi:" + api) 32 | if q_api: 33 | logger.debug("使用的QQMusicApi:" + q_api) 34 | else: 35 | if cfg.debug_card.value: 36 | logger.warning("使用的QQMusicApi:" + "没有配置") 37 | logger.debug("选择的API:"+pfg.apicard.value) 38 | logger.debug(f"显示语言:{cfg.language.value}") 39 | logger.debug(f"默认下载音质:{cfg.level.value}") 40 | 41 | class Window(MSFluentWindow): 42 | 43 | def __init__(self): 44 | super().__init__() 45 | self.setObjectName("MainWindow") 46 | 47 | self.initNavigation() 48 | self.initWindow() 49 | 50 | def initNavigation(self): 51 | self.addSubInterface(searchmusic(), FIF.SEARCH, '搜索下载') 52 | self.addSubInterface(localmusics(), FIF.MUSIC_FOLDER, '我的音乐库') 53 | if cfg.beta.value: 54 | self.addSubInterface(playlist(), FIF.EXPRESSIVE_INPUT_ENTRY, '歌单') 55 | if cfg.PluginEnable.value: 56 | self.addSubInterface(plugins(), FIF.TILES, '插件', position=NavigationItemPosition.BOTTOM) 57 | load_plugins(parent=self) 58 | run_plugins(parent=self) 59 | self.addSubInterface(SettingInterface(), FIF.SETTING, '设置', position=NavigationItemPosition.BOTTOM) 60 | def initWindow(self): 61 | self.setWindowIcon(QIcon('resource/logo.png')) 62 | self.setWindowTitle('AZMusicDownloader') 63 | screen_resolution = QDesktopWidget().screenGeometry() 64 | screen_width = screen_resolution.width() 65 | screen_height = screen_resolution.height() 66 | window_width = int(screen_width * 0.46875) 67 | window_height = int(screen_height * 0.64815) 68 | self.setFixedSize(window_width, window_height) 69 | self.center() 70 | 71 | def center(self): 72 | screen_resolution = QDesktopWidget().screenGeometry() 73 | screen_width = screen_resolution.width() 74 | screen_height = screen_resolution.height() 75 | x = (screen_width - self.width()) // 2 76 | y = (screen_height - self.height()) // 2 77 | self.move(x, y) 78 | def closeEvent(self, event): 79 | sys.exit(0) 80 | --------------------------------------------------------------------------------