Skip to content

Commit cb2264b

Browse files
authored
Merge pull request #2431 from icr8ions/matrix
[script.wadeysay] 0.0.11
2 parents 5e7fb21 + 29c9984 commit cb2264b

File tree

10 files changed

+1216
-0
lines changed

10 files changed

+1216
-0
lines changed

script.wadeysay/LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

script.wadeysay/addon.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
#
4+
# Copyright (C) 2023 iCR8IONS LLC www.icr8ions.com
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
# part of an addon called script.wadyasay for Kodi - https://kodi.tv
20+
21+
# pylint: disable=C0103
22+
23+
""" entry point invoked by Kodi """
24+
25+
from wadeysay import wadeysay
26+
27+
wadeysay()

script.wadeysay/addon.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<addon id="script.wadeysay" name="wadeysay" version="0.0.11" provider-name="iCR8IONS LLC www.icr8ions.com">
3+
<requires>
4+
<import addon="xbmc.python" version="3.0.0"/>
5+
<!--import addon="script.module.web-pdb"/-->
6+
</requires>
7+
<extension point="xbmc.python.script" library="addon.py">
8+
<provides>video executable</provides>
9+
</extension>
10+
<extension point="xbmc.addon.metadata">
11+
<summary lang="en_GB">wadeysay</summary>
12+
<description lang="en_GB">What Did They Say?
13+
This addon will rewind the video and play it with subtitles. Use it when you could not hear or understand what was just said. How much to rewind and which subtitle is selected is configurable.
14+
NOTE: use Keymap Editor to map desired input or edit keymap file (fullscreenvideo -> runaddon)</description>
15+
<license>GPL-3.0-or-later</license>
16+
<platform>all</platform>
17+
<forum>https://forum.kodi.tv/showthread.php?tid=372702</forum>
18+
<website>https://www.icr8ions.com/creations/wadeysay</website>
19+
<email>[email protected]</email>
20+
<!--source>https://github.com/icr8ions/script.wadeysay</source-->
21+
<assets>
22+
<icon>resources/icon-512x512.png</icon>
23+
</assets>
24+
</extension>
25+
</addon>
30.4 KB
Loading
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Kodi Media Center language file
2+
# Addon Name: wadeysay
3+
# Addon id: script.wadeysay
4+
# Addon Provider:
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Kodi Addons\n"
8+
"Report-Msgid-Bugs-To: [email protected]\n"
9+
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
10+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11+
"Last-Translator: Kodi Translation Team\n"
12+
"Language-Team: English (https://kodi.weblate.cloud/languages/en_gb/)\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Language: en\n"
17+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
18+
19+
msgctxt "#32001"
20+
msgid "Configuration"
21+
msgstr ""
22+
23+
msgctxt "#32002"
24+
msgid "Time in seconds:"
25+
msgstr ""
26+
27+
msgctxt "#32003"
28+
msgid "Rewind time:"
29+
msgstr ""
30+
31+
msgctxt "#32004"
32+
msgid "Keep subtitle on longer than rewind time:"
33+
msgstr ""
34+
35+
msgctxt "#32005"
36+
msgid "Subtitle selection preferences:"
37+
msgstr ""
38+
39+
msgctxt "#32006"
40+
msgid "SDH"
41+
msgstr ""
42+
43+
msgctxt "#32007"
44+
msgid "Subtitle forced:"
45+
msgstr ""
46+
47+
msgctxt "#32008"
48+
msgid "Subtitle disabled:"
49+
msgstr ""
50+
51+
msgctxt "#32009"
52+
msgid "audio language"
53+
msgstr ""
54+
55+
msgctxt "#32010"
56+
msgid "forced language"
57+
msgstr ""
58+
59+
msgctxt "#32011"
60+
msgid "selected subtitle"
61+
msgstr ""
62+
63+
msgctxt "#32103"
64+
msgid "range 0 to 60 seconds - how much to rewind in seconds"
65+
msgstr ""
66+
67+
msgctxt "#32104"
68+
msgid "range 0 to 60 seconds - subtitles will stay on for all of rewind time plus this amount in seconds"
69+
msgstr ""
70+
71+
msgctxt "#32106"
72+
msgid "on/off - prefer subtitle for deaf and hard of hearing"
73+
msgstr ""
74+
75+
msgctxt "#32107"
76+
msgid "options - if forced subtitle is encountered then find subtitle with selected language preference"
77+
msgstr ""
78+
79+
msgctxt "#32108"
80+
msgid "options - if subtitle is off then turn on either selected subtitle as long as it is not forced or find subtitle with selected language preference"
81+
msgstr ""
82+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" ?>
2+
<settings version="1">
3+
<section id="script.wadeysay">
4+
<category id="configuration" label="32001" help="">
5+
<group id="1" label="32002">
6+
<setting id="rewind" type="integer" label="32003" help="32103">
7+
<level>0</level>
8+
<default>20</default>
9+
<constraints>
10+
<minimum>0</minimum>
11+
<step>1</step>
12+
<maximum>60</maximum>
13+
</constraints>
14+
<control type="slider" format="integer">
15+
<popup>false</popup>
16+
</control>
17+
</setting>
18+
<setting id="longer" type="integer" label="32004" help="32104">
19+
<level>0</level>
20+
<default>2</default>
21+
<constraints>
22+
<minimum>0</minimum>
23+
<step>1</step>
24+
<maximum>60</maximum>
25+
</constraints>
26+
<control type="slider" format="integer">
27+
<popup>false</popup>
28+
</control>
29+
</setting>
30+
</group>
31+
<group id="2" label="32005">
32+
<setting id="p_sdh" type="boolean" label="32006" help="32106">
33+
<level>0</level>
34+
<default>false</default>
35+
<control type="toggle"/>
36+
</setting>
37+
<setting id="p_subtitle_forced" type="integer" label="32007" help="32107">
38+
<level>0</level>
39+
<default>0</default>
40+
<constraints>
41+
<options>
42+
<option label="32010">0</option>
43+
<option label="32009">1</option>
44+
</options>
45+
</constraints>
46+
<control type="spinner" format="string"/>
47+
</setting>
48+
<setting id="p_subtitle_disabled" type="integer" label="32008" help="32108">
49+
<level>0</level>
50+
<default>0</default>
51+
<constraints>
52+
<options>
53+
<option label="32011">0</option>
54+
<option label="32009">1</option>
55+
</options>
56+
</constraints>
57+
<control type="spinner" format="string"/>
58+
</setting>
59+
</group>
60+
</category>
61+
</section>
62+
</settings>

script.wadeysay/wadeysay.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# -*- coding: utf-8 -*-
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
#
4+
# Copyright (C) 2023 iCR8IONS LLC www.icr8ions.com
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
# part of an addon called script.wadyasay for Kodi - https://kodi.tv
20+
21+
# pylint: disable=C0103
22+
23+
""" entry point invoked by Kodi """
24+
25+
from wadeysay_xbmc import get_conf
26+
from wadeysay_xbmc import is_playing_video
27+
from wadeysay_xbmc import media_has_streams
28+
from wadeysay_xbmc import get_player_properties
29+
from wadeysay_xbmc import enable_subtitle
30+
from wadeysay_xbmc import enable_subtitle_index
31+
from wadeysay_xbmc import set_subtitle
32+
from wadeysay_xbmc import rewind_wait
33+
from wadeysay_logic import wadeysay_logic
34+
35+
#import web_pdb
36+
37+
#web_pdb.set_trace()
38+
39+
def wadeysay():
40+
if (is_playing_video()):
41+
# video is playing
42+
_conf = get_conf()
43+
_dirty = False
44+
if (media_has_streams()):
45+
# at least one subtitle and one audio available
46+
# obtain current media properties
47+
_media_properties = get_player_properties()
48+
result = wadeysay_logic(_media_properties, _conf)
49+
if (result.action != None):
50+
if ((result.action.index == -1) and (result.action.enabled == True)):
51+
enable_subtitle()
52+
elif ((result.action.index != -1) and (result.action.enabled == True)):
53+
enable_subtitle_index(result.action.index)
54+
_dirty = True
55+
# skip now
56+
# non forced subtitle was enabled or subtitle set and enabled as preferred
57+
rewind_wait(_conf.rewind_time, _conf.longer_time)
58+
if ((_dirty == True) and (result.initial != None)):
59+
# there was a change to subtitle so restore along with enabled state
60+
set_subtitle(result.initial.index, result.initial.enabled)

script.wadeysay/wadeysay_conf.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# -*- coding: utf-8 -*-
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
#
4+
# Copyright (C) 2023 iCR8IONS LLC www.icr8ions.com
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
# part of an addon called script.wadeysay for Kodi - https://kodi.tv
20+
21+
# pylint: disable=C0103
22+
23+
""" provides configuration class definition """
24+
25+
from enum import Enum
26+
from dataclasses import dataclass
27+
28+
class SUBTITLE_FORCED(Enum):
29+
""" enum for subtitle forced options """
30+
FORCED_LANGUAGE=0
31+
AUDIO_LANGUAGE=1
32+
33+
class SUBTITLE_DISABLED(Enum):
34+
""" enum for subtitle selected options """
35+
SELECTED_SUBTITLE=0
36+
AUDIO_LANGUAGE=1
37+
38+
@dataclass(frozen=True)
39+
class CONF:
40+
""" immutable class for configuration """
41+
rewind_time: int
42+
longer_time: int
43+
p_sdh: bool
44+
p_subtitle_forced: SUBTITLE_FORCED
45+
p_subtitle_disabled: SUBTITLE_DISABLED
46+
47+
def __init__(self, rewind_time, longer_time, p_sdh, p_subtitle_forced, p_subtitle_disabled):
48+
object.__setattr__(self, "rewind_time", rewind_time)
49+
object.__setattr__(self, "longer_time", longer_time)
50+
object.__setattr__(self, "p_sdh", p_sdh)
51+
object.__setattr__(self, "p_subtitle_forced", p_subtitle_forced)
52+
object.__setattr__(self, "p_subtitle_disabled", p_subtitle_disabled)

0 commit comments

Comments
 (0)