2023-06-11 22:50:01 +02:00
|
|
|
# This Python file uses the following encoding: utf-8
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from PySide6.QtWidgets import QApplication, QMainWindow
|
|
|
|
|
|
|
|
# Important:
|
|
|
|
# You need to run the following command to generate the ui_form.py file
|
|
|
|
# pyside6-uic form.ui -o ui_form.py, or
|
|
|
|
# pyside2-uic form.ui -o ui_form.py
|
|
|
|
from ui_form import Ui_MainWindow
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
|
|
class MainWindow(QMainWindow):
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
super().__init__(parent)
|
|
|
|
self.ui = Ui_MainWindow()
|
|
|
|
self.ui.setupUi(self)
|
2023-06-12 20:34:50 +02:00
|
|
|
self.getGroups()
|
2023-06-11 22:50:01 +02:00
|
|
|
|
2023-06-12 20:34:50 +02:00
|
|
|
def getGroups(self):
|
2023-06-11 22:50:01 +02:00
|
|
|
resp = requests.get("https://open.fm/radio/api/v2/ofm/stations_slug.json")
|
|
|
|
json_ = json.loads(resp.text)
|
|
|
|
for el in json_["groups"]:
|
2023-06-12 20:34:50 +02:00
|
|
|
self.ui.groupslistWidget.addItem(el["name"])
|
2023-06-11 22:50:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
widget = MainWindow()
|
|
|
|
widget.show()
|
|
|
|
sys.exit(app.exec())
|