patch player
This commit is contained in:
parent
45267b7c7e
commit
cb7f769f79
@ -40,9 +40,14 @@ class MediaScreen(QWidget):
|
|||||||
self.artist.setObjectName("MediaArtist")
|
self.artist.setObjectName("MediaArtist")
|
||||||
self.artist.setFont(QFont("", 16, 600))
|
self.artist.setFont(QFont("", 16, 600))
|
||||||
|
|
||||||
|
self.album = QLabel("Альбом")
|
||||||
|
self.album.setObjectName("MediaAlbum")
|
||||||
|
self.album.setFont(QFont("", 14, 600))
|
||||||
|
|
||||||
info_col.addWidget(self.source)
|
info_col.addWidget(self.source)
|
||||||
info_col.addWidget(self.title)
|
info_col.addWidget(self.title)
|
||||||
info_col.addWidget(self.artist)
|
info_col.addWidget(self.artist)
|
||||||
|
info_col.addWidget(self.album)
|
||||||
info_col.addStretch(1)
|
info_col.addStretch(1)
|
||||||
|
|
||||||
cover = QLabel("COVER")
|
cover = QLabel("COVER")
|
||||||
@ -89,10 +94,10 @@ class MediaScreen(QWidget):
|
|||||||
btn_prev.setFixedSize(QSize(72, 72))
|
btn_prev.setFixedSize(QSize(72, 72))
|
||||||
btn_prev.clicked.connect(self._prev)
|
btn_prev.clicked.connect(self._prev)
|
||||||
|
|
||||||
btn_play = QPushButton("▶")
|
self.btn_play = QPushButton("▶")
|
||||||
btn_play.setObjectName("MediaTransportBtnPrimary")
|
self.btn_play.setObjectName("MediaTransportBtnPrimary")
|
||||||
btn_play.setFixedSize(QSize(96, 72))
|
self.btn_play.setFixedSize(QSize(96, 72))
|
||||||
btn_play.clicked.connect(self._toggle_play)
|
self.btn_play.clicked.connect(self._toggle_play)
|
||||||
|
|
||||||
btn_next = QPushButton("⏭")
|
btn_next = QPushButton("⏭")
|
||||||
btn_next.setObjectName("MediaTransportBtn")
|
btn_next.setObjectName("MediaTransportBtn")
|
||||||
@ -101,7 +106,7 @@ class MediaScreen(QWidget):
|
|||||||
|
|
||||||
transport.addStretch(1)
|
transport.addStretch(1)
|
||||||
transport.addWidget(btn_prev)
|
transport.addWidget(btn_prev)
|
||||||
transport.addWidget(btn_play)
|
transport.addWidget(self.btn_play)
|
||||||
transport.addWidget(btn_next)
|
transport.addWidget(btn_next)
|
||||||
transport.addStretch(1)
|
transport.addStretch(1)
|
||||||
|
|
||||||
@ -173,9 +178,11 @@ class MediaScreen(QWidget):
|
|||||||
out = self._run_btctl(["menu player", "show"])
|
out = self._run_btctl(["menu player", "show"])
|
||||||
title = None
|
title = None
|
||||||
artist = None
|
artist = None
|
||||||
|
album = None
|
||||||
source = None
|
source = None
|
||||||
position = None
|
position = None
|
||||||
duration = None
|
duration = None
|
||||||
|
status = None
|
||||||
for line in out.splitlines():
|
for line in out.splitlines():
|
||||||
if "Name:" in line:
|
if "Name:" in line:
|
||||||
source = line.split("Name:", 1)[1].strip()
|
source = line.split("Name:", 1)[1].strip()
|
||||||
@ -183,14 +190,20 @@ class MediaScreen(QWidget):
|
|||||||
title = line.split("Track.Title:", 1)[1].strip()
|
title = line.split("Track.Title:", 1)[1].strip()
|
||||||
if "Track.Artist:" in line:
|
if "Track.Artist:" in line:
|
||||||
artist = line.split("Track.Artist:", 1)[1].strip()
|
artist = line.split("Track.Artist:", 1)[1].strip()
|
||||||
|
if "Track.Album:" in line:
|
||||||
|
album = line.split("Track.Album:", 1)[1].strip()
|
||||||
if "Position:" in line:
|
if "Position:" in line:
|
||||||
position = self._parse_hex_value(line)
|
position = self._parse_hex_value(line)
|
||||||
if "Track.Duration:" in line:
|
if "Track.Duration:" in line:
|
||||||
duration = self._parse_hex_value(line)
|
duration = self._parse_hex_value(line)
|
||||||
|
if "Status:" in line:
|
||||||
|
status = line.split("Status:", 1)[1].strip()
|
||||||
if title:
|
if title:
|
||||||
self.title.setText(title)
|
self.title.setText(title)
|
||||||
if artist:
|
if artist:
|
||||||
self.artist.setText(artist)
|
self.artist.setText(artist)
|
||||||
|
if album:
|
||||||
|
self.album.setText(album)
|
||||||
if source:
|
if source:
|
||||||
self.source.setText(f"Источник: {source}")
|
self.source.setText(f"Источник: {source}")
|
||||||
if duration is not None and duration > 0:
|
if duration is not None and duration > 0:
|
||||||
@ -199,6 +212,8 @@ class MediaScreen(QWidget):
|
|||||||
if position is not None:
|
if position is not None:
|
||||||
self.progress.setValue(position)
|
self.progress.setValue(position)
|
||||||
self.time_pos.setText(self._format_time(position))
|
self.time_pos.setText(self._format_time(position))
|
||||||
|
if status:
|
||||||
|
self.btn_play.setText("⏸" if status == "playing" else "▶")
|
||||||
|
|
||||||
def _run_btctl(self, commands: list[str]) -> str:
|
def _run_btctl(self, commands: list[str]) -> str:
|
||||||
script = "\n".join(commands + ["back", "quit"]) + "\n"
|
script = "\n".join(commands + ["back", "quit"]) + "\n"
|
||||||
|
|||||||
@ -62,6 +62,7 @@ QWidget { background: #F4F6F8; color: #111827; }
|
|||||||
#MediaSource { color: rgba(107,114,128,0.95); }
|
#MediaSource { color: rgba(107,114,128,0.95); }
|
||||||
#MediaTitle { color: #111827; }
|
#MediaTitle { color: #111827; }
|
||||||
#MediaArtist { color: rgba(55,65,81,0.95); }
|
#MediaArtist { color: rgba(55,65,81,0.95); }
|
||||||
|
#MediaAlbum { color: rgba(107,114,128,0.95); }
|
||||||
#MediaCover {
|
#MediaCover {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border: 1px solid #E5E7EB;
|
border: 1px solid #E5E7EB;
|
||||||
|
|||||||
@ -57,6 +57,7 @@ QWidget { background: #0B0E11; color: #E6EAF0; }
|
|||||||
#MediaSource { color: rgba(138,147,166,0.95); }
|
#MediaSource { color: rgba(138,147,166,0.95); }
|
||||||
#MediaTitle { color: #E6EAF0; }
|
#MediaTitle { color: #E6EAF0; }
|
||||||
#MediaArtist { color: rgba(200,208,222,0.95); }
|
#MediaArtist { color: rgba(200,208,222,0.95); }
|
||||||
|
#MediaAlbum { color: rgba(138,147,166,0.95); }
|
||||||
#MediaCover {
|
#MediaCover {
|
||||||
background: #141A22;
|
background: #141A22;
|
||||||
border: 1px solid #1B2330;
|
border: 1px solid #1B2330;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user