diff --git a/gui/gui.py b/gui/gui.py index d73c8dd..ad03099 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -301,6 +301,26 @@ class Ui_MainWindow(object): self.content.addWidget(self.collections_page) self.stream_page = QtWidgets.QWidget() self.stream_page.setObjectName("stream_page") + self.stream_page_lay = QtWidgets.QVBoxLayout(self.stream_page) + self.stream_page_lay.setContentsMargins(0, 0, 0, 0) + self.stream_page_lay.setObjectName("stream_page_lay") + self.stream_page_box_bt_widget = QtWidgets.QWidget(self.stream_page) + self.stream_page_box_bt_widget.setObjectName("stream_page_box_bt_widget") + self.stream_page_box_bt_lay = QtWidgets.QHBoxLayout(self.stream_page_box_bt_widget) + self.stream_page_box_bt_lay.setContentsMargins(0, -1, 0, 0) + self.stream_page_box_bt_lay.setObjectName("stream_page_box_bt_lay") + self.to_stream_url_box = QtWidgets.QLineEdit(self.stream_page_box_bt_widget) + self.to_stream_url_box.setMinimumSize(QtCore.QSize(0, 35)) + self.to_stream_url_box.setObjectName("to_stream_url_box") + self.stream_page_box_bt_lay.addWidget(self.to_stream_url_box) + self.play_stream_button = QtWidgets.QPushButton(self.stream_page_box_bt_widget) + self.play_stream_button.setMinimumSize(QtCore.QSize(70, 35)) + self.play_stream_button.setObjectName("play_stream_button") + self.stream_page_box_bt_lay.addWidget(self.play_stream_button) + self.stream_page_lay.addWidget(self.stream_page_box_bt_widget) + self.stream_logs_box = QtWidgets.QTextBrowser(self.stream_page) + self.stream_logs_box.setObjectName("stream_logs_box") + self.stream_page_lay.addWidget(self.stream_logs_box) self.content.addWidget(self.stream_page) self.collab_page = QtWidgets.QWidget() self.collab_page.setObjectName("collab_page") @@ -556,6 +576,8 @@ class Ui_MainWindow(object): self.collections_page_tabs.setTabText(self.collections_page_tabs.indexOf(self.collections_tab_in_tabs), _translate("MainWindow", "Collections")) self.edit_collections_paths_label.setText(_translate("MainWindow", "Double click row to edit path to collection")) self.collections_page_tabs.setTabText(self.collections_page_tabs.indexOf(self.edit_collections_tabs), _translate("MainWindow", "Edit collections")) + self.to_stream_url_box.setPlaceholderText(_translate("MainWindow", "URL (direct web file, YouTube or spotify link) or path to file")) + self.play_stream_button.setText(_translate("MainWindow", "Play")) self.play_options_group.setTitle(_translate("MainWindow", "Play options")) self.output_device_play_label.setText(_translate("MainWindow", "Output device (or virtual mic input)")) self.preview_device_play_label.setText(_translate("MainWindow", "Preview device (your headphones)")) diff --git a/gui/gui.ui b/gui/gui.ui index 3aaaa9f..695ad03 100644 --- a/gui/gui.ui +++ b/gui/gui.ui @@ -998,7 +998,66 @@ QListWidget:item:selected { - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 35 + + + + URL (direct web file, YouTube or spotify link) or path to file + + + + + + + + 70 + 35 + + + + Play + + + + + + + + + + + diff --git a/gui/modules/handlers/register.py b/gui/modules/handlers/register.py index e892061..497c652 100644 --- a/gui/modules/handlers/register.py +++ b/gui/modules/handlers/register.py @@ -7,6 +7,7 @@ from gui.modules import settings from gui.modules import restreammic from gui.modules import explorer from gui.modules import collections +from gui.modules import stream from modules.player.player import Player from modules.restream.restream import Restreamer @@ -19,3 +20,4 @@ def register_handlers(ui: Ui_MainWindow, MainWindow: QMainWindow, p: Player, rs: restreammic.register_handlers(ui, MainWindow, rs) explorer.register_handlers(ui, p) collections.register_handlers(ui, p) + stream.register_handlers(ui, p) diff --git a/gui/modules/stream/__init__.py b/gui/modules/stream/__init__.py new file mode 100644 index 0000000..d7ed779 --- /dev/null +++ b/gui/modules/stream/__init__.py @@ -0,0 +1 @@ +from .handlers import * diff --git a/gui/modules/stream/handlers.py b/gui/modules/stream/handlers.py new file mode 100644 index 0000000..aa276b5 --- /dev/null +++ b/gui/modules/stream/handlers.py @@ -0,0 +1,12 @@ +from gui.gui import Ui_MainWindow +from modules.player.player import Player + + +def register_handlers(ui: Ui_MainWindow, p: Player): + ui.play_stream_button.clicked.connect( + lambda: ( + p.set_media(ui.to_stream_url_box.text()), + ui.stream_logs_box.append(f"Playing {ui.to_stream_url_box.text()}"), + p.play(ui) + ) + )