Skip to content

Commit

Permalink
Merge 5e64a51 into 3b9f7cb
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-kraus committed Jun 28, 2023
2 parents 3b9f7cb + 5e64a51 commit 50a3bc6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions androidtv/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ class DeviceEnum(IntEnum):
APP_TED = "com.ted.android.tv"
APP_TUNEIN = "tunein.player"
APP_TVHEADEND = "de.cyberdream.dreamepg.tvh.tv.player"
APP_TVNOW = "de.cbc.tvnow.firetv"
APP_TWITCH = "tv.twitch.android.app"
APP_TWITCH_FIRETV = "tv.twitch.android.viewer"
APP_VEVO = "com.vevo.tv"
Expand Down Expand Up @@ -576,6 +577,7 @@ class DeviceEnum(IntEnum):
APP_TED: "TED",
APP_TUNEIN: "TuneIn Radio",
APP_TVHEADEND: "DreamPlayer TVHeadend",
APP_TVNOW: "TV NOW",
APP_TWITCH: "Twitch",
APP_TWITCH_FIRETV: "Twitch (FireTV)",
APP_VEVO: "Vevo",
Expand Down
11 changes: 11 additions & 0 deletions androidtv/firetv/base_firetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ def _update(self, screen_on, awake, wake_lock_size, current_app, media_session_s
else:
state = constants.STATE_IDLE

# TV NOW (Germany)
elif current_app == constants.APP_TVNOW:
if wake_lock_size == 3:
state = constants.STATE_PAUSED
elif wake_lock_size == 4:
state = constants.STATE_PLAYING
elif wake_lock_size == 5:
state = constants.STATE_PLAYING
else:
state = constants.STATE_IDLE

# Twitch
elif current_app == constants.APP_TWITCH_FIRETV:
if wake_lock_size == 2:
Expand Down
21 changes: 21 additions & 0 deletions tests/test_firetv_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,27 @@ def test_state_detection(self):
(constants.STATE_IDLE, constants.APP_SPOTIFY, [constants.APP_SPOTIFY], None),
)

# TV NOW (Germany)
self.assertUpdate(
[True, True, 3, constants.APP_TVNOW, 1, [constants.APP_TVNOW], None],
(constants.STATE_PAUSED, constants.APP_TVNOW, [constants.APP_TVNOW], None),
)

self.assertUpdate(
[True, True, 4, constants.APP_TVNOW, 1, [constants.APP_TVNOW], None],
(constants.STATE_PLAYING, constants.APP_TVNOW, [constants.APP_TVNOW], None),
)

self.assertUpdate(
[True, True, 5, constants.APP_TVNOW, 1, [constants.APP_TVNOW], None],
(constants.STATE_PLAYING, constants.APP_TVNOW, [constants.APP_TVNOW], None),
)

self.assertUpdate(
[True, True, 6, constants.APP_TVNOW, 1, [constants.APP_TVNOW], None],
(constants.STATE_IDLE, constants.APP_TVNOW, [constants.APP_TVNOW], None),
)

# Twitch
self.assertUpdate(
[True, True, 2, constants.APP_TWITCH_FIRETV, 3, [constants.APP_TWITCH_FIRETV], None],
Expand Down

0 comments on commit 50a3bc6

Please sign in to comment.