Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2021-2024 Lafcadia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## SongInformation
A Song Information Modifier.
40 changes: 20 additions & 20 deletions form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Music Information Modifier</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="LoadMP3">
Expand All @@ -25,13 +25,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>加载MP3文件</string>
<string>Load MP3</string>
</property>
</widget>
<widget class="QPlainTextEdit" name="SongName">
Expand All @@ -55,13 +55,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>歌曲名称:</string>
<string>Name: </string>
</property>
</widget>
<widget class="QPlainTextEdit" name="SingerName">
Expand All @@ -85,13 +85,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>歌手名称:</string>
<string>Artist: </string>
</property>
</widget>
<widget class="QLabel" name="label_3">
Expand All @@ -105,13 +105,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>专辑名称:</string>
<string>Album: </string>
</property>
</widget>
<widget class="QPlainTextEdit" name="AlbumName">
Expand All @@ -135,13 +135,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>开始转换</string>
<string>Start Convertion</string>
</property>
</widget>
<widget class="QPushButton" name="LoadJPG">
Expand All @@ -155,13 +155,13 @@
</property>
<property name="font">
<font>
<family>Weibei SC</family>
<pointsize>24</pointsize>
<family>Trebuchet MS</family>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>加载JPEG格式图片</string>
<string>Load JPEG</string>
</property>
</widget>
<widget class="QLabel" name="image">
Expand All @@ -177,7 +177,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap>../Yulan.jpg</pixmap>
<pixmap>./Yulan.jpg</pixmap>
</property>
</widget>
</widget>
Expand Down
17 changes: 9 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB
from gui import Ui_MainWindow
from ui import Ui_MainWindow
from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox
from PySide6 import QtCore, QtWidgets
from PySide6.QtGui import QPixmap
from PySide6.QtGui import QPixmap, QGuiApplication
from PySide6.QtCore import Qt
import sys, os

def BabyMode():
os.system('pip3 install mutagen')
# def BabyMode():
# os.system('pip3 install mutagen')

QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
QGuiApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Ceil)

def setSongInfo(songfilepath, songtitle, songartist, songalbum, songpicpath):
audio = ID3(songfilepath)
Expand Down Expand Up @@ -48,18 +49,18 @@ def __init__(self):
self.ui.Start.clicked.connect(self.doer)

def JPGloader(self):
self.JPG = QtWidgets.QFileDialog.getOpenFileName(self, "选取专辑图片","./", "All Files (*)")[0]
self.JPG = QtWidgets.QFileDialog.getOpenFileName(self, "Load JPG","./", "All Files (*)")[0]
self.ui.image.setPixmap(QPixmap(self.JPG))

def MP3loader(self):
self.MP3 = QtWidgets.QFileDialog.getOpenFileName(self, "选取mp3音乐文件","./", "All Files (*)")[0]
self.MP3 = QtWidgets.QFileDialog.getOpenFileName(self, "Load MP3","./", "All Files (*)")[0]

def doer(self):
SingerName = self.ui.SingerName.toPlainText()
SongName = self.ui.SongName.toPlainText()
AlbumName = self.ui.AlbumName.toPlainText()
setSongInfo(self.MP3, SongName, SingerName, AlbumName, self.JPG)
QMessageBox.information(self, "任务已经完成啦!","您原来的文件已被覆盖")
QMessageBox.information(self, "Done!","The file is overrided.")

if __name__ == "__main__":
app = QApplication(sys.argv)
Expand Down
35 changes: 20 additions & 15 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
################################################################################
## Form generated from reading UI file 'form.ui'
##
## Created by: Qt User Interface Compiler version 6.3.0
## Created by: Qt User Interface Compiler version 6.5.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide6.QtCore import (QCoreApplication, QMetaObject, QRect)
from PySide6.QtGui import QPixmap, QFont
from PySide6.QtWidgets import (QLabel, QPlainTextEdit,
QPushButton, QWidget)
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QLabel, QMainWindow, QPlainTextEdit,
QPushButton, QSizePolicy, QWidget)

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Expand All @@ -24,8 +29,8 @@ def setupUi(self, MainWindow):
self.LoadMP3.setObjectName(u"LoadMP3")
self.LoadMP3.setGeometry(QRect(11, 20, 181, 61))
font = QFont()
font.setFamilies([u"Weibei SC"])
font.setPointSize(24)
font.setFamilies([u"Trebuchet MS"])
font.setPointSize(18)
font.setBold(True)
self.LoadMP3.setFont(font)
self.SongName = QPlainTextEdit(self.centralwidget)
Expand Down Expand Up @@ -60,7 +65,7 @@ def setupUi(self, MainWindow):
self.image = QLabel(self.centralwidget)
self.image.setObjectName(u"image")
self.image.setGeometry(QRect(440, 20, 300, 300))
self.image.setPixmap(QPixmap(u"../Yulan.jpg"))
self.image.setPixmap(QPixmap(u"./Yulan.jpg"))
MainWindow.setCentralWidget(self.centralwidget)

self.retranslateUi(MainWindow)
Expand All @@ -69,13 +74,13 @@ def setupUi(self, MainWindow):
# setupUi

def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"歌曲信息填写", None))
self.LoadMP3.setText(QCoreApplication.translate("MainWindow", u"\u52a0\u8f7dMP3\u6587\u4ef6", None))
self.label.setText(QCoreApplication.translate("MainWindow", u"\u6b4c\u66f2\u540d\u79f0:", None))
self.label_2.setText(QCoreApplication.translate("MainWindow", u"\u6b4c\u624b\u540d\u79f0:", None))
self.label_3.setText(QCoreApplication.translate("MainWindow", u"\u4e13\u8f91\u540d\u79f0:", None))
self.Start.setText(QCoreApplication.translate("MainWindow", u"\u5f00\u59cb\u8f6c\u6362", None))
self.LoadJPG.setText(QCoreApplication.translate("MainWindow", u"\u52a0\u8f7dJPEG\u683c\u5f0f\u56fe\u7247", None))
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Music Information Modifier", None))
self.LoadMP3.setText(QCoreApplication.translate("MainWindow", u"Load MP3", None))
self.label.setText(QCoreApplication.translate("MainWindow", u"Name: ", None))
self.label_2.setText(QCoreApplication.translate("MainWindow", u"Artist: ", None))
self.label_3.setText(QCoreApplication.translate("MainWindow", u"Album: ", None))
self.Start.setText(QCoreApplication.translate("MainWindow", u"Start Convertion", None))
self.LoadJPG.setText(QCoreApplication.translate("MainWindow", u"Load JPEG", None))
self.image.setText("")
# retranslateUi