Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: play_card function with second_swipe support #2330

Open
wants to merge 4 commits into
base: future3/develop
Choose a base branch
from

Conversation

pabera
Copy link
Collaborator

@pabera pabera commented Apr 10, 2024

Until now, 3 functions existed to be registered to a card: play_single, play_album and play_folder. None of these functions supported "Second Swipe". Instead, another function existed, called play_card which had Second Swipe support, but it ended up to call play_folder, ingoring the other 2 functions all together

This PR aims at solving this problem and to prepare for hoffie@c4805ce

  • Refactor play_card in PlayerMPD
  • Adapting UI to assign only play_card command instead of play_single, play_album or play_folder
  • Handle cards.yaml and rewrite commands to use play_card

@pabera pabera self-assigned this Apr 10, 2024
@pabera pabera added the future3 Relates to future3 development label Apr 10, 2024
@pabera pabera added this to the v3.6 milestone Apr 10, 2024
pabera referenced this pull request in hoffie/RPi-Jukebox-RFID Apr 10, 2024
@AlvinSchiller
Copy link
Collaborator

Regarding "second swipe":
I found it strange that it's implemented in the player, and that it also is triggered for the UI playback (apart its name).

That's definitely another behaviour known from V2.

Nevertheless would it not make more sense that it is an option on the folder/card, then an overall state? So different cards could have different settings?

@pabera
Copy link
Collaborator Author

pabera commented Apr 11, 2024

I found it strange that it's implemented in the player

I agree

.. and that it also is triggered for the UI playback (apart its name).

I don't think that's the case. See below explanation.

That's definitely another behaviour known from V2.

I haven't deep dived into the v2 implementation much.

Nevertheless would it not make more sense that it is an option on the folder/card, then an overall state? So different cards could have different settings?

I agree


Intuitively, we opted for the commands play_single, play_album, and play_folder in the UI and for card assignments, rather than using the existing play_card function. The latter served as a wrapper for a combination of a Second Swipe event and play_folder.

Initially, I questioned the necessity of play_card. It seemed feasible to integrate the second swipe functionality directly into play_single, play_album, and play_folder. However, this approach doesn't align with our intentions. If the non-play_card commands are executed from the UI, we aim to avoid triggering a Second Swipe event (as Alvin Schiller pointed out, if I understand correctly). Conversely, if the command is activated via the RFID reader, it should trigger a Second Swipe, depending on certain configurations. For the moment, let's set aside the discussion on configurations (though I concur that a default Second Swipe event should exist, with the possibility of being customized within individual card commands).

Nonetheless, combining the play_album (Player event) with a second_swipe (RFID event) could result in a next (Player event), as illustrated below:

if(second_swipe): next() # Avoid triggering play_album()

This is likely the rationale behind the original implementation within the Player, as it was the only entity capable of managing this logic.

I am dissatisfied with the current implementation of the second swipe functionality and propose its removal, with the intention of reintroducing it in a separate PR.

@pabera pabera changed the title Fix play_card function with second_swipe support fix: play_card function with second_swipe support Apr 12, 2024
@s-martin s-martin linked an issue Apr 15, 2024 that may be closed by this pull request
@s-martin
Copy link
Collaborator

#1698 is related and probably needs to be considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future3 Relates to future3 development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Second swipe defect after playlist runs out
3 participants