Browse Source

Init

master v1.0.0.0
kdxcxs 5 years ago
commit
7b3d4b794b
  1. 7
      .gitignore
  2. 33
      dumping.py
  3. 42
      dumping.ui
  4. BIN
      icon.ico
  5. 7
      icon.py
  6. BIN
      icon_32.ico
  7. 66
      main.py
  8. 33
      main.spec
  9. 54
      mainWindow.py
  10. 88
      mainWindow.ui
  11. 1
      pac.bat
  12. 42
      version_info.txt

7
.gitignore

@ -0,0 +1,7 @@
/test
/build
/dist
/venv
/icon.png
/.idea
/__pycache__

33
dumping.py

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dumping.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_dumpingDialog(object):
def setupUi(self, dumpingDialog):
dumpingDialog.setObjectName("dumpingDialog")
dumpingDialog.resize(300, 150)
self.label = QtWidgets.QLabel(dumpingDialog)
self.label.setGeometry(QtCore.QRect(75, 40, 150, 50))
font = QtGui.QFont()
font.setFamily("幼圆")
font.setPointSize(15)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.retranslateUi(dumpingDialog)
QtCore.QMetaObject.connectSlotsByName(dumpingDialog)
def retranslateUi(self, dumpingDialog):
_translate = QtCore.QCoreApplication.translate
dumpingDialog.setWindowTitle(_translate("dumpingDialog", "转换中"))
self.label.setText(_translate("dumpingDialog", "转换中\n"
"0/0"))

42
dumping.ui

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dumpingDialog</class>
<widget class="QDialog" name="dumpingDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>150</height>
</rect>
</property>
<property name="windowTitle">
<string>转换中</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>75</x>
<y>40</y>
<width>150</width>
<height>50</height>
</rect>
</property>
<property name="font">
<font>
<family>幼圆</family>
<pointsize>15</pointsize>
</font>
</property>
<property name="text">
<string>转换中
0/0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

BIN
icon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

7
icon.py

File diff suppressed because one or more lines are too long

BIN
icon_32.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

66
main.py

@ -0,0 +1,66 @@
# coding:utf-8
'''
author:kdxcxs@github.com
'''
import sys,base64
from PyQt5.QtWidgets import QMainWindow,QFileDialog,QDialog,QApplication
from PyQt5.QtGui import QPixmap,QIcon
from PyQt5.QtCore import QByteArray
from icon import iconb64
from mainWindow import Ui_MainWindow
from dumping import Ui_dumpingDialog
from ncmdump import dump
class mainWindow(QMainWindow):
def __init__(self, parent=None):
super(mainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.setupIcon()
self.dumpingdialog = dumpingDialog(self,self.icon)
self.initSignal()
self.show()
def setupIcon(self):
self.pmap = QPixmap()
self.pmap.loadFromData(QByteArray.fromBase64(iconb64))
self.icon = QIcon(self.pmap)
self.setWindowIcon(self.icon)
def initSignal(self):
self.ui.commandLinkButton.clicked.connect(self.dumper)
def dumper(self):
files,fileType = QFileDialog.getOpenFileNames(self,
"请选择ncm文件",
"./",
"NeteaseCloudMusic Files (*.ncm)")
if files:
outputPath = QFileDialog.getExistingDirectory(self,
'请选择输出文件夹',
'./')
if outputPath:
self.dumpingdialog.show()
filesTotal, filesDumped = len(files), 0
self.dumpingdialog.ui.label.setText(f'转换中\n{filesDumped}/{filesTotal}')
for file in files:
dump(file,outputPath+'/'+file.split('/')[-1][:-3]+'mp3')
filesDumped += 1
self.dumpingdialog.ui.label.setText(f'转换中\n{filesDumped}/{filesTotal}')
self.dumpingdialog.setWindowTitle('转换完毕!')
self.dumpingdialog.ui.label.setText('转换完毕!')
class ncmDumper(object):
def __init__(self):
self.app = QApplication(sys.argv)
self.mainwindow = mainWindow()
class dumpingDialog(QDialog):
def __init__(self,parent,icon):
super(dumpingDialog, self).__init__(parent)
self.ui = Ui_dumpingDialog()
self.ui.setupUi(self)
self.setWindowIcon(icon)
if __name__ == '__main__':
dumper = ncmDumper()
sys.exit(dumper.app.exec_())

33
main.spec

@ -0,0 +1,33 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['D:\\Codes\\pyqt_ncmdump'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False , version='version_info.txt', icon='icon.ico')

54
mainWindow.py

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setWindowModality(QtCore.Qt.NonModal)
MainWindow.resize(400, 200)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(40, 20, 320, 40))
font = QtGui.QFont()
font.setFamily("幼圆")
font.setPointSize(24)
self.label.setFont(font)
self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label.setTextFormat(QtCore.Qt.PlainText)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.commandLinkButton = QtWidgets.QCommandLinkButton(self.centralwidget)
self.commandLinkButton.setGeometry(QtCore.QRect(110, 100, 180, 61))
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(10)
font.setStyleStrategy(QtGui.QFont.PreferDefault)
self.commandLinkButton.setFont(font)
self.commandLinkButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.commandLinkButton.setCheckable(False)
self.commandLinkButton.setChecked(False)
self.commandLinkButton.setObjectName("commandLinkButton")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "ncm转换器"))
self.label.setText(_translate("MainWindow", "请选择需要转换的文件"))
self.commandLinkButton.setText(_translate("MainWindow", "选择文件"))
self.commandLinkButton.setDescription(_translate("MainWindow", "可一次选择多个文件"))

88
mainWindow.ui

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>200</height>
</rect>
</property>
<property name="windowTitle">
<string>ncm转换器</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>40</x>
<y>20</y>
<width>320</width>
<height>40</height>
</rect>
</property>
<property name="font">
<font>
<family>幼圆</family>
<pointsize>24</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>请选择需要转换的文件</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="buddy">
<cstring></cstring>
</property>
</widget>
<widget class="QCommandLinkButton" name="commandLinkButton">
<property name="geometry">
<rect>
<x>110</x>
<y>100</y>
<width>180</width>
<height>61</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI</family>
<pointsize>10</pointsize>
<stylestrategy>PreferDefault</stylestrategy>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>选择文件</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="description">
<string>可一次选择多个文件</string>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

1
pac.bat

@ -0,0 +1 @@
pyinstaller -F -w -i icon.ico main.py --version-file version_info.txt

42
version_info.txt

@ -0,0 +1,42 @@
# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(1, 0, 0, 0),
prodvers=(1, 0, 0, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x17,
# Contains a bitmask that specifies the Boolean attributes of the file.
flags=0x0,
# The operating system for which this file was designed.
# 0x4 - NT and there is no need to change it.
OS=0x4,
# The general type of file.
# 0x1 - the file is an application.
fileType=0x1,
# The function of the file.
# 0x0 - the function is not defined for this fileType
subtype=0x0,
# Creation date and time stamp.
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
u'080404b0',
[StringStruct(u'FileDescription', u'ncmDump'),
StringStruct(u'FileVersion', u'1.0.0.0'),
StringStruct(u'InternalName', u'ncmDump'),
StringStruct(u'LegalCopyright', u'cx@kdxcxs.com. All rights reserved.'),
StringStruct(u'OriginalFilename', u'ncmDump.exe'),
StringStruct(u'ProductName', u'ncmDump'),
StringStruct(u'ProductVersion', u'1.0.0.0')])
]),
VarFileInfo([VarStruct(u'Translation', [2052, 1200])])
]
)
Loading…
Cancel
Save