forked from trav/lintunes
v0.57.0: repeat button; AirPlay compatibility handshake for third-party speakers
- Transport: a repeat button (off / all / one) between shuffle and the visualizer. Repeat-all wraps the walk (a shuffled one is reshuffled per lap); repeat-one replays a song that finishes, Next/Previous still move. BPM button and the now-playing minimum shrink to make room. - Clicking the streaming tile to stop casting/AirPlay no longer also opens the big visualizer (the release after the stop counted as a click). - AirPlay: pyatv's AirPlay 2 session is silent on a WiiM, and its AirPlay 1 pairs then talks plaintext, which the WiiM hangs up on. Non-Apple speakers now get cliraop's handshake: auth-setup, no pairing, ALAC (uncompressed frames). airplay_protocol "2" keeps pyatv's AirPlay 2.
This commit is contained in:
@@ -11,6 +11,7 @@ from lintunes.tap_tempo import TapTempo
|
||||
from lintunes.gui.icons import transport_icon
|
||||
from lintunes.gui.track_table import format_time
|
||||
from lintunes.gui.visualizer import VisualizerWidget
|
||||
from lintunes.player import REPEAT_MODES
|
||||
from lintunes import theme
|
||||
|
||||
|
||||
@@ -24,7 +25,7 @@ ROW_GAP = 4
|
||||
# each pair and after the last, always. The now-playing panel (and the seek
|
||||
# row under it) takes all the width that's left.
|
||||
GAP = 16
|
||||
NOW_PLAYING_MIN = 180
|
||||
NOW_PLAYING_MIN = 150
|
||||
|
||||
# Shared height for the boxed side controls (transport, shuffle, bpm) and the
|
||||
# visualizer, so they line up. ~midway between their old heights: the stretchy
|
||||
@@ -210,7 +211,7 @@ class BpmButton(QPushButton):
|
||||
self._manager = manager
|
||||
self._tempo = TapTempo()
|
||||
self._target_track_id: int | None = None
|
||||
self.setFixedWidth(74) # + the box's 3 px margins = its old footprint
|
||||
self.setFixedWidth(52) # shuffle and repeat's width: "bpm" or 3 digits
|
||||
self.setFlat(True) # flat text inside its box, like the transport icons
|
||||
self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
||||
self.setEnabled(False)
|
||||
@@ -415,6 +416,19 @@ class TransportBar(QWidget):
|
||||
layout.addWidget(shuffle_box, alignment=TOP)
|
||||
gap()
|
||||
|
||||
# Repeat cycles off → all → one, like iTunes': lit while on, with a
|
||||
# "1" in the loop for one.
|
||||
self._repeat_btn = FlashButton("repeat")
|
||||
self._repeat_btn.setMinimumWidth(50)
|
||||
self._repeat_btn.setCheckable(True)
|
||||
self._repeat_btn.clicked.connect(self._cycle_repeat)
|
||||
repeat_box = _box(self._repeat_btn, bg=box_bg, margins=(3, 3, 3, 3),
|
||||
height=CONTROL_HEIGHT, split=True)
|
||||
self._boxes.append(repeat_box)
|
||||
layout.addWidget(repeat_box, alignment=TOP)
|
||||
self._show_repeat(player.repeat_mode())
|
||||
gap()
|
||||
|
||||
self._visualizer = VisualizerWidget(player, prefs)
|
||||
self._visualizer.setFixedHeight(CONTROL_HEIGHT)
|
||||
layout.addWidget(self._visualizer, alignment=TOP)
|
||||
@@ -517,7 +531,8 @@ class TransportBar(QWidget):
|
||||
hug=True, height=CONTROL_HEIGHT, split=True)
|
||||
self._boxes.append(bpm_box)
|
||||
layout.addWidget(bpm_box, alignment=TOP)
|
||||
self._fixed_controls = (transport_box, shuffle_box, self._visualizer,
|
||||
self._fixed_controls = (transport_box, shuffle_box, repeat_box,
|
||||
self._visualizer,
|
||||
self._volume_slider, bpm_box)
|
||||
|
||||
# Library button · the current view's header · seek row. MainWindow
|
||||
@@ -550,6 +565,23 @@ class TransportBar(QWidget):
|
||||
lambda: (cast.disconnect(),
|
||||
airplay is not None and airplay.disconnect()))
|
||||
|
||||
# ---- repeat ----
|
||||
|
||||
_REPEAT_TIPS = {"off": "Repeat: off", "all": "Repeat: all",
|
||||
"one": "Repeat: this song"}
|
||||
|
||||
def _cycle_repeat(self):
|
||||
modes = REPEAT_MODES
|
||||
mode = modes[(modes.index(self._player.repeat_mode()) + 1) % len(modes)]
|
||||
self._player.set_repeat(mode)
|
||||
self._show_repeat(mode)
|
||||
|
||||
def _show_repeat(self, mode: str):
|
||||
# The click already toggled the check; the mode decides it.
|
||||
self._repeat_btn.setChecked(mode != "off")
|
||||
self._repeat_btn.set_kind("repeat_one" if mode == "one" else "repeat")
|
||||
self._repeat_btn.setToolTip(self._REPEAT_TIPS[mode])
|
||||
|
||||
# ---- the header row ----
|
||||
|
||||
def set_sidebar_header(self, widget: QWidget):
|
||||
@@ -634,7 +666,7 @@ class TransportBar(QWidget):
|
||||
color), the tunable grayscale button boxes, and the now-playing panel
|
||||
background + text color."""
|
||||
for button in (self._prev_btn, self._play_btn, self._next_btn,
|
||||
self._shuffle_btn):
|
||||
self._shuffle_btn, self._repeat_btn):
|
||||
button.refresh_icons()
|
||||
box_bg = theme.gray(theme.gray_value(self._prefs, "color_button"))
|
||||
for box in self._boxes:
|
||||
|
||||
Reference in New Issue
Block a user