-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Tastyep/develop
Develop
- Loading branch information
Showing
56 changed files
with
796 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ class QueueVideo(Command): | |
|
||
|
||
@command | ||
class StopVideo(Command): | ||
class StopPlayer(Command): | ||
pass | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import structlog | ||
from OpenCast.app.command import player as Cmd | ||
from OpenCast.domain.service.identity import IdentityService | ||
from OpenCast.infra.event import player as player_events | ||
|
||
from .controller import Controller | ||
|
||
|
||
class PlayerController(Controller): | ||
def __init__(self, app_facade, data_facade): | ||
super(PlayerController, self).__init__(app_facade) | ||
|
||
self._logger = structlog.get_logger(__name__) | ||
self._player_repo = data_facade.player_repo | ||
self._video_repo = data_facade.video_repo | ||
|
||
self._observe(player_events) | ||
|
||
# Infra event handler interface implementation | ||
|
||
def _media_end_reached(self, evt): | ||
model = self._player_repo.get_player() | ||
video = model.next_video() | ||
if video is None: | ||
self._dispatch(Cmd.StopPlayer) | ||
else: | ||
self._dispatch(Cmd.PlayVideo, video.id) | ||
|
||
def _dispatch(self, cmd_cls, *args, **kwargs): | ||
player_id = IdentityService.id_player() | ||
return super(PlayerController, self)._dispatch( | ||
cmd_cls, player_id, *args, **kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.