-
Notifications
You must be signed in to change notification settings - Fork 397
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
Introduce new PlayContentHandler to abstract Second Swipe #2452
base: future3/develop
Are you sure you want to change the base?
Introduce new PlayContentHandler to abstract Second Swipe #2452
Conversation
@AlvinSchiller @s-martin @damaev I think this code gets closer to "Second Swipe". But I have a doubt. See the following Flow Chart. It makes me think.. "Second Swipe" should only be considered if the action comes from RFID (or other reader), nothing else. E.g. swiping a card triggers this command: But when I navigate in the WebApp to the same album of the same artist, the command that would trigger is the same. That would be considered a "Second Swipe", at least for now. And I don't seem to be able to find a distinguisher. Thoughts? flowchart TD
Start(["External Call<br>(e.g., Web UI, RFID)"]) --> playContent["player.play_content()<br>content, type, recursive"]
subgraph PlayerMPD
playContent --> validateContent["Validate content and create<br>PlayContent object"]
validateContent --> handlerPlay["play_content_handler.play_content()"]
end
subgraph PlayContentHandler
handlerPlay --> checkLastContent{"Is last_played_content<br>stored?"}
checkLastContent -- "No" --> FirstSwipe["First Swipe:<br>- Run firstSwipe callbacks<br>- Play content<br>- Store as last_played_content"]
checkLastContent -- "Yes" --> compareContent{"Is current content<br>same as last_played_content?"}
compareContent -- "No" --> FirstSwipe
compareContent -- "Yes" --> checkAction{"Is second_swipe_action<br>configured?"}
checkAction -- "No" --> FirstSwipe
checkAction -- "Yes" --> SecondSwipe["Second Swipe:<br>- Run secondSwipe callbacks<br>- Execute second_swipe_action"]
end
FirstSwipe --> End(["Content Playing"])
SecondSwipe --> End
|
I agree with your observations. Right now I don’t see a use case for second swipe from the web UI (or maybe MQTT?). Looks like the simple (but maybe not so pretty) approach could be to pass an argument, if the call comes from an rfid reader. |
I like the idea so far. But i also think, triggering the "second swipe" from the ui, is not really a usecase, and could cause more confusion. So there needs to be a parameter, or a different function, to opt-in second swipe. Also there are other features, that are mainly build for card swipes, like the syncing (triggered through play_card_callbacks). |
Pull Request Test Coverage Report for Build 11878660465Details
💛 - Coveralls |
Replaces abandoned #2330
Until now, 3 functions existed to be registered to content:
play_single
,play_album
andplay_folder
. None of these functions supported "Second Swipe". Instead, another function existed, calledplay_card
which had Second Swipe support, but it ended up to callplay_folder
, igoring the other 2 functions all together.play_single
,play_album
orplay_folder
inPlayerMPD
to becomeplay_content
play_content
commandplay_content
(Backwards compatibility)Maybe to be considered from old PR