Skip to content

Commit

Permalink
Merge branch 'dev-v1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
pyTranscriber committed Aug 17, 2022
2 parents 92422ff + 89954d3 commit 89feada
Show file tree
Hide file tree
Showing 12 changed files with 458 additions and 32 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# UPDATE - v1.8 - 17/08/2022
1. Fixed bug: language codes for Chinese Languages updated accordingly to Speech API. Changed to "cmn-Hans-CN" and "cmn-Hant-TW" instead of "zh / zh-TW").. The output was always mistakenly coming in Cantonese (yue-Hant-HK). Now they come properly in Traditional Chinese and Simplified Chinese. Thanks to "Specter Hi" for reporting!
2. Added GUI language switch feature
3. Updated link to funding campaign at GitHub Sponsors

# UPDATE - v1.7 - 08/08/2022
1. add proxy setting
2. change the function 'pytranscriber.util.MyUtil.is_internet_connected'
Expand Down
7 changes: 6 additions & 1 deletion autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ def is_exe(file_path):
return program
else:
#looks for file in the script execution folder before checking on system path
current_dir = sys._MEIPASS #tmp dir where the bundled binary is extracted
#if its running frozen code from pyInstaller the path depends on pyInstaller tmp folder
if hasattr(sys, 'frozen'):
current_dir = sys._MEIPASS #tmp dir where the bundled binary is extracted
else:
#checks the current directory for ffmpeg binary when running locally directly from interpreter
current_dir = os.getcwd()
local_program = os.path.join(current_dir, program)
if is_exe(local_program):
return local_program
Expand Down
Empty file modified freeze-linux.sh
100644 → 100755
Empty file.
61 changes: 48 additions & 13 deletions pytranscriber/control/ctr_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'''

from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QDialog
from PyQt5.QtWidgets import QFileDialog, QMessageBox, QDialog, QActionGroup
from PyQt5.QtCore import Qt
from pathlib import Path
from pytranscriber.model.param_autosub import Param_Autosub
Expand All @@ -36,16 +36,19 @@ def __init__(self):
window = QtWidgets.QMainWindow()
self.objGUI = Ui_window()
self.objGUI.setupUi(window)
self.__initGUI()
self.__initGUI(window)
window.setFixedSize(window.size())
window.show()
sys.exit(app.exec_())

def __initGUI(self):
def __initGUI(self, window):

# language selection list
list_languages = ["en-US - English (United States)",
"en-AU - English (Australia)",
"cmn-Hans-CN - Chinese (Simplified, China)",
"cmn-Hant-TW - Chinese (Traditional, Taiwan)",
"yue-Hant-HK - Cantonese (Traditional, HK)",
"en-AU - English (Australia)",
"en-CA - English (Canada)",
"en-GB - English (United Kingdom)",
"en-HK - English (Hong Kong)",
Expand Down Expand Up @@ -187,10 +190,6 @@ def __initGUI(self):
"vi - Vietnamese",
"yi - Yiddish",
"yo - Yoruba",
"yue-Hant-HK - Cantonese (Traditional, HK)",
"zh - Chinese (Simplified, China)",
"zh-HK - Chinese (Simplified, Hong Kong)",
"zh-TW - Chinese (Traditional, Taiwan)",
"zu - Zulu"]

self.objGUI.cbSelectLang.addItems(list_languages)
Expand Down Expand Up @@ -218,6 +217,42 @@ def __initGUI(self):
self.objGUI.actionLicense.triggered.connect(self.__listenerBLicense)
self.objGUI.actionDonation.triggered.connect(self.__listenerBDonation)
self.objGUI.actionAbout_pyTranscriber.triggered.connect(self.__listenerBAboutpyTranscriber)

self.__initLanguageMenu(window)
self.objGUI.action_group.triggered.connect(self.__listenerChangeLanguage)

def __initLanguageMenu(self, window):
self.objGUI.actionEnglish.setCheckable(True)
self.objGUI.actionEnglish.setChecked(True)
self.objGUI.actionChineseTraditional.setCheckable(True)
self.objGUI.actionChineseSimplified.setCheckable(True)
self.objGUI.actionPortuguese.setCheckable(True)

#set up of the actiongroup
self.objGUI.action_group = QActionGroup(window)
self.objGUI.action_group.addAction(self.objGUI.actionEnglish)
self.objGUI.action_group.addAction(self.objGUI.actionChineseTraditional)
self.objGUI.action_group.addAction(self.objGUI.actionChineseSimplified)
self.objGUI.action_group.addAction(self.objGUI.actionPortuguese)

self.objGUI.trans = QtCore.QTranslator(window)
self.objGUI.mainWindow = window

#listener change language selected
def __listenerChangeLanguage(self, event):
#get the label of the selected language
currentLang = event.text()

#if it was a valid event
if currentLang:
#loads the languageFile
self.objGUI.trans.load('pytranscriber/gui/'+currentLang)
QtWidgets.QApplication.instance().installTranslator(self.objGUI.trans)
else:
QtWidgets.QApplication.instance().removeTranslator(self.trans)

#refresh UI with translation
self.objGUI.retranslateUi(self.objGUI.mainWindow)

def __resetGUIAfterSuccess(self):
self.__resetGUIAfterCancel()
Expand Down Expand Up @@ -399,10 +434,10 @@ def __listenerBLicense(self):

def __listenerBDonation(self):
self.__showInfoMessage("<html><body>"
+ "pyTranscriber is developed as a hobby, so donations of any value are welcomed and essential for further improvements and fixes."
+ "<br><br>If you feel that this software has been useful and would like to contribute for it to continue improve and have more features and fixes you can <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YHB854YHPJCU8&item_name=Donation+pyTranscriber&currency_code=BRL\">DONATE VIA PAYPAL</a>"
+ "pyTranscriber is developed as a hobby, so donations of any value are welcomed."
+ "<br><br>If you feel that this software has been useful and would like to contribute for it to continue improving and have more and bugfixes and features like support to other Speech Recognition Engines (like Vosk and Mozilla Deep Speech) you can either join our <a href=\"https://github.com/sponsors/raryelcostasouza\">funding campaign at Github Sponsors</a> or make a <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YHB854YHPJCU8&item_name=Donation+pyTranscriber&currency_code=BRL\">Paypal donation</a>."
+ "<br><br>Thanks in advance!"
+ "</body></html>", "DONATIONS")
+ "</body></html>", "Funding")

def __listenerBAboutpyTranscriber(self):
self.__showInfoMessage("<html><body>"
Expand All @@ -412,8 +447,8 @@ def __listenerBAboutpyTranscriber(self):
+ "<br><br>"
+ "The hard work of speech recognition is made by the <a href=\"https://cloud.google.com/speech/\">Google Speech Recognition API</a> "
+ "using <a href=\"https://github.com/agermanidis/autosub\">Autosub</a>"
+ "<br><br>pyTranscriber is developed as a hobby, so donations of any value are welcomed and essential for further improvements and fixes."
+ "<br><br>If you feel that this software has been useful and would like to contribute for it to continue improve and have more features and fixes you can <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YHB854YHPJCU8&item_name=Donation+pyTranscriber&currency_code=BRL\">DONATE VIA PAYPAL</a> or <a href=\"https://blockchain.com/btc/payment_request?address=153LcqV59paxEEJX7riLrEHQbE54vhcko9&amount=0.00026351&message=Donation to support pyTranscriber development\"> DONATE US$5 VIA BITCOIN</a>."
+ "<br><br>pyTranscriber is developed as a hobby, so donations of any value are welcomed."
+ "<br><br>If you feel that this software has been useful and would like to contribute for it to continue improving and have more and bugfixes and features like support to other Speech Recognition Engines (like Vosk and Mozilla Deep Speech) you can either join our <a href=\"https://github.com/sponsors/raryelcostasouza\">funding campaign at Github Sponsors</a> or make a <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YHB854YHPJCU8&item_name=Donation+pyTranscriber&currency_code=BRL\">Paypal donation</a>."
+ "<br><br>Thanks in advance!"
+ "</body></html>", "About pyTranscriber")

Expand Down
Binary file added pytranscriber/gui/Português.qm
Binary file not shown.
117 changes: 117 additions & 0 deletions pytranscriber/gui/Português.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>window</name>
<message>
<location filename="gui.py" line="129"/>
<source>pyTranscriber - v1.8 - 17/08/2022</source>
<translation>pyTranscriber -v1.8 - 17/08/2022</translation>
</message>
<message>
<location filename="gui.py" line="130"/>
<source>Select file(s)</source>
<translation>Selecionar arquivo(s)</translation>
</message>
<message>
<location filename="gui.py" line="131"/>
<source>Transcribe Audio / Generate Subtitles</source>
<translation>Transcrever áudio / Gerar Legendas</translation>
</message>
<message>
<location filename="gui.py" line="132"/>
<source>Open Output Folder</source>
<translation>Abrir Pasta de Destino</translation>
</message>
<message>
<location filename="gui.py" line="133"/>
<source>Output Location</source>
<translation>Pasta de Destino</translation>
</message>
<message>
<location filename="gui.py" line="134"/>
<source>List of files to generate transcribe audio / generate subtitles</source>
<translation>Lista de arquivos para gerar legendas/transcrever áudio</translation>
</message>
<message>
<location filename="gui.py" line="135"/>
<source>Remove file(s)</source>
<translation>Remover arquivo(s)</translation>
</message>
<message>
<location filename="gui.py" line="136"/>
<source>Cancel</source>
<translation>Cancelar</translation>
</message>
<message>
<location filename="gui.py" line="137"/>
<source>Open output files automatically</source>
<translation>Abrir arquivos de saída automaticamente</translation>
</message>
<message>
<location filename="gui.py" line="138"/>
<source>Audio Language:</source>
<translation>Idioma do áudio:</translation>
</message>
<message>
<location filename="gui.py" line="139"/>
<source>Abo&amp;ut</source>
<translation>Sob&amp;re</translation>
</message>
<message>
<location filename="gui.py" line="140"/>
<source>&amp;Settings</source>
<translation>&amp;Configurações</translation>
</message>
<message>
<location filename="gui.py" line="141"/>
<source>&amp;Language</source>
<translation>&amp;Idioma</translation>
</message>
<message>
<location filename="gui.py" line="142"/>
<source>&amp;License</source>
<translation>&amp;Licença</translation>
</message>
<message>
<location filename="gui.py" line="143"/>
<source>&amp;Funding at Github Sponsors</source>
<translation>Patrocínio no GitHub Sponsors</translation>
</message>
<message>
<location filename="gui.py" line="144"/>
<source>&amp;About pyTranscriber</source>
<translation>&amp;Sobre o pyTranscriber</translation>
</message>
<message>
<location filename="gui.py" line="145"/>
<source>&amp;Proxy</source>
<translation>Proxy</translation>
</message>
<message>
<location filename="gui.py" line="146"/>
<source>Proxy setting</source>
<translation>Configurações de Proxy</translation>
</message>
<message>
<location filename="gui.py" line="147"/>
<source>English</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gui.py" line="148"/>
<source>繁體中文 - Chinese Traditional</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gui.py" line="149"/>
<source>简体中文 - Chinese Simplified</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="gui.py" line="150"/>
<source>Português</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
40 changes: 30 additions & 10 deletions pytranscriber/gui/gui.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '.\gui.ui'
# Form implementation generated from reading ui file 'pytranscriber/gui/gui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
Expand All @@ -14,7 +14,7 @@
class Ui_window(object):
def setupUi(self, window):
window.setObjectName("window")
window.resize(1042, 486)
window.resize(1045, 487)
self.centralwidget = QtWidgets.QWidget(window)
self.centralwidget.setObjectName("centralwidget")
self.bSelectMedia = QtWidgets.QPushButton(self.centralwidget)
Expand Down Expand Up @@ -67,7 +67,7 @@ def setupUi(self, window):
self.chbxOpenOutputFilesAuto.setChecked(True)
self.chbxOpenOutputFilesAuto.setObjectName("chbxOpenOutputFilesAuto")
self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(200, 250, 591, 34))
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(200, 250, 591, 38))
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0)
Expand All @@ -81,12 +81,14 @@ def setupUi(self, window):
self.horizontalLayout_5.addWidget(self.cbSelectLang)
window.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(window)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1042, 18))
self.menubar.setGeometry(QtCore.QRect(0, 0, 1045, 28))
self.menubar.setObjectName("menubar")
self.menuAbout = QtWidgets.QMenu(self.menubar)
self.menuAbout.setObjectName("menuAbout")
self.menuProxy = QtWidgets.QMenu(self.menubar)
self.menuProxy.setObjectName("menuProxy")
self.menuLanguage = QtWidgets.QMenu(self.menubar)
self.menuLanguage.setObjectName("menuLanguage")
window.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(window)
self.statusbar.setObjectName("statusbar")
Expand All @@ -99,32 +101,50 @@ def setupUi(self, window):
self.actionAbout_pyTranscriber.setObjectName("actionAbout_pyTranscriber")
self.actionProxy = QtWidgets.QAction(window)
self.actionProxy.setObjectName("actionProxy")
self.actionEnglish = QtWidgets.QAction(window)
self.actionEnglish.setObjectName("actionEnglish")
self.actionChineseTraditional = QtWidgets.QAction(window)
self.actionChineseTraditional.setObjectName("actionChineseTraditional")
self.actionChineseSimplified = QtWidgets.QAction(window)
self.actionChineseSimplified.setObjectName("actionChineseSimplified")
self.actionPortuguese = QtWidgets.QAction(window)
self.actionPortuguese.setObjectName("actionPortuguese")
self.menuAbout.addAction(self.actionLicense)
self.menuAbout.addAction(self.actionDonation)
self.menuAbout.addAction(self.actionAbout_pyTranscriber)
self.menuProxy.addAction(self.actionProxy)
self.menuLanguage.addAction(self.actionEnglish)
self.menuLanguage.addAction(self.actionChineseTraditional)
self.menuLanguage.addAction(self.actionChineseSimplified)
self.menuLanguage.addAction(self.actionPortuguese)
self.menubar.addAction(self.menuProxy.menuAction())
self.menubar.addAction(self.menuLanguage.menuAction())
self.menubar.addAction(self.menuAbout.menuAction())

self.retranslateUi(window)
QtCore.QMetaObject.connectSlotsByName(window)

def retranslateUi(self, window):
_translate = QtCore.QCoreApplication.translate
window.setWindowTitle(_translate("window", "pyTranscriber - v1.7 - 08/08/2020"))
window.setWindowTitle(_translate("window", "pyTranscriber - v1.8 - 17/08/2022"))
self.bSelectMedia.setText(_translate("window", "Select file(s)"))
self.bConvert.setText(_translate("window", "Transcribe Audio / Generate Subtitles"))
self.bOpenOutputFolder.setText(_translate("window", "Open Output Folder"))
self.bSelectOutputFolder.setText(_translate("window", "Output Location"))
self.groupBox.setTitle(_translate("window", "&List of files to generate transcribe audio / generate subtitles"))
self.groupBox.setTitle(_translate("window", "List of files to generate transcribe audio / generate subtitles"))
self.bRemoveFile.setText(_translate("window", "Remove file(s)"))
self.bCancel.setText(_translate("window", "Cancel"))
self.chbxOpenOutputFilesAuto.setText(_translate("window", "Open output files automatically"))
self.labelSelectLang.setText(_translate("window", "Audio Language:"))
self.menuAbout.setTitle(_translate("window", "Abo&ut"))
self.menuProxy.setTitle(_translate("window", "Setting"))
self.menuProxy.setTitle(_translate("window", "&Settings"))
self.menuLanguage.setTitle(_translate("window", "&Language"))
self.actionLicense.setText(_translate("window", "&License"))
self.actionDonation.setText(_translate("window", "&DONATIONS"))
self.actionDonation.setText(_translate("window", "&Funding at Github Sponsors"))
self.actionAbout_pyTranscriber.setText(_translate("window", "&About pyTranscriber"))
self.actionProxy.setText(_translate("window", "Proxy"))
self.actionProxy.setText(_translate("window", "&Proxy"))
self.actionProxy.setToolTip(_translate("window", "Proxy setting"))
self.actionEnglish.setText(_translate("window", "English"))
self.actionChineseTraditional.setText(_translate("window", "繁體中文 - Chinese Traditional"))
self.actionChineseSimplified.setText(_translate("window", "简体中文 - Chinese Simplified"))
self.actionPortuguese.setText(_translate("window", "Português"))
Loading

0 comments on commit 89feada

Please sign in to comment.