Skip to content

Commit

Permalink
Merge branch 'dev-1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
pyTranscriber committed Dec 22, 2022
2 parents 4bf80ed + cf966d3 commit 59d4dfd
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 152 deletions.
32 changes: 31 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,39 @@ name = "pypi"

[packages]
autosub = "*"
pyqt5 = "*"
pyqt5 = "==5.15.4"
pyinstaller = "*"
macholib = "*"
cachetools = "==4.2.4"
certifi = "==2021.10.8"
chardet = "==4.0.0"
charset-normalizer = "==2.0.6"
google-api-core = "==2.1.0"
google-api-python-client = "==2.24.0"
google-auth = "==2.3.0"
google-auth-httplib2 = "==0.1.0"
google-auth-oauthlib = "==0.4.6"
googleapis-common-protos = "==1.53.0"
httplib2 = "==0.20.1"
idna = "==3.2"
oauthlib = "==3.1.1"
progressbar = "==2.5"
protobuf = "==3.18.1"
pyasn1 = "==0.4.8"
pyasn1-modules = "==0.2.8"
pyparsing = "==2.4.7"
pyqt5-qt5 = "==5.15.2"
pyqt5-sip = "==12.9.0"
pysrt = "==1.1.2"
requests = "==2.26.0"
requests-oauthlib = "==1.3.0"
rsa = "==4.7.2"
six = "==1.16.0"
uritemplate = "==3.0.1"
urllib3 = "==1.26.7"
nuitka = "*"
orderedset = "*"
zstandard = "*"

[dev-packages]

Expand Down
370 changes: 246 additions & 124 deletions Pipfile.lock

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sys
import tempfile
import wave

import json
import requests
try:
Expand All @@ -31,6 +30,7 @@
LANGUAGE_CODES, GOOGLE_SPEECH_API_KEY, GOOGLE_SPEECH_API_URL,
)
from autosub.formatters import FORMATTERS
from pathlib import PurePath

DEFAULT_SUBTITLE_FORMAT = 'srt'
DEFAULT_CONCURRENCY = 10
Expand Down Expand Up @@ -156,7 +156,6 @@ def __call__(self, sentence):
except KeyboardInterrupt:
return None


def which(program):
"""
Return the path for a given executable.
Expand All @@ -174,16 +173,11 @@ def is_exe(file_path):
if is_exe(program):
return program
else:
#looks for file in the script execution folder before checking on system path
#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
local_program_path = PurePath(__file__).parent.parent.joinpath(program)
str_local_program_path = str(local_program_path)
print("path_ffmpeg",str_local_program_path)
if is_exe(str_local_program_path):
return str_local_program_path
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
Expand Down
4 changes: 4 additions & 0 deletions freeze-linux-nuitka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

pipenv shell
nuitka3 --enable-plugin=pyqt5 --include-data-files="ffmpeg"="./" --include-data-files="pytranscriber/gui/*.qm"="pytranscriber/gui/" main.py --onefile
1 change: 1 addition & 0 deletions freeze-nuitka-win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nuitka --enable-plugin=pyqt5 --include-data-files="ffmpeg.exe"="./" --include-data-files="pytranscriber/gui/*.qm"="pytranscriber/gui/" main.py --onefile --disable-console
16 changes: 6 additions & 10 deletions pytranscriber/control/ctr_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pytranscriber.gui.gui import Ui_window
import os
import sys
from pathlib import PurePath


class Ctr_Main():
Expand Down Expand Up @@ -246,15 +247,10 @@ def __listenerChangeLanguage(self, event):

#if it was a valid event
if currentLang:
#loads the languageFile
if hasattr(sys, 'frozen'):
#if frozen gets temp folder
currentDir = sys._MEIPASS
else:
#app folder
currentDir = ""
pathLangFile = os.path.join(currentDir,'pytranscriber/gui/'+currentLang )
self.objGUI.trans.load(pathLangFile)
currentDir = PurePath(__file__).parent.parent.parent
pathLangFile = currentDir.joinpath('pytranscriber').joinpath('gui').joinpath(currentLang)
print("pathlangfile", pathLangFile)
self.objGUI.trans.load(str(pathLangFile))

QtWidgets.QApplication.instance().installTranslator(self.objGUI.trans)
else:
Expand Down Expand Up @@ -321,7 +317,7 @@ def __listenerBSelectMedia(self):
# options = QFileDialog.Options()
options = QFileDialog.DontUseNativeDialog
files, _ = QFileDialog.getOpenFileNames(self.objGUI.centralwidget, "Select media", "",
"All Media Files (*.mp3 *.mp4 *.wav *.m4a *.wma *.ogg *.mkv *.webm)")
"All Media Files (*.mp3 *.mp4 *.wav *.m4a *.wma *.ogg *.ogv *.mkv *.webm *.ts)")

if files:
self.objGUI.qlwListFilesSelected.addItems(files)
Expand Down
2 changes: 1 addition & 1 deletion pytranscriber/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def setupUi(self, window):

def retranslateUi(self, window):
_translate = QtCore.QCoreApplication.translate
window.setWindowTitle(_translate("window", "pyTranscriber - v1.8 - 17/08/2022"))
window.setWindowTitle(_translate("window", "pyTranscriber - v1.9 - 21/12/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"))
Expand Down
2 changes: 1 addition & 1 deletion pytranscriber/gui/gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>pyTranscriber - v1.8 - 17/08/2022</string>
<string>pyTranscriber - v1.9 - 21/12/2022</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="bSelectMedia">
Expand Down
6 changes: 5 additions & 1 deletion pytranscriber/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import os
import subprocess
import requests
import re
from pathlib import PureWindowsPath
from urllib.parse import urlparse



class MyUtil(object):
Expand Down Expand Up @@ -44,4 +48,4 @@ def is_internet_connected(proxies=None):

@staticmethod
def percentage(currentval, maxval):
return 100 * currentval / float(maxval)
return 100 * currentval / float(maxval)
Binary file modified requirements.txt
Binary file not shown.
4 changes: 2 additions & 2 deletions script-installer-windows.iss
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{5240AB76-FC62-4BFA-A1EF-FA49AF701F80}
AppName=pyTranscriber
AppVersion=1.7
;AppVerName=pyTranscriber 1.7
AppVersion=1.9
AppVerName=pyTranscriber 1.9
AppPublisher=Raryel C. Souza
AppPublisherURL=https://github.com/raryelcostasouza/pyTranscriber
AppSupportURL=https://github.com/raryelcostasouza/pyTranscriber
Expand Down

0 comments on commit 59d4dfd

Please sign in to comment.