Skip to content

Commit

Permalink
Merge pull request #3 from vtbmusic/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KCKT0112 authored Jun 11, 2020
2 parents 907b239 + 8d82c17 commit 79c0628
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 6 additions & 0 deletions assets/index.ui
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
<addaction name="action_VRC_2"/>
<addaction name="action_LRC"/>
<addaction name="action_out_LRC2"/>
<addaction name="action_LRC_5"/>
</widget>
<widget class="QMenu" name="menu_4">
<property name="title">
Expand Down Expand Up @@ -355,6 +356,11 @@
<string>导出翻译LRC</string>
</property>
</action>
<action name="action_LRC_5">
<property name="text">
<string>导出双语LRC</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
pyinstaller --hidden-import=queue -w -F -i assets/icon/main.ico main.py

cp -r ./assets ./dist/
cp -r ./assets ./dist/main/
24 changes: 23 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from PyQt5 import QtWidgets, QtGui, QtMultimedia
from PyQt5.uic import loadUi
from function.NetEase.Lyric import getNCMLyric
from function.LyricConvert.convert import mixlrc2vrc
from function.LyricConvert.convert import mixlrc2vrc, lrcs2mixlrc
from function.LyricConvert.fixaxis import fixlrcs


Expand Down Expand Up @@ -47,6 +47,7 @@ def set_ui(self):
self.action_LRC.triggered.connect(self.originLrcSave) # 导出原文LRC
self.action_out_LRC2.triggered.connect(self.translateLrcSave) # 导出翻译LRC
self.action_VtuberMusic.triggered.connect(self.about) # 关于
self.action_LRC5.triggered.connect(self.output2mixlrc) # 导出双语LRC

# 按钮项操作
self.toolButton.clicked.connect(lambda: self.impotLrc(0)) # 导入LRC到原歌词
Expand All @@ -58,6 +59,7 @@ def set_ui(self):
self.toolButton_8.clicked.connect(self.originLrcSave) # 导出原文LRC
self.toolButton_11.clicked.connect(self.translateLrcSave) # 导出翻译LRC
self.toolButton_12.clicked.connect(self.impotNetease) # 抓取网易云音乐歌词
self.toolButton_10.clicked.connect(self.output2mixlrc) # 导出双语LRC

# 关于
def about(self):
Expand Down Expand Up @@ -206,6 +208,26 @@ def translateLrcSave(self):
QMessageBox.information(self, '提示', '无法导出,内容为空', QMessageBox.Cancel)
except FileNotFoundError:
pass

# 导出双语LRC
def output2mixlrc(self):
try:
origin = self.textEdit.toPlainText()
translate = self.textEdit_2.toPlainText()
if(len(origin) > 0 and len(translate) > 0):
newdata = lrcs2mixlrc(origin, translate)

filename = QFileDialog.getSaveFileName(
self, '保存', '.', "Lrc Files (*.lrc);;Text Files (*.txt);;All Files (*)")
with open(filename[0], 'w', encoding = 'utf-8') as f:
f.write(newdata)
f.close()
else:
QMessageBox.information(self, '提示', '无法导出,内容为空', QMessageBox.Cancel)
except FileNotFoundError:
pass





Expand Down

0 comments on commit 79c0628

Please sign in to comment.