Skip to content

Commit 0434735

Browse files
feat: update to Kodi Nexus and python 3.10 (#46)
* feat: update to Kodi Nexus and python 3.10 - refactorings to adhere to PEP8 and new add-on structure - take advantage of new settings API - move most of the logic to the Monitor subclass * fix: various improvements - use pillow for image processing - preserving aspect ratio - capture was issued only at connection - reconnect on host or port settings change - remove unused labels * Update artwork, fix addon.xml * Add Hebrew translations per PR#35 * fixed readme * Add Italian translation * remove logs, align image sent duration to sleep_time --------- Co-authored-by: LordGrey <[email protected]>
1 parent b78eee8 commit 0434735

File tree

26 files changed

+725
-725
lines changed

26 files changed

+725
-725
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The MIT License (MIT)
2-
Copyright (c) 2013-2016 hyperion-project
2+
Copyright (c) 2013-2023 hyperion-project
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
script.service.hyperion
2-
=======================
1+
# script.service.hyperion
32

4-
Kodi add-on to capture video data and send it to Hyperion. Note that this plugin will not work for Kodi running on the Raspberry Pi, because the video capture interface is not (yet?) supported on this device.
3+
Kodi add-on to capture video data and send it to Hyperion.
4+
Note that this plugin does not currently work for Kodi running on Raspberry Pi.
5+
There is an outstanding Kodi fix for that.
56

67
Information about Hyperion can be found here: https://wiki.hyperion-project.org
78

8-
The add-on can be installed by downlading the zip and extracting it to the add-on directory (probably ~/.xbmc/add-ons on Linux and C:\Users\user\AppData\Roaming\XBMC\addons on Windows)
9+
The add-on can be installed by downloading the zip and installing it via the Kodi Add-On zip install or
10+
extracting it to the addons directory (i.e.~/.kodi/addons on Linux or %AppData%\Kodi\addons on Windows)

addon.py

Lines changed: 39 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,43 @@
1-
'''
1+
"""
22
Kodi video capturer for Hyperion
3-
4-
Copyright (c) 2013-1016 Hyperion Team
5-
6-
Permission is hereby granted, free of charge, to any person obtaining a copy
7-
of this software and associated documentation files (the "Software"), to deal
8-
in the Software without restriction, including without limitation the rights
9-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
copies of the Software, and to permit persons to whom the Software is
11-
furnished to do so, subject to the following conditions:
12-
13-
The above copyright notice and this permission notice shall be included in
14-
all copies or substantial portions of the Software.
15-
16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
THE SOFTWARE.
23-
'''
3+
4+
Copyright (c) 2013-1016 Hyperion Team
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
"""
2424

2525
import xbmc
2626
import xbmcaddon
27-
import xbmcgui
28-
import os
29-
30-
# Add the library path before loading Hyperion
31-
__addon__ = xbmcaddon.Addon()
32-
__cwd__ = __addon__.getAddonInfo('path')
33-
sys.path.append(xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib')))
34-
35-
from settings import Settings
36-
from state import DisconnectedState
37-
from hyperion.Hyperion import Hyperion
38-
39-
if __name__ == "__main__":
40-
# read settings
41-
settings = Settings()
42-
43-
# initialize the state
44-
state = DisconnectedState(settings)
45-
46-
# start looping
47-
while not settings.abort:
48-
# execute the current state
49-
next_state = state.execute()
50-
51-
# delete the old state if necessary
52-
if state != next_state:
53-
del state
54-
55-
# advance to the next state
56-
state = next_state
57-
58-
# clean up the state closing the connection if present
59-
del state
60-
del settings
27+
28+
from resources.lib.misc import MessageHandler
29+
from resources.lib.settings import Settings
30+
from resources.lib.monitor import HyperionMonitor
31+
32+
33+
def main():
34+
addon = xbmcaddon.Addon()
35+
player = xbmc.Player()
36+
settings = Settings(addon.getSettings())
37+
output_handler = MessageHandler(addon)
38+
monitor = HyperionMonitor(settings, player, output_handler)
39+
monitor.main_loop()
40+
41+
42+
if __name__ == "__main__":
43+
main()

addon.xml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="script.service.hyperion" name="Hyperion Ambilight" version="1.0.2" provider-name="hyperion-project">
2+
<addon id="script.service.hyperion" name="Hyperion Ambilight" version="1.0.6" provider-name="hyperion-project">
33
<requires>
4-
<import addon="xbmc.python" version="2.1.0"/>
5-
<import addon="script.module.protobuf" version="2.5.0"/>
4+
<import addon="xbmc.addon" version="17.0.0"/>
5+
<import addon="xbmc.python" version="3.0.0"/>
6+
<import addon="script.module.protobuf" version="4.23.2"/>
67
</requires>
7-
<extension point="xbmc.service" library="addon.py" start="login"></extension>
8+
<extension point="xbmc.service" library="addon.py" start="login"/>
89
<extension point="xbmc.addon.metadata">
9-
<summary lang="en">Capture and send your current Kodi-picture to your Hyperion-Ambilight.</summary>
10-
<summary lang="de">Übermittle das aktuelle Kodi-Bild an dein Hyperion-Ambilight.</summary>
11-
<description lang="en">Hyperion is an open source ambilight clone which runs on many devices.[CR]This addon sends through the Hyperion PROTO-port your current picture to your Hyperion deamon for further processing like black border detection or smoothing.[CR][CR][B][COLOR red]ATTENTION:[/B][/COLOR][CR]1. This addon is not for RPi`s.[CR]2. Don´t use this Addon with enabled hardware acceleration on Android boxes/systems! It won´t work!</description>
12-
<description lang="de">Hyperion ist ein Ambilight-Klon, welcher auf vielen Plattformen lauffähig ist.[CR]Dieses Addon sendet über den PROTO-Port laufend Bilder an Hyperion.[CR][CR][B][COLOR red]ACHTUNG:[/B][/COLOR][CR]1. Benutze dieses Addon nicht auf einem RaspberryPi.[CR]2. Benutze dieses Addon nicht mit aktivierter Hardwarebeschleunigung auf Android Boxen/Systemen! Es funktioniert nicht!</description>
13-
<disclaimer lang="en">If issues occurs, please visit the Hyperion wiki/forum (wiki.hyperion-project.org).</disclaimer>
14-
<disclaimer lang="de">Bei Problemen findet ihr Hilfe im Hyperion Wiki/Forum (wiki.hyperion-project.org).</disclaimer>
15-
<language>en de</language>
16-
<platform>all</platform>
17-
<website>www.hyperion-project.org</website>
18-
<forum>forum.hyperion-project.org</forum>
19-
<source>https://github.com/hyperion-project/script.service.hyperion</source>
20-
<license>MIT</license>
21-
</extension>
10+
<summary lang="en_GB">Capture and send your current Kodi-picture to your Hyperion Ambient Lighting system.</summary>
11+
<summary lang="de_DE">Übermittle das aktuelle Kodi-Bild an dein Hyperion Ambient Lighting System.</summary>
12+
<summary lang="it_IT">Cattura e invia l'immagine corrente di Kodi ad tuo sistema di Ambient Lighting Hyperion.</summary>
13+
<description lang="en_GB">Hyperion is an opensource Bias or Ambient Lighting implementation which runs on many devices.[CR]This addon sends through the Hyperion PROTO-port your current picture to your Hyperion daemon for further processing like black border detection or smoothing.</description>
14+
<description lang="de_DE">Hyperion ist ein Bias oder Ambient Lighting System, welches auf vielen Plattformen lauffähig ist.[CR]Dieses Addon sendet über den PROTO-Port laufend Bilder an Hyperion.</description>
15+
<description lang="it_IT">Hyperion è un'implentazione open source di Bias o Ambient Lighting che supporta molti dispositivi.[CR]Questo addon invia l'immagine corrente alla porta PROTO del demone Hyperion per ulteriori elaborazioni come il rilevamento bordi neri o lo smoothing.</description>
16+
<disclaimer lang="en_GB"></disclaimer>
17+
<language>en de he</language>
18+
<platform>all</platform>
19+
<forum>https://hyperion-project.org/forum</forum>
20+
<website>https://www.hyperion-project.org</website>
21+
<source>https://github.com/hyperion-project/script.service.hyperion</source>
22+
<license>MIT</license>
23+
<news>v1.0.6
24+
- Kodi Nexus support. Dropped earlier versions.
25+
- Maintain aspect-ratio for grapped images
26+
</news>
27+
<assets>
28+
<icon>resources/icon.png</icon>
29+
<fanart>resources/fanart.png</fanart>
30+
<screenshot>resources/screenshot-01.png</screenshot>
31+
</assets>
32+
</extension>
2233
</addon>

changelog.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

fanart.jpg

-358 KB
Binary file not shown.

icon.png

-72.6 KB
Binary file not shown.

resources/__init__.py

Whitespace-only changes.

resources/fanart.png

50.6 KB
Loading

0 commit comments

Comments
 (0)