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

Post-play enhancements #315

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ def shouldShowPostPlay(self):
if self.playlist and self.playlist.TYPE == 'playlist':
return False

if self.player.video.duration.asInt() <= FIVE_MINUTES_MILLIS:
if (not util.advancedSettings.postplayAlways and self.player.video.duration.asInt() <= FIVE_MINUTES_MILLIS)\
or util.advancedSettings.postplayTimeout <= 0:
return False

return True
Expand Down
2 changes: 2 additions & 0 deletions lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class AdvancedSettings(object):
("auto_seek", True),
("dynamic_timeline_seek", False),
("fast_back", False),
("postplay_always", False),
("postplay_timeout", 16),
)

def __init__(self):
Expand Down
9 changes: 6 additions & 3 deletions lib/windows/videoplayer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import
import time
import threading
import math

from kodi_six import xbmc
from kodi_six import xbmcgui
Expand Down Expand Up @@ -316,8 +317,8 @@ def startTimer(self):
millis = (self.passoutProtection - time.time()) * 1000
util.DEBUG_LOG('Post play auto-play: Passout protection in {0}'.format(util.durationToShortText(millis)))

util.DEBUG_LOG('Staring post-play timer')
self.timeout = time.time() + 16
util.DEBUG_LOG('Starting post-play timer')
self.timeout = time.time() + abs(util.advancedSettings.postplayTimeout)
threading.Thread(target=self.countdown).start()

def cancelTimer(self):
Expand All @@ -341,7 +342,9 @@ def countdown(self):
# self.playVideo()
break
elif self.timeout is not None:
self.setProperty('countdown', str(min(15, int((self.timeout or now) - now))))
cd = min(abs(util.advancedSettings.postplayTimeout-1), int((self.timeout or now) - now))
base = 15 / float(util.advancedSettings.postplayTimeout-1)
self.setProperty('countdown', str(int(math.ceil(base*cd))))

def getHubs(self):
try:
Expand Down
10 changes: 9 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -977,4 +977,12 @@ msgstr ""

msgctxt "#32492"
msgid "Kodi Subtitle Settings"
msgstr ""
msgstr ""

msgctxt "#32500"
msgid "Always show post-play screen (even for short videos)"
msgstr ""

msgctxt "#32501"
msgid "Time-to-wait between videos on post-play"
msgstr ""
2 changes: 2 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<setting id="auto_seek" type="bool" label="32466" default="true" />
<setting id="kodi_skip_stepping" type="bool" label="32465" default="false" />
<setting id="dynamic_timeline_seek" type="bool" label="32471" default="false" />
<setting id="postplay_always" type="bool" label="32500" default="false" />
<setting id="postplay_timeout" type="number" label="32501" default="16" />
</category>
<category label="32467">
<setting id="fast_back" type="bool" label="32485" default="false" />
Expand Down