Skip to content

Commit

Permalink
Support saving in srt/ass format
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmozhijin committed Mar 14, 2024
1 parent 0770b21 commit 1834630
Show file tree
Hide file tree
Showing 17 changed files with 668 additions and 307 deletions.
2 changes: 1 addition & 1 deletion LDDC.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright (c) 2024 沉默の金
__version__ = "v0.5.1"
__version__ = "v0.6.0"
import logging
import os
import sys
Expand Down
7 changes: 1 addition & 6 deletions decryptor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import logging
from enum import Enum
from zlib import decompress

from decryptor.qmc1 import qmc1_decrypt
from decryptor.tripledes import DECRYPT, tripledes_crypt, tripledes_key_setup


class QrcType(Enum):
LOCAL = 0
CLOUD = 1
from utils.enum import QrcType


def qrc_decrypt(encrypted_qrc: str | bytearray | bytes, qrc_type: QrcType) -> tuple[str | None, str | None]:
Expand Down
6 changes: 5 additions & 1 deletion decryptor/eapi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import binascii
import hashlib
import json
from base64 import b64encode
from base64 import b64decode, b64encode

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import padding
Expand Down Expand Up @@ -65,5 +65,9 @@ def get_cache_key(data: str | bytes) -> str:
return b64encode(aes_encrypt(data, b")(13daqP@ssw0rd~")).decode()


def cache_key_decrypt(data: str | bytes) -> str:
return aes_decrypt(b64decode(data), b")(13daqP@ssw0rd~").decode()


def eapi_response_decrypt(cipher_buffer: bytes) -> bytes:
return aes_decrypt(cipher_buffer, b'e82ckenh8dichen8')
33 changes: 32 additions & 1 deletion ui/encrypted_lyrics.ui
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,37 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>转换的格式:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="lyricsformat_comboBox">
<item>
<property name="text">
<string>LRC(逐字)</string>
</property>
</item>
<item>
<property name="text">
<string>LRC(逐行)</string>
</property>
</item>
<item>
<property name="text">
<string>SRT</string>
</property>
</item>
<item>
<property name="text">
<string>ASS</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
Expand All @@ -89,7 +120,7 @@
<item>
<widget class="QPushButton" name="convert_pushButton">
<property name="text">
<string>转换为lrc</string>
<string>转换格式</string>
</property>
</widget>
</item>
Expand Down
23 changes: 22 additions & 1 deletion ui/encrypted_lyrics_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from PySide6.QtWidgets import (
QCheckBox,
QComboBox,
QHBoxLayout,
QLabel,
QPlainTextEdit,
Expand Down Expand Up @@ -68,6 +69,20 @@ def setupUi(self, encrypted_lyrics):

self.horizontalLayout_2.addWidget(self.romanized_checkBox, 0, Qt.AlignLeft)

self.label_2 = QLabel(encrypted_lyrics)
self.label_2.setObjectName(u"label_2")

self.horizontalLayout_2.addWidget(self.label_2)

self.lyricsformat_comboBox = QComboBox(encrypted_lyrics)
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.setObjectName(u"lyricsformat_comboBox")

self.horizontalLayout_2.addWidget(self.lyricsformat_comboBox)


self.verticalLayout.addLayout(self.horizontalLayout_2)

Expand Down Expand Up @@ -110,8 +125,14 @@ def retranslateUi(self, encrypted_lyrics):
self.original_checkBox.setText(QCoreApplication.translate("encrypted_lyrics", u"\u539f\u6587", None))
self.translate_checkBox.setText(QCoreApplication.translate("encrypted_lyrics", u"\u8bd1\u6587", None))
self.romanized_checkBox.setText(QCoreApplication.translate("encrypted_lyrics", u"\u7f57\u9a6c\u97f3", None))
self.label_2.setText(QCoreApplication.translate("encrypted_lyrics", u"\u8f6c\u6362\u7684\u683c\u5f0f\uff1a", None))
self.lyricsformat_comboBox.setItemText(0, QCoreApplication.translate("encrypted_lyrics", u"LRC(\u9010\u5b57)", None))
self.lyricsformat_comboBox.setItemText(1, QCoreApplication.translate("encrypted_lyrics", u"LRC(\u9010\u884c)", None))
self.lyricsformat_comboBox.setItemText(2, QCoreApplication.translate("encrypted_lyrics", u"SRT", None))
self.lyricsformat_comboBox.setItemText(3, QCoreApplication.translate("encrypted_lyrics", u"ASS", None))

self.open_pushButton.setText(QCoreApplication.translate("encrypted_lyrics", u"\u6253\u5f00\u52a0\u5bc6\u6b4c\u8bcd", None))
self.convert_pushButton.setText(QCoreApplication.translate("encrypted_lyrics", u"\u8f6c\u6362\u4e3alrc", None))
self.convert_pushButton.setText(QCoreApplication.translate("encrypted_lyrics", u"\u8f6c\u6362\u683c\u5f0f", None))
self.save_pushButton.setText(QCoreApplication.translate("encrypted_lyrics", u"\u4fdd\u5b58\u6b4c\u8bcd", None))
# retranslateUi

115 changes: 78 additions & 37 deletions ui/local_match.ui
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,57 @@
<string>歌词</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>歌词类型:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="original_checkBox">
<property name="text">
<string>原文</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="translate_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>译文</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="romanized_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>罗马音</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -335,52 +385,43 @@
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>歌词类型:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QCheckBox" name="original_checkBox">
<property name="text">
<string>原文</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="translate_checkBox">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>译文</string>
</property>
<property name="checked">
<bool>true</bool>
<string>歌词格式:</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QCheckBox" name="romanized_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>罗马音</string>
</property>
<item>
<widget class="QComboBox" name="lyricsformat_comboBox">
<item>
<property name="text">
<string>LRC(逐字)</string>
</property>
</item>
<item>
<property name="text">
<string>LRC(逐行)</string>
</property>
</item>
<item>
<property name="text">
<string>SRT</string>
</property>
</item>
<item>
<property name="text">
<string>ASS</string>
</property>
</item>
</widget>
</item>
</layout>
Expand Down
87 changes: 57 additions & 30 deletions ui/local_match_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,37 @@ def setupUi(self, local_match):
self.groupBox_2.setObjectName(u"groupBox_2")
self.gridLayout_2 = QGridLayout(self.groupBox_2)
self.gridLayout_2.setObjectName(u"gridLayout_2")
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.label_9 = QLabel(self.groupBox_2)
self.label_9.setObjectName(u"label_9")

self.horizontalLayout_3.addWidget(self.label_9)

self.original_checkBox = QCheckBox(self.groupBox_2)
self.original_checkBox.setObjectName(u"original_checkBox")
self.original_checkBox.setChecked(True)

self.horizontalLayout_3.addWidget(self.original_checkBox)

self.translate_checkBox = QCheckBox(self.groupBox_2)
self.translate_checkBox.setObjectName(u"translate_checkBox")
sizePolicy1.setHeightForWidth(self.translate_checkBox.sizePolicy().hasHeightForWidth())
self.translate_checkBox.setSizePolicy(sizePolicy1)
self.translate_checkBox.setChecked(True)

self.horizontalLayout_3.addWidget(self.translate_checkBox, 0, Qt.AlignLeft)

self.romanized_checkBox = QCheckBox(self.groupBox_2)
self.romanized_checkBox.setObjectName(u"romanized_checkBox")
sizePolicy1.setHeightForWidth(self.romanized_checkBox.sizePolicy().hasHeightForWidth())
self.romanized_checkBox.setSizePolicy(sizePolicy1)

self.horizontalLayout_3.addWidget(self.romanized_checkBox, 0, Qt.AlignLeft)


self.gridLayout_2.addLayout(self.horizontalLayout_3, 0, 0, 1, 1)

self.horizontalLayout_4 = QHBoxLayout()
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.verticalLayout_2 = QVBoxLayout()
Expand Down Expand Up @@ -239,38 +270,28 @@ def setupUi(self, local_match):
self.horizontalLayout_4.addItem(self.horizontalSpacer_4)


self.gridLayout_2.addLayout(self.horizontalLayout_4, 1, 0, 1, 1)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 2, 0, 1, 1)

self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.label_9 = QLabel(self.groupBox_2)
self.label_9.setObjectName(u"label_9")

self.horizontalLayout_3.addWidget(self.label_9)

self.original_checkBox = QCheckBox(self.groupBox_2)
self.original_checkBox.setObjectName(u"original_checkBox")
self.original_checkBox.setChecked(True)

self.horizontalLayout_3.addWidget(self.original_checkBox)

self.translate_checkBox = QCheckBox(self.groupBox_2)
self.translate_checkBox.setObjectName(u"translate_checkBox")
sizePolicy1.setHeightForWidth(self.translate_checkBox.sizePolicy().hasHeightForWidth())
self.translate_checkBox.setSizePolicy(sizePolicy1)
self.translate_checkBox.setChecked(True)
self.horizontalLayout_9 = QHBoxLayout()
self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
self.label_10 = QLabel(self.groupBox_2)
self.label_10.setObjectName(u"label_10")
sizePolicy2.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
self.label_10.setSizePolicy(sizePolicy2)

self.horizontalLayout_3.addWidget(self.translate_checkBox, 0, Qt.AlignLeft)
self.horizontalLayout_9.addWidget(self.label_10)

self.romanized_checkBox = QCheckBox(self.groupBox_2)
self.romanized_checkBox.setObjectName(u"romanized_checkBox")
sizePolicy1.setHeightForWidth(self.romanized_checkBox.sizePolicy().hasHeightForWidth())
self.romanized_checkBox.setSizePolicy(sizePolicy1)
self.lyricsformat_comboBox = QComboBox(self.groupBox_2)
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.addItem("")
self.lyricsformat_comboBox.setObjectName(u"lyricsformat_comboBox")

self.horizontalLayout_3.addWidget(self.romanized_checkBox, 0, Qt.AlignLeft)
self.horizontalLayout_9.addWidget(self.lyricsformat_comboBox)


self.gridLayout_2.addLayout(self.horizontalLayout_3, 0, 0, 1, 1)
self.gridLayout_2.addLayout(self.horizontalLayout_9, 1, 0, 1, 1)


self.verticalLayout.addWidget(self.groupBox_2)
Expand Down Expand Up @@ -328,6 +349,10 @@ def retranslateUi(self, local_match):
self.lyrics_filename_mode_comboBox.setItemText(1, QCoreApplication.translate("local_match", u"\u4e0e\u6b4c\u66f2\u6587\u4ef6\u540d\u76f8\u540c", None))

self.groupBox_2.setTitle(QCoreApplication.translate("local_match", u"\u6b4c\u8bcd", None))
self.label_9.setText(QCoreApplication.translate("local_match", u"\u6b4c\u8bcd\u7c7b\u578b:", None))
self.original_checkBox.setText(QCoreApplication.translate("local_match", u"\u539f\u6587", None))
self.translate_checkBox.setText(QCoreApplication.translate("local_match", u"\u8bd1\u6587", None))
self.romanized_checkBox.setText(QCoreApplication.translate("local_match", u"\u7f57\u9a6c\u97f3", None))
self.label_7.setText(QCoreApplication.translate("local_match", u"\u6b4c\u8bcd\u6765\u6e90:", None))
self.qm_checkBox.setText(QCoreApplication.translate("local_match", u"QQ\u97f3\u4e50", None))
self.ne_checkBox.setText(QCoreApplication.translate("local_match", u"\u7f51\u6613\u4e91\u97f3\u4e50", None))
Expand All @@ -344,10 +369,12 @@ def retranslateUi(self, local_match):
___qlistwidgetitem2.setText(QCoreApplication.translate("local_match", u"\u7f51\u6613\u4e91\u97f3\u4e50", None));
self.source_listWidget.setSortingEnabled(__sortingEnabled)

self.label_9.setText(QCoreApplication.translate("local_match", u"\u6b4c\u8bcd\u7c7b\u578b:", None))
self.original_checkBox.setText(QCoreApplication.translate("local_match", u"\u539f\u6587", None))
self.translate_checkBox.setText(QCoreApplication.translate("local_match", u"\u8bd1\u6587", None))
self.romanized_checkBox.setText(QCoreApplication.translate("local_match", u"\u7f57\u9a6c\u97f3", None))
self.label_10.setText(QCoreApplication.translate("local_match", u"\u6b4c\u8bcd\u683c\u5f0f:", None))
self.lyricsformat_comboBox.setItemText(0, QCoreApplication.translate("local_match", u"LRC(\u9010\u5b57)", None))
self.lyricsformat_comboBox.setItemText(1, QCoreApplication.translate("local_match", u"LRC(\u9010\u884c)", None))
self.lyricsformat_comboBox.setItemText(2, QCoreApplication.translate("local_match", u"SRT", None))
self.lyricsformat_comboBox.setItemText(3, QCoreApplication.translate("local_match", u"ASS", None))

self.start_cancel_pushButton.setText(QCoreApplication.translate("local_match", u"\u5f00\u59cb\u5339\u914d", None))
# retranslateUi

Loading

0 comments on commit 1834630

Please sign in to comment.