Add import paths to audio files. Add error dialog. Add checking extension of audio file(.mp3).
This commit is contained in:
parent
0f1d8e3c6c
commit
d93dd450dc
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
FROM alpine:3.9 AS build
|
||||||
|
WORKDIR /opt/app/MagicPodcast
|
||||||
|
# Install Python and external dependencies, including headers and GCC
|
||||||
|
RUN apk add --no-cache python3 python3-dev py3-pip libffi libffi-dev musl-dev gcc
|
||||||
|
# Install Pipenv
|
||||||
|
RUN pip3 install pipenv
|
||||||
|
# Create a virtual environment and activate it
|
||||||
|
RUN python3 -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
|
||||||
|
# Install dependencies into the virtual environment with Pipenv
|
||||||
|
COPY Pipfile Pipfile.lock /opt/app/MagicPodcast
|
||||||
|
RUN pipenv install --deploy
|
||||||
|
FROM alpine:3.9
|
||||||
|
WORKDIR /opt/app/MagicPodcast
|
||||||
|
# Install Python and external runtime dependencies only
|
||||||
|
RUN apk add --no-cache python3 libffi
|
||||||
|
# Copy the virtual environment from the previous image
|
||||||
|
COPY --from=build /opt/venv /opt/venv
|
||||||
|
# Activate the virtual environment
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
|
||||||
|
# Copy your application
|
||||||
|
COPY . /opt/app/MagicPodcast
|
||||||
|
|
||||||
|
|
4
main.py
4
main.py
@ -1,10 +1,10 @@
|
|||||||
from src.python.classes.mainwindow import MainWindow
|
from src.python.classes.mainwindow import MainWindow
|
||||||
from PyQt5 import QtWidgets
|
from PyQt5.QtWidgets import QApplication
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
w = MainWindow()
|
w = MainWindow()
|
||||||
w.show()
|
w.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
@ -18,7 +18,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGraphicsView" name="graphicsView"/>
|
<layout class="QVBoxLayout" name="vertical_layout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGraphicsView" name="graphics_view"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="range_silder">
|
<widget class="QSlider" name="range_silder">
|
||||||
@ -34,7 +43,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontal_layout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -43,7 +59,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
<widget class="QLineEdit" name="line_edit"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
@ -53,28 +69,28 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
<widget class="QLineEdit" name="line_edit_2"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontal_layout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="push_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>start</string>
|
<string>start</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QPushButton" name="push_button_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>stop</string>
|
<string>stop</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_3">
|
<widget class="QPushButton" name="push_button_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>zakończ</string>
|
<string>zakończ</string>
|
||||||
</property>
|
</property>
|
||||||
@ -83,6 +99,8 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -6,6 +6,48 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(MainWindow, self).__init__(parent=parent)
|
super(MainWindow, self).__init__(parent=parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
self.setup_logic()
|
||||||
|
|
||||||
|
def setup_logic(self):
|
||||||
|
self.push_button_audio1.clicked.connect(lambda: self.open_audio_import(audio_number=1))
|
||||||
|
self.push_button_audio2.clicked.connect(lambda: self.open_audio_import(audio_number=2))
|
||||||
|
|
||||||
def setup_detail(self):
|
def setup_detail(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def create_custom_dialog(self, title: str, msg: str):
|
||||||
|
dialog = QDialog()
|
||||||
|
dialog.setWindowTitle(title)
|
||||||
|
label = QLabel()
|
||||||
|
label.setText(msg)
|
||||||
|
buttons = QDialogButtonBox.Ok
|
||||||
|
button_box = QDialogButtonBox(buttons)
|
||||||
|
button_box.accepted.connect(dialog.accept)
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
layout.addWidget(label)
|
||||||
|
layout.addWidget(button_box)
|
||||||
|
dialog.setLayout(layout)
|
||||||
|
return dialog
|
||||||
|
|
||||||
|
def open_audio_import(self, audio_number: int):
|
||||||
|
dialog = QFileDialog()
|
||||||
|
dialog.setOption(dialog.DontUseNativeDialog, True)
|
||||||
|
dialog.setFileMode(QFileDialog.ExistingFile)
|
||||||
|
|
||||||
|
file, _ = dialog.getOpenFileName(self, "QFileDialog.getOpenFileName()", "", "All Files (*);;mp3 (*.mp3);;wav (*.wav)", options=dialog.options())
|
||||||
|
|
||||||
|
if not file.endswith('.mp3'):
|
||||||
|
print(F"[!] Plik {file} nie jest plikiem mp3.")
|
||||||
|
dialog = self.create_custom_dialog(title='Error', msg=F"[!] Plik {file} nie jest plikiem mp3.")
|
||||||
|
dialog.exec_()
|
||||||
|
|
||||||
|
else:
|
||||||
|
if audio_number == 1:
|
||||||
|
self.line_edit_audio1.setText(file)
|
||||||
|
|
||||||
|
elif audio_number == 2:
|
||||||
|
self.line_edit_audio2.setText(file)
|
||||||
|
|
||||||
|
print(F"[*] Zaimportowano ścieżkę {audio_number} pliku: '{file}'.")
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,42 +18,55 @@ class Ui_dialog(object):
|
|||||||
dialog.resize(782, 356)
|
dialog.resize(782, 356)
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout(dialog)
|
self.verticalLayout = QtWidgets.QVBoxLayout(dialog)
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.graphicsView = QtWidgets.QGraphicsView(dialog)
|
self.vertical_layout = QtWidgets.QVBoxLayout()
|
||||||
self.graphicsView.setObjectName("graphicsView")
|
self.vertical_layout.setObjectName("vertical_layout")
|
||||||
self.verticalLayout.addWidget(self.graphicsView)
|
self.graphics_view = QtWidgets.QGraphicsView(dialog)
|
||||||
|
self.graphics_view.setObjectName("graphics_view")
|
||||||
|
self.vertical_layout.addWidget(self.graphics_view)
|
||||||
|
self.line = QtWidgets.QFrame(dialog)
|
||||||
|
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line.setObjectName("line")
|
||||||
|
self.vertical_layout.addWidget(self.line)
|
||||||
self.range_silder = QtWidgets.QSlider(dialog)
|
self.range_silder = QtWidgets.QSlider(dialog)
|
||||||
self.range_silder.setOrientation(QtCore.Qt.Horizontal)
|
self.range_silder.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.range_silder.setTickPosition(QtWidgets.QSlider.TicksBothSides)
|
self.range_silder.setTickPosition(QtWidgets.QSlider.TicksBothSides)
|
||||||
self.range_silder.setTickInterval(1)
|
self.range_silder.setTickInterval(1)
|
||||||
self.range_silder.setObjectName("range_silder")
|
self.range_silder.setObjectName("range_silder")
|
||||||
self.verticalLayout.addWidget(self.range_silder)
|
self.vertical_layout.addWidget(self.range_silder)
|
||||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
self.line_2 = QtWidgets.QFrame(dialog)
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||||
|
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
|
self.line_2.setObjectName("line_2")
|
||||||
|
self.vertical_layout.addWidget(self.line_2)
|
||||||
|
self.horizontal_layout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontal_layout_2.setObjectName("horizontal_layout_2")
|
||||||
self.label = QtWidgets.QLabel(dialog)
|
self.label = QtWidgets.QLabel(dialog)
|
||||||
self.label.setObjectName("label")
|
self.label.setObjectName("label")
|
||||||
self.horizontalLayout_2.addWidget(self.label)
|
self.horizontal_layout_2.addWidget(self.label)
|
||||||
self.lineEdit = QtWidgets.QLineEdit(dialog)
|
self.line_edit = QtWidgets.QLineEdit(dialog)
|
||||||
self.lineEdit.setObjectName("lineEdit")
|
self.line_edit.setObjectName("line_edit")
|
||||||
self.horizontalLayout_2.addWidget(self.lineEdit)
|
self.horizontal_layout_2.addWidget(self.line_edit)
|
||||||
self.label_2 = QtWidgets.QLabel(dialog)
|
self.label_2 = QtWidgets.QLabel(dialog)
|
||||||
self.label_2.setObjectName("label_2")
|
self.label_2.setObjectName("label_2")
|
||||||
self.horizontalLayout_2.addWidget(self.label_2)
|
self.horizontal_layout_2.addWidget(self.label_2)
|
||||||
self.lineEdit_2 = QtWidgets.QLineEdit(dialog)
|
self.line_edit_2 = QtWidgets.QLineEdit(dialog)
|
||||||
self.lineEdit_2.setObjectName("lineEdit_2")
|
self.line_edit_2.setObjectName("line_edit_2")
|
||||||
self.horizontalLayout_2.addWidget(self.lineEdit_2)
|
self.horizontal_layout_2.addWidget(self.line_edit_2)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
self.vertical_layout.addLayout(self.horizontal_layout_2)
|
||||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
self.horizontal_layout_3 = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.horizontal_layout_3.setObjectName("horizontal_layout_3")
|
||||||
self.pushButton = QtWidgets.QPushButton(dialog)
|
self.push_button = QtWidgets.QPushButton(dialog)
|
||||||
self.pushButton.setObjectName("pushButton")
|
self.push_button.setObjectName("push_button")
|
||||||
self.horizontalLayout.addWidget(self.pushButton)
|
self.horizontal_layout_3.addWidget(self.push_button)
|
||||||
self.pushButton_2 = QtWidgets.QPushButton(dialog)
|
self.push_button_2 = QtWidgets.QPushButton(dialog)
|
||||||
self.pushButton_2.setObjectName("pushButton_2")
|
self.push_button_2.setObjectName("push_button_2")
|
||||||
self.horizontalLayout.addWidget(self.pushButton_2)
|
self.horizontal_layout_3.addWidget(self.push_button_2)
|
||||||
self.pushButton_3 = QtWidgets.QPushButton(dialog)
|
self.push_button_3 = QtWidgets.QPushButton(dialog)
|
||||||
self.pushButton_3.setObjectName("pushButton_3")
|
self.push_button_3.setObjectName("push_button_3")
|
||||||
self.horizontalLayout.addWidget(self.pushButton_3)
|
self.horizontal_layout_3.addWidget(self.push_button_3)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.vertical_layout.addLayout(self.horizontal_layout_3)
|
||||||
|
self.verticalLayout.addLayout(self.vertical_layout)
|
||||||
|
|
||||||
self.retranslateUi(dialog)
|
self.retranslateUi(dialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(dialog)
|
QtCore.QMetaObject.connectSlotsByName(dialog)
|
||||||
@ -63,9 +76,9 @@ class Ui_dialog(object):
|
|||||||
dialog.setWindowTitle(_translate("dialog", "Dialog"))
|
dialog.setWindowTitle(_translate("dialog", "Dialog"))
|
||||||
self.label.setText(_translate("dialog", "Początek fragmentu"))
|
self.label.setText(_translate("dialog", "Początek fragmentu"))
|
||||||
self.label_2.setText(_translate("dialog", "Koniec fragemntu"))
|
self.label_2.setText(_translate("dialog", "Koniec fragemntu"))
|
||||||
self.pushButton.setText(_translate("dialog", "start"))
|
self.push_button.setText(_translate("dialog", "start"))
|
||||||
self.pushButton_2.setText(_translate("dialog", "stop"))
|
self.push_button_2.setText(_translate("dialog", "stop"))
|
||||||
self.pushButton_3.setText(_translate("dialog", "zakończ"))
|
self.push_button_3.setText(_translate("dialog", "zakończ"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user