Add auto skip intro functionality

This commit is contained in:
Christopher Kaliszewski 2021-10-24 01:50:15 -04:00
parent 9f18288e80
commit 20e6a3d24c
28 changed files with 164 additions and 31 deletions

View file

@ -1676,3 +1676,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Nahradit uživatelské hodnocení počtem verzí média" msgstr "Nahradit uživatelské hodnocení počtem verzí média"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1684,3 +1684,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Erstat brugerbedømmelser med antal af medieversioner" msgstr "Erstat brugerbedømmelser med antal af medieversioner"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1713,3 +1713,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Benutzerbewertungen durch verfügbare Anzahl Versionen ersetzen" msgstr "Benutzerbewertungen durch verfügbare Anzahl Versionen ersetzen"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1601,3 +1601,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1501,3 +1501,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1699,3 +1699,8 @@ msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Reemplazar valoraciones de usuario con cantidad de versiones de medios" "Reemplazar valoraciones de usuario con cantidad de versiones de medios"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1701,3 +1701,8 @@ msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Reemplazar valoraciones de usuario con cantidad de versiones de medios" "Reemplazar valoraciones de usuario con cantidad de versiones de medios"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1699,3 +1699,8 @@ msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Reemplazar valoraciones de usuario con cantidad de versiones de medios" "Reemplazar valoraciones de usuario con cantidad de versiones de medios"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1719,3 +1719,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Remplacer les notes d'utilisateurs par le nombre de versions du média" msgstr "Remplacer les notes d'utilisateurs par le nombre de versions du média"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1723,3 +1723,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Remplacer les notes d'utilisateurs par le nombre de versions du média" msgstr "Remplacer les notes d'utilisateurs par le nombre de versions du média"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1712,3 +1712,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Felhasználói osztályzatok lecserélése a médiaverziók számára" msgstr "Felhasználói osztályzatok lecserélése a médiaverziók számára"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1711,3 +1711,8 @@ msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Sostituisci la valutazione contenuti con il numero delle versioni del " "Sostituisci la valutazione contenuti con il numero delle versioni del "
"contenuto disponibili" "contenuto disponibili"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1632,3 +1632,8 @@ msgstr "사용자 지정 사용자 등급을 보유하고있는 미디어 항목
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "사용자 등급을 미디어 버전 수로 대체" msgstr "사용자 등급을 미디어 버전 수로 대체"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1697,3 +1697,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Pakeiskite naudotojų reitingus medijos versijų skaičiumi" msgstr "Pakeiskite naudotojų reitingus medijos versijų skaičiumi"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1632,3 +1632,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1683,3 +1683,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Vervang ratings met aantal media versies" msgstr "Vervang ratings met aantal media versies"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1677,3 +1677,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Erstatt rating med antall versjoner av media" msgstr "Erstatt rating med antall versjoner av media"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1606,3 +1606,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1674,3 +1674,8 @@ msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Substituir classificações do utilizador com numero de versões de média" "Substituir classificações do utilizador com numero de versões de média"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1677,3 +1677,8 @@ msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
"Substituir classificações do utilizador com numero de versões de média" "Substituir classificações do utilizador com numero de versões de média"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1691,3 +1691,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Заменить пользовательский рейтинг счетчиком версий элемента" msgstr "Заменить пользовательский рейтинг счетчиком версий элемента"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1685,3 +1685,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Ersätt användarbetyg med antalet mediaobjekt" msgstr "Ersätt användarbetyg med antalet mediaobjekt"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1691,3 +1691,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "Замінити користувацький рейтинг лічильником версій елемента" msgstr "Замінити користувацький рейтинг лічильником версій елемента"
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1602,3 +1602,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1598,3 +1598,8 @@ msgstr ""
msgctxt "#39719" msgctxt "#39719"
msgid "Replace user ratings with number of media versions" msgid "Replace user ratings with number of media versions"
msgstr "" msgstr ""
# PKC Settings - Playback
msgctxt "#39720"
msgid "Auto skip intro"
msgstr ""

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from .windows.skip_intro import SkipIntroDialog from .windows.skip_intro import SkipIntroDialog
from . import app, variables as v from . import app, utils, variables as v
def skip_intro(intros): def skip_intro(intros):
@ -20,6 +20,10 @@ def skip_intro(intros):
'default', 'default',
'1080i', '1080i',
intro_end=end) intro_end=end)
if utils.settings('enableAutoSkipIntro') == "true":
app.APP.skip_intro_dialog.seekTimeToIntroEnd()
else:
app.APP.skip_intro_dialog.show() app.APP.skip_intro_dialog.show()
elif not in_intro and app.APP.skip_intro_dialog is not None: elif not in_intro and app.APP.skip_intro_dialog is not None:
app.APP.skip_intro_dialog.close() app.APP.skip_intro_dialog.close()

View file

@ -36,12 +36,15 @@ class SkipIntroDialog(WindowXMLDialog):
logger.debug('Closing dialog') logger.debug('Closing dialog')
WindowXMLDialog.close(self) WindowXMLDialog.close(self)
def seekTimeToIntroEnd(self):
logger.info('Skipping intro, seeking to %s', self.intro_end)
app.APP.player.seekTime(self.intro_end)
def onClick(self, control_id): # pylint: disable=invalid-name def onClick(self, control_id): # pylint: disable=invalid-name
if self.intro_end and control_id == 3002: # 3002 = Skip Intro button if self.intro_end and control_id == 3002: # 3002 = Skip Intro button
if app.APP.is_playing: if app.APP.is_playing:
self.on_hold = True self.on_hold = True
logger.info('Skipping intro, seeking to %s', self.intro_end) self.seekTimeToIntroEnd()
app.APP.player.seekTime(self.intro_end)
self.close() self.close()
def onAction(self, action): # pylint: disable=invalid-name def onAction(self, action): # pylint: disable=invalid-name

View file

@ -114,6 +114,7 @@
<setting id="askCinema" type="bool" label="30519" default="false" visible="eq(-1,true)" subsetting="true" /> <setting id="askCinema" type="bool" label="30519" default="false" visible="eq(-1,true)" subsetting="true" />
<setting id="trailerNumber" type="slider" label="39000" default="3" visible="eq(-2,true)" range="1,1,15" option="int" /> <setting id="trailerNumber" type="slider" label="39000" default="3" visible="eq(-2,true)" range="1,1,15" option="int" />
<setting id="enableSkipIntro" type="bool" label="30525" default="true" /><!-- Enable skipping of intros --> <setting id="enableSkipIntro" type="bool" label="30525" default="true" /><!-- Enable skipping of intros -->
<setting id="enableAutoSkipIntro" type="bool" label="39720" default="false" visible="eq(-1,true)" subsetting="true" /><!-- Enable auto skipping of intros -->
<setting id="firstVideoStream" type="bool" label="30546" default="false" /><!-- Pick the first video if several versions are present --> <setting id="firstVideoStream" type="bool" label="30546" default="false" /><!-- Pick the first video if several versions are present -->
<setting id="audioStreamPick" type="enum" label="30547" values="Plex|Kodi" default="0" /><!-- Who picks the audio stream on playback start? --> <setting id="audioStreamPick" type="enum" label="30547" values="Plex|Kodi" default="0" /><!-- Who picks the audio stream on playback start? -->
<setting id="subtitleStreamPick" type="enum" label="30548" values="Plex|Kodi" default="0" /><!-- Who picks subtitles on playback start? --> <setting id="subtitleStreamPick" type="enum" label="30548" values="Plex|Kodi" default="0" /><!-- Who picks subtitles on playback start? -->