-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e0c81ab
Showing
9 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 maxcco | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Denon autoMode Plugin for Kodi (service.denonAVR) | ||
|
||
## How it works | ||
|
||
Once installed in kodi, you need to setup the ip address of your Denon AVR in extension settings. | ||
It will run as soon as you start kodi as a service and will send a request (similar to pressing the remote button) to activate either the movie mode or the music mode. | ||
|
||
## Disclaimer | ||
|
||
This plugin is not officially commissioned/supported by Denon. The trademark "Denon" is registered by "Sound United, LLC" | ||
|
||
## License | ||
|
||
Licensed under The MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import xbmc | ||
import xbmcgui | ||
import xbmcaddon | ||
import xbmcvfs | ||
import os | ||
|
||
__addon__ = xbmcaddon.Addon() | ||
__cwd__ = __addon__.getAddonInfo('path') | ||
__profile__ = xbmc.translatePath( __addon__.getAddonInfo('profile') ) | ||
__resource__ = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ) | ||
|
||
sys.path.append (__resource__) | ||
|
||
import utils | ||
from service import DenonController | ||
|
||
utils.log("Service starting...") | ||
controler = DenonController() | ||
controler.runProgram() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<addon id="service.denonavr" name="Denon autoMode" version="1.0" provider-name="Maxcco"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.6.0"/> | ||
<import addon="script.module.requests" version="2.19.1"/> | ||
</requires> | ||
<extension point="xbmc.service" library="addon.py" start="login"> | ||
</extension> | ||
<extension point="xbmc.addon.metadata"> | ||
<summary lang="en_GB">Auto switch Denon AVR mode</summary> | ||
<description lang="en_GB">Control your Denon AVR to switch between music and movie mode following what's played in Kodi </description> | ||
<language></language> | ||
<platform>all</platform> | ||
<assets> | ||
<icon>resources/media/denon.png</icon> | ||
<fanart>resources/media/denon.png</fanart> | ||
</assets> | ||
</extension> | ||
</addon> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sys | ||
import xbmc | ||
import xbmcgui | ||
import xbmcaddon | ||
import utils | ||
|
||
|
||
class PlayerMonitor(xbmc.Player): | ||
|
||
def __init__(self): | ||
xbmc.Player.__init__(self) | ||
utils.post({'cmd0':'PutSurroundMode/MOVIE', 'cmd1':'aspMainZone_WebUpdateStatus/'}) | ||
self.currentMode = "MOVIE" | ||
|
||
def onPlayBackStarted(self): | ||
if (self.isPlayingAudio() and self.currentMode != "MUSIC"): | ||
utils.log('Changing to Music Mode', xbmc.LOGINFO) | ||
body = {'cmd0':'PutSurroundMode/MUSIC', 'cmd1':'aspMainZone_WebUpdateStatus/'} | ||
self.currentMode = "MUSIC" | ||
|
||
if (self.isPlayingVideo() and self.currentMode != "MOVIE"): | ||
utils.log('Changing to Music Mode', xbmc.LOGINFO) | ||
body = {'cmd0':'PutSurroundMode/MOVIE', 'cmd1':'aspMainZone_WebUpdateStatus/'} | ||
self.currentMode = "MOVIE" | ||
|
||
|
||
class DenonController(): | ||
player_monitor = None | ||
|
||
def __init__(self): | ||
self.player_monitor = PlayerMonitor() | ||
|
||
|
||
def runProgram(self): | ||
while(not xbmc.abortRequested): | ||
# waiting loop | ||
xbmc.sleep(500) | ||
|
||
#clean up monitor on exit | ||
del self.player_monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import xbmc | ||
import xbmcgui | ||
import xbmcaddon | ||
import requests | ||
import json | ||
|
||
ADDON_ID = 'service.denonavr' | ||
ADDON = xbmcaddon.Addon(ADDON_ID) | ||
CWD = ADDON.getAddonInfo('path').decode('utf-8') | ||
|
||
def log(message,loglevel=xbmc.LOGNOTICE): | ||
xbmc.log(encode(ADDON_ID+ "-" + ADDON.getAddonInfo('version') + " : " + message),level=loglevel) | ||
|
||
def encode(string): | ||
return string.encode('UTF-8','replace') | ||
|
||
def post(data, count_err=0): | ||
ipDenon = ADDON.getSetting('ipDenon') | ||
if count_err < 10: | ||
try: | ||
r = requests.post("http://"+ ipDenon +"/MainZone/index.put.asp", data, verify=False,timeout=2) | ||
except Exception: | ||
# try again | ||
count_err += 1 | ||
return post(data, count_err) | ||
else: | ||
log("Can not reach the denonavr at ip : "+ ipDenon +" , please check your settings", xbmc.LOGERROR) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | ||
<settings> | ||
<setting label="Denon AVR config" type="lsep"/> | ||
<setting id="ipDenon" label="IP" type="ipaddress" default="192.168.1.00"/> | ||
</settings> |