function to check if all the songs are there - temporary
parent
ccf1b2b53f
commit
c31e2f2b88
|
@ -94,7 +94,7 @@ class OptionsWidget(QWidget):
|
|||
# Update widget
|
||||
self.update_widget = UpdateWidget()
|
||||
# Install widget
|
||||
self.install_widget = InstallWidget()
|
||||
self.install_widget = InstallWidget(self)
|
||||
|
||||
layout = QVBoxLayout()
|
||||
layout.addWidget(self.name_gbox)
|
||||
|
@ -441,8 +441,10 @@ class UpdateWidget(QWidget):
|
|||
|
||||
|
||||
class InstallWidget(QWidget):
|
||||
def __init__(self):
|
||||
def __init__(self, parent: QWidget):
|
||||
super().__init__()
|
||||
|
||||
self.parent = parent
|
||||
self.grid = QGridLayout()
|
||||
|
||||
hr_html_string = "<hr style=\"background-color:gray;\">"
|
||||
|
@ -466,6 +468,7 @@ class InstallWidget(QWidget):
|
|||
self.songs_download_label = QLabel("Download songs and process them")
|
||||
self.songs_download_dir = DirWidget("./build/music")
|
||||
self.songs_download_pushbutton = QPushButton("Download")
|
||||
self.songs_download_pushbutton.clicked.connect(self.are_songs_ready)
|
||||
self.grid.addWidget(self.songs_download_checkbox, 20, 0)
|
||||
self.grid.addWidget(self.songs_download_label, 20, 1)
|
||||
self.grid.addWidget(self.songs_download_pushbutton, 20, 2)
|
||||
|
@ -521,6 +524,21 @@ class InstallWidget(QWidget):
|
|||
download_ffmpeg(self.ffmpeg_dir.directory)
|
||||
self.does_ffmpeg_exist()
|
||||
|
||||
def are_songs_ready(self):
|
||||
tapes = self.parent.parent.validation_widget.tapes
|
||||
|
||||
files = Path(self.songs_download_dir.directory).glob("*.ogg")
|
||||
files = [f.stem for f in files]
|
||||
|
||||
for tape in tapes:
|
||||
tape_name = tape["identifier"]
|
||||
if not tape_name in files:
|
||||
return False
|
||||
if not f"{tape_name}-walkman" in files and self.parent.options["walkmans"]:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
class DebugDialog(QDialog):
|
||||
def __init__(self, text):
|
||||
super().__init__()
|
||||
|
|
Loading…
Reference in New Issue