diff --git a/gui/slick/interfaces/default/inc_top.tmpl b/gui/slick/interfaces/default/inc_top.tmpl
index ba9fbbb8..ad4b6cbb 100644
--- a/gui/slick/interfaces/default/inc_top.tmpl
+++ b/gui/slick/interfaces/default/inc_top.tmpl
@@ -110,6 +110,8 @@
\$("#SubMenu a:contains('Notification')").addClass('btn').html('
Notifications');
\$("#SubMenu a:contains('Update show in XBMC')").addClass('btn').html(' Update show in XBMC');
\$("#SubMenu a[href$='/home/updateXBMC/']").addClass('btn').html(' Update XBMC');
+ \$("#SubMenu a:contains('Update show in Kodi')").addClass('btn').html(' Update show in Kodi');
+ \$("#SubMenu a[href$='/home/updateKODI/']").addClass('btn').html(' Update Kodi');
}
\$(document).ready(function() {
@@ -165,12 +167,15 @@
Backlog Overview
Manage Searches
Episode Status Management
-#if $sickbeard.USE_PLEX and $sickbeard.PLEX_SERVER_HOST != "":
+#if $sickbeard.USE_PLEX and $sickbeard.PLEX_SERVER_HOST != '':
Update PLEX
#end if
-#if $sickbeard.USE_XBMC and $sickbeard.XBMC_HOST != "":
+#if $sickbeard.USE_XBMC and $sickbeard.XBMC_HOST != '':
Update XBMC
#end if
+#if $sickbeard.USE_KODI and $sickbeard.KODI_HOST != '':
+
Update Kodi
+#end if
#if $sickbeard.USE_TORRENTS and $sickbeard.TORRENT_METHOD != 'blackhole' \
and ($sickbeard.ENABLE_HTTPS and $sickbeard.TORRENT_HOST[:5] == 'https' \
or not $sickbeard.ENABLE_HTTPS and $sickbeard.TORRENT_HOST[:5] == 'http:'):
diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js
index 03c33428..e3c70c2f 100644
--- a/gui/slick/js/configNotifications.js
+++ b/gui/slick/js/configNotifications.js
@@ -56,6 +56,25 @@ $(document).ready(function(){
});
});
+ $('#testKODI').click(function () {
+ var kodi_host = $.trim($('#kodi_host').val());
+ var kodi_username = $.trim($('#kodi_username').val());
+ var kodi_password = $.trim($('#kodi_password').val());
+ if (!kodi_host) {
+ $('#testKODI-result').html('Please fill out the necessary fields above.');
+ $('#kodi_host').addClass('warning');
+ return;
+ }
+ $('#kodi_host').removeClass('warning');
+ $(this).prop('disabled', true);
+ $('#testKODI-result').html(loading);
+ $.get(sbRoot + '/home/testKODI', {'host': kodi_host, 'username': kodi_username, 'password': kodi_password})
+ .done(function (data) {
+ $('#testKODI-result').html(data);
+ $('#testKODI').prop('disabled', false);
+ });
+ });
+
$('#testPMC').click(function () {
var plex_host = $.trim($('#plex_host').val());
var plex_username = $.trim($('#plex_username').val());
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index ce9bfbc1..f350f77e 100755
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -162,6 +162,7 @@ METADATA_PS3 = None
METADATA_WDTV = None
METADATA_TIVO = None
METADATA_MEDE8ER = None
+METADATA_KODI = None
QUALITY_DEFAULT = None
STATUS_DEFAULT = None
@@ -280,6 +281,18 @@ XBMC_HOST = ''
XBMC_USERNAME = None
XBMC_PASSWORD = None
+USE_KODI = False
+KODI_ALWAYS_ON = True
+KODI_NOTIFY_ONSNATCH = False
+KODI_NOTIFY_ONDOWNLOAD = False
+KODI_NOTIFY_ONSUBTITLEDOWNLOAD = False
+KODI_UPDATE_LIBRARY = False
+KODI_UPDATE_FULL = False
+KODI_UPDATE_ONLYFIRST = False
+KODI_HOST = ''
+KODI_USERNAME = None
+KODI_PASSWORD = None
+
USE_PLEX = False
PLEX_NOTIFY_ONSNATCH = False
PLEX_NOTIFY_ONDOWNLOAD = False
@@ -471,6 +484,7 @@ def initialize(consoleLogging=True):
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_VERIFY_CERT, \
USE_XBMC, XBMC_ALWAYS_ON, XBMC_NOTIFY_ONSNATCH, XBMC_NOTIFY_ONDOWNLOAD, XBMC_NOTIFY_ONSUBTITLEDOWNLOAD, XBMC_UPDATE_FULL, XBMC_UPDATE_ONLYFIRST, \
XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, BACKLOG_FREQUENCY, \
+ USE_KODI, KODI_ALWAYS_ON, KODI_NOTIFY_ONSNATCH, KODI_NOTIFY_ONDOWNLOAD, KODI_NOTIFY_ONSUBTITLEDOWNLOAD, KODI_UPDATE_FULL, KODI_UPDATE_ONLYFIRST, KODI_UPDATE_LIBRARY, KODI_HOST, KODI_USERNAME, KODI_PASSWORD, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, \
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
@@ -495,7 +509,7 @@ def initialize(consoleLogging=True):
USE_LIBNOTIFY, LIBNOTIFY_NOTIFY_ONSNATCH, LIBNOTIFY_NOTIFY_ONDOWNLOAD, LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD, USE_NMJ, NMJ_HOST, NMJ_DATABASE, NMJ_MOUNT, USE_NMJv2, NMJv2_HOST, NMJv2_DATABASE, NMJv2_DBLOC, USE_SYNOINDEX, \
USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \
USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \
- USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \
+ USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, METADATA_KODI, metadata_provider_dict, \
NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, POSTPONE_IF_SYNC_FILES, recentSearchScheduler, NFO_RENAME, \
GUI_NAME, DEFAULT_HOME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, EPISODE_VIEW_LAYOUT, EPISODE_VIEW_SORT, EPISODE_VIEW_DISPLAY_PAUSED, EPISODE_VIEW_MISSED_RANGE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, \
POSTER_SORTBY, POSTER_SORTDIR, \
@@ -516,6 +530,7 @@ def initialize(consoleLogging=True):
CheckSection(CFG, 'SABnzbd')
CheckSection(CFG, 'NZBget')
CheckSection(CFG, 'XBMC')
+ CheckSection(CFG, 'Kodi')
CheckSection(CFG, 'PLEX')
CheckSection(CFG, 'Growl')
CheckSection(CFG, 'Prowl')
@@ -761,6 +776,18 @@ def initialize(consoleLogging=True):
XBMC_USERNAME = check_setting_str(CFG, 'XBMC', 'xbmc_username', '')
XBMC_PASSWORD = check_setting_str(CFG, 'XBMC', 'xbmc_password', '')
+ USE_KODI = bool(check_setting_int(CFG, 'Kodi', 'use_kodi', 0))
+ KODI_ALWAYS_ON = bool(check_setting_int(CFG, 'Kodi', 'kodi_always_on', 1))
+ KODI_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Kodi', 'kodi_notify_onsnatch', 0))
+ KODI_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Kodi', 'kodi_notify_ondownload', 0))
+ KODI_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'Kodi', 'kodi_notify_onsubtitledownload', 0))
+ KODI_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'Kodi', 'kodi_update_library', 0))
+ KODI_UPDATE_FULL = bool(check_setting_int(CFG, 'Kodi', 'kodi_update_full', 0))
+ KODI_UPDATE_ONLYFIRST = bool(check_setting_int(CFG, 'Kodi', 'kodi_update_onlyfirst', 0))
+ KODI_HOST = check_setting_str(CFG, 'Kodi', 'kodi_host', '')
+ KODI_USERNAME = check_setting_str(CFG, 'Kodi', 'kodi_username', '')
+ KODI_PASSWORD = check_setting_str(CFG, 'Kodi', 'kodi_password', '')
+
USE_PLEX = bool(check_setting_int(CFG, 'Plex', 'use_plex', 0))
PLEX_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Plex', 'plex_notify_onsnatch', 0))
PLEX_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Plex', 'plex_notify_ondownload', 0))
@@ -936,6 +963,7 @@ def initialize(consoleLogging=True):
METADATA_WDTV = check_setting_str(CFG, 'General', 'metadata_wdtv', '0|0|0|0|0|0|0|0|0|0')
METADATA_TIVO = check_setting_str(CFG, 'General', 'metadata_tivo', '0|0|0|0|0|0|0|0|0|0')
METADATA_MEDE8ER = check_setting_str(CFG, 'General', 'metadata_mede8er', '0|0|0|0|0|0|0|0|0|0')
+ METADATA_KODI = check_setting_str(CFG, 'General', 'metadata_kodi', '0|0|0|0|0|0|0|0|0|0')
HOME_LAYOUT = check_setting_str(CFG, 'GUI', 'home_layout', 'poster')
HISTORY_LAYOUT = check_setting_str(CFG, 'GUI', 'history_layout', 'detailed')
@@ -1090,6 +1118,7 @@ def initialize(consoleLogging=True):
(METADATA_WDTV, metadata.wdtv),
(METADATA_TIVO, metadata.tivo),
(METADATA_MEDE8ER, metadata.mede8er),
+ (METADATA_KODI, metadata.kodi),
]:
(cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
tmp_provider = cur_metadata_class.metadata_class()
@@ -1440,6 +1469,7 @@ def save_config():
new_config['General']['metadata_wdtv'] = METADATA_WDTV
new_config['General']['metadata_tivo'] = METADATA_TIVO
new_config['General']['metadata_mede8er'] = METADATA_MEDE8ER
+ new_config['General']['metadata_kodi'] = METADATA_KODI
new_config['General']['backlog_days'] = int(BACKLOG_DAYS)
@@ -1602,6 +1632,19 @@ def save_config():
new_config['XBMC']['xbmc_username'] = XBMC_USERNAME
new_config['XBMC']['xbmc_password'] = helpers.encrypt(XBMC_PASSWORD, ENCRYPTION_VERSION)
+ new_config['Kodi'] = {}
+ new_config['Kodi']['use_kodi'] = int(USE_KODI)
+ new_config['Kodi']['kodi_always_on'] = int(KODI_ALWAYS_ON)
+ new_config['Kodi']['kodi_notify_onsnatch'] = int(KODI_NOTIFY_ONSNATCH)
+ new_config['Kodi']['kodi_notify_ondownload'] = int(KODI_NOTIFY_ONDOWNLOAD)
+ new_config['Kodi']['kodi_notify_onsubtitledownload'] = int(KODI_NOTIFY_ONSUBTITLEDOWNLOAD)
+ new_config['Kodi']['kodi_update_library'] = int(KODI_UPDATE_LIBRARY)
+ new_config['Kodi']['kodi_update_full'] = int(KODI_UPDATE_FULL)
+ new_config['Kodi']['kodi_update_onlyfirst'] = int(KODI_UPDATE_ONLYFIRST)
+ new_config['Kodi']['kodi_host'] = KODI_HOST
+ new_config['Kodi']['kodi_username'] = KODI_USERNAME
+ new_config['Kodi']['kodi_password'] = helpers.encrypt(KODI_PASSWORD, ENCRYPTION_VERSION)
+
new_config['Plex'] = {}
new_config['Plex']['use_plex'] = int(USE_PLEX)
new_config['Plex']['plex_notify_onsnatch'] = int(PLEX_NOTIFY_ONSNATCH)
diff --git a/sickbeard/config.py b/sickbeard/config.py
index ad8ee2da..a2d43fac 100644
--- a/sickbeard/config.py
+++ b/sickbeard/config.py
@@ -676,6 +676,7 @@ class ConfigMigrator():
metadata_wdtv = check_setting_str(self.config_obj, 'General', 'metadata_wdtv', '0|0|0|0|0|0')
metadata_tivo = check_setting_str(self.config_obj, 'General', 'metadata_tivo', '0|0|0|0|0|0')
metadata_mede8er = check_setting_str(self.config_obj, 'General', 'metadata_mede8er', '0|0|0|0|0|0')
+ metadata_kodi = check_setting_str(self.config_obj, 'General', 'metadata_kodi', '0|0|0|0|0|0')
use_banner = bool(check_setting_int(self.config_obj, 'General', 'use_banner', 0))
@@ -717,6 +718,7 @@ class ConfigMigrator():
sickbeard.METADATA_WDTV = _migrate_metadata(metadata_wdtv, 'WDTV', use_banner)
sickbeard.METADATA_TIVO = _migrate_metadata(metadata_tivo, 'TIVO', use_banner)
sickbeard.METADATA_MEDE8ER = _migrate_metadata(metadata_mede8er, 'Mede8er', use_banner)
+ sickbeard.METADATA_KODI = _migrate_metadata(metadata_kodi, 'Kodi', use_banner)
# Migration v6: Rename daily search to recent search
def _migrate_v6(self):
diff --git a/sickbeard/metadata/__init__.py b/sickbeard/metadata/__init__.py
index 180aa160..b1de0318 100644
--- a/sickbeard/metadata/__init__.py
+++ b/sickbeard/metadata/__init__.py
@@ -16,10 +16,18 @@
# You should have received a copy of the GNU General Public License
# along with SickGear. If not, see
.
-__all__ = ['generic', 'helpers', 'xbmc', 'xbmc_12plus', 'mediabrowser', 'ps3', 'wdtv', 'tivo', 'mede8er']
+__all__ = ['generic', 'helpers', 'kodi', 'mede8er', 'mediabrowser', 'ps3', 'tivo', 'wdtv', 'xbmc', 'xbmc_12plus']
import sys
-import xbmc, xbmc_12plus, mediabrowser, ps3, wdtv, tivo, mede8er
+
+import kodi
+import mede8er
+import mediabrowser
+import ps3
+import tivo
+import wdtv
+import xbmc
+import xbmc_12plus
def available_generators():
diff --git a/sickbeard/metadata/kodi.py b/sickbeard/metadata/kodi.py
new file mode 100644
index 00000000..6a3a1c96
--- /dev/null
+++ b/sickbeard/metadata/kodi.py
@@ -0,0 +1,376 @@
+# URL: http://code.google.com/p/sickbeard/
+#
+# This file is part of SickGear.
+#
+# SickGear is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SickGear is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SickGear. If not, see
.
+
+import generic
+import datetime
+
+import sickbeard
+
+from sickbeard import logger, exceptions, helpers
+from sickbeard.exceptions import ex
+
+import xml.etree.cElementTree as etree
+
+
+class KODIMetadata(generic.GenericMetadata):
+ """
+ Metadata generation class for Kodi.
+
+ The following file structure is used:
+
+ show_root/tvshow.nfo (show metadata)
+ show_root/fanart.jpg (fanart)
+ show_root/poster.jpg (poster)
+ show_root/banner.jpg (banner)
+ show_root/Season ##/filename.ext (*)
+ show_root/Season ##/filename.nfo (episode metadata)
+ show_root/Season ##/filename-thumb.jpg (episode thumb)
+ show_root/season##-poster.jpg (season posters)
+ show_root/season##-banner.jpg (season banners)
+ show_root/season-all-poster.jpg (season all poster)
+ show_root/season-all-banner.jpg (season all banner)
+ """
+
+ def __init__(self,
+ show_metadata=False,
+ episode_metadata=False,
+ fanart=False,
+ poster=False,
+ banner=False,
+ episode_thumbnails=False,
+ season_posters=False,
+ season_banners=False,
+ season_all_poster=False,
+ season_all_banner=False):
+
+ generic.GenericMetadata.__init__(self,
+ show_metadata,
+ episode_metadata,
+ fanart,
+ poster,
+ banner,
+ episode_thumbnails,
+ season_posters,
+ season_banners,
+ season_all_poster,
+ season_all_banner)
+
+ self.name = 'Kodi'
+
+ self.poster_name = 'poster.jpg'
+ self.season_all_poster_name = 'season-all-poster.jpg'
+
+ # web-ui metadata template
+ self.eg_show_metadata = 'tvshow.nfo'
+ self.eg_episode_metadata = 'Season##\\
filename.nfo'
+ self.eg_fanart = 'fanart.jpg'
+ self.eg_poster = 'poster.jpg'
+ self.eg_banner = 'banner.jpg'
+ self.eg_episode_thumbnails = 'Season##\\
filename-thumb.jpg'
+ self.eg_season_posters = 'season##-poster.jpg'
+ self.eg_season_banners = 'season##-banner.jpg'
+ self.eg_season_all_poster = 'season-all-poster.jpg'
+ self.eg_season_all_banner = 'season-all-banner.jpg'
+
+ def _show_data(self, show_obj):
+ """
+ Creates an elementTree XML structure for a Kodi-style tvshow.nfo and
+ returns the resulting data object.
+
+ show_obj: a TVShow instance to create the NFO for
+ """
+
+ show_ID = show_obj.indexerid
+
+ indexer_lang = show_obj.lang
+ lINDEXER_API_PARMS = sickbeard.indexerApi(show_obj.indexer).api_params.copy()
+
+ lINDEXER_API_PARMS['actors'] = True
+
+ if indexer_lang and not indexer_lang == 'en':
+ lINDEXER_API_PARMS['language'] = indexer_lang
+
+ if show_obj.dvdorder != 0:
+ lINDEXER_API_PARMS['dvdorder'] = True
+
+ t = sickbeard.indexerApi(show_obj.indexer).indexer(**lINDEXER_API_PARMS)
+
+ tv_node = etree.Element('tvshow')
+
+ try:
+ myShow = t[int(show_ID)]
+ except sickbeard.indexer_shownotfound:
+ logger.log(u'Unable to find show with id ' + str(show_ID) + ' on ' + sickbeard.indexerApi(
+ show_obj.indexer).name + ', skipping it', logger.ERROR)
+ raise
+
+ except sickbeard.indexer_error:
+ logger.log(
+ u'' + sickbeard.indexerApi(show_obj.indexer).name + ' is down, can\'t use its data to add this show',
+ logger.ERROR)
+ raise
+
+ # check for title and id
+ if getattr(myShow, 'seriesname', None) is None or getattr(myShow, 'id', None) is None:
+ logger.log(u'Incomplete info for show with id ' + str(show_ID) + ' on ' + sickbeard.indexerApi(
+ show_obj.indexer).name + ', skipping it', logger.ERROR)
+ return False
+
+ title = etree.SubElement(tv_node, 'title')
+ if getattr(myShow, 'seriesname', None) is not None:
+ title.text = myShow['seriesname']
+
+ rating = etree.SubElement(tv_node, 'rating')
+ if getattr(myShow, 'rating', None) is not None:
+ rating.text = myShow['rating']
+
+ year = etree.SubElement(tv_node, 'year')
+ if getattr(myShow, 'firstaired', None) is not None:
+ try:
+ year_text = str(datetime.datetime.strptime(myShow['firstaired'], '%Y-%m-%d').year)
+ if year_text:
+ year.text = year_text
+ except:
+ pass
+
+ plot = etree.SubElement(tv_node, 'plot')
+ if getattr(myShow, 'overview', None) is not None:
+ plot.text = myShow['overview']
+
+ episodeguide = etree.SubElement(tv_node, 'episodeguide')
+ episodeguideurl = etree.SubElement(episodeguide, 'url')
+ episodeguideurl2 = etree.SubElement(tv_node, 'episodeguideurl')
+ if getattr(myShow, 'id', None) is not None:
+ showurl = sickbeard.indexerApi(show_obj.indexer).config['base_url'] + str(myShow['id']) + '/all/en.zip'
+ episodeguideurl.text = showurl
+ episodeguideurl2.text = showurl
+
+ mpaa = etree.SubElement(tv_node, 'mpaa')
+ if getattr(myShow, 'contentrating', None) is not None:
+ mpaa.text = myShow['contentrating']
+
+ indexerid = etree.SubElement(tv_node, 'id')
+ if getattr(myShow, 'id', None) is not None:
+ indexerid.text = str(myShow['id'])
+
+ indexer = etree.SubElement(tv_node, 'indexer')
+ if show_obj.indexer is not None:
+ indexer.text = str(show_obj.indexer)
+
+ genre = etree.SubElement(tv_node, 'genre')
+ if getattr(myShow, 'genre', None) is not None:
+ if isinstance(myShow['genre'], basestring):
+ genre.text = ' / '.join(x.strip() for x in myShow['genre'].split('|') if x.strip())
+
+ premiered = etree.SubElement(tv_node, 'premiered')
+ if getattr(myShow, 'firstaired', None) is not None:
+ premiered.text = myShow['firstaired']
+
+ studio = etree.SubElement(tv_node, 'studio')
+ if getattr(myShow, 'network', None) is not None:
+ studio.text = myShow['network']
+
+ if getattr(myShow, '_actors', None) is not None:
+ for actor in myShow['_actors']:
+ cur_actor = etree.SubElement(tv_node, 'actor')
+
+ cur_actor_name = etree.SubElement(cur_actor, 'name')
+ cur_actor_name_text = actor['name']
+ if isinstance(cur_actor_name_text, basestring):
+ cur_actor_name.text = cur_actor_name_text.strip()
+
+ cur_actor_role = etree.SubElement(cur_actor, 'role')
+ cur_actor_role_text = actor['role']
+ if cur_actor_role_text != None:
+ cur_actor_role.text = cur_actor_role_text
+
+ cur_actor_thumb = etree.SubElement(cur_actor, 'thumb')
+ cur_actor_thumb_text = actor['image']
+ if cur_actor_thumb_text != None:
+ cur_actor_thumb.text = cur_actor_thumb_text
+
+ # Make it purdy
+ helpers.indentXML(tv_node)
+
+ data = etree.ElementTree(tv_node)
+
+ return data
+
+ def _ep_data(self, ep_obj):
+ """
+ Creates an elementTree XML structure for a Kodi-style episode.nfo and
+ returns the resulting data object.
+ show_obj: a TVEpisode instance to create the NFO for
+ """
+
+ eps_to_write = [ep_obj] + ep_obj.relatedEps
+
+ indexer_lang = ep_obj.show.lang
+
+ lINDEXER_API_PARMS = sickbeard.indexerApi(ep_obj.show.indexer).api_params.copy()
+
+ lINDEXER_API_PARMS['actors'] = True
+
+ if indexer_lang and not indexer_lang == 'en':
+ lINDEXER_API_PARMS['language'] = indexer_lang
+
+ if ep_obj.show.dvdorder != 0:
+ lINDEXER_API_PARMS['dvdorder'] = True
+
+ try:
+ t = sickbeard.indexerApi(ep_obj.show.indexer).indexer(**lINDEXER_API_PARMS)
+ myShow = t[ep_obj.show.indexerid]
+ except sickbeard.indexer_shownotfound, e:
+ raise exceptions.ShowNotFoundException(e.message)
+ except sickbeard.indexer_error, e:
+ logger.log(u'Unable to connect to ' + sickbeard.indexerApi(
+ ep_obj.show.indexer).name + ' while creating meta files - skipping - ' + ex(e), logger.ERROR)
+ return
+
+ if len(eps_to_write) > 1:
+ rootNode = etree.Element('xbmcmultiepisode')
+ else:
+ rootNode = etree.Element('episodedetails')
+
+ # write an NFO containing info for all matching episodes
+ for curEpToWrite in eps_to_write:
+
+ try:
+ myEp = myShow[curEpToWrite.season][curEpToWrite.episode]
+ except (sickbeard.indexer_episodenotfound, sickbeard.indexer_seasonnotfound):
+ logger.log(u'Unable to find episode ' + str(curEpToWrite.season) + 'x' + str(
+ curEpToWrite.episode) + ' on ' + sickbeard.indexerApi(
+ ep_obj.show.indexer).name + '.. has it been removed? Should I delete from db?')
+ return None
+
+ if getattr(myEp, 'firstaired', None) is None:
+ myEp['firstaired'] = str(datetime.date.fromordinal(1))
+
+ if getattr(myEp, 'episodename', None) is None:
+ logger.log(u'Not generating nfo because the ep has no title', logger.DEBUG)
+ return None
+
+ logger.log(u'Creating metadata for episode ' + str(ep_obj.season) + 'x' + str(ep_obj.episode), logger.DEBUG)
+
+ if len(eps_to_write) > 1:
+ episode = etree.SubElement(rootNode, 'episodedetails')
+ else:
+ episode = rootNode
+
+ title = etree.SubElement(episode, 'title')
+ if curEpToWrite.name != None:
+ title.text = curEpToWrite.name
+
+ showtitle = etree.SubElement(episode, 'showtitle')
+ if curEpToWrite.show.name != None:
+ showtitle.text = curEpToWrite.show.name
+
+ season = etree.SubElement(episode, 'season')
+ season.text = str(curEpToWrite.season)
+
+ episodenum = etree.SubElement(episode, 'episode')
+ episodenum.text = str(curEpToWrite.episode)
+
+ uniqueid = etree.SubElement(episode, 'uniqueid')
+ uniqueid.text = str(curEpToWrite.indexerid)
+
+ aired = etree.SubElement(episode, 'aired')
+ if curEpToWrite.airdate != datetime.date.fromordinal(1):
+ aired.text = str(curEpToWrite.airdate)
+ else:
+ aired.text = ''
+
+ plot = etree.SubElement(episode, 'plot')
+ if curEpToWrite.description != None:
+ plot.text = curEpToWrite.description
+
+ runtime = etree.SubElement(episode, 'runtime')
+ if curEpToWrite.season != 0:
+ if getattr(myShow, 'runtime', None) is not None:
+ runtime.text = myShow['runtime']
+
+ displayseason = etree.SubElement(episode, 'displayseason')
+ if getattr(myEp, 'airsbefore_season', None) is not None:
+ displayseason_text = myEp['airsbefore_season']
+ if displayseason_text != None:
+ displayseason.text = displayseason_text
+
+ displayepisode = etree.SubElement(episode, 'displayepisode')
+ if getattr(myEp, 'airsbefore_episode', None) is not None:
+ displayepisode_text = myEp['airsbefore_episode']
+ if displayepisode_text != None:
+ displayepisode.text = displayepisode_text
+
+ thumb = etree.SubElement(episode, 'thumb')
+ thumb_text = getattr(myEp, 'filename', None)
+ if thumb_text != None:
+ thumb.text = thumb_text
+
+ watched = etree.SubElement(episode, 'watched')
+ watched.text = 'false'
+
+ credits = etree.SubElement(episode, 'credits')
+ credits_text = getattr(myEp, 'writer', None)
+ if credits_text != None:
+ credits.text = credits_text
+
+ director = etree.SubElement(episode, 'director')
+ director_text = getattr(myEp, 'director', None)
+ if director_text is not None:
+ director.text = director_text
+
+ rating = etree.SubElement(episode, 'rating')
+ rating_text = getattr(myEp, 'rating', None)
+ if rating_text != None:
+ rating.text = rating_text
+
+ gueststar_text = getattr(myEp, 'gueststars', None)
+ if isinstance(gueststar_text, basestring):
+ for actor in (x.strip() for x in gueststar_text.split('|') if x.strip()):
+ cur_actor = etree.SubElement(episode, 'actor')
+ cur_actor_name = etree.SubElement(cur_actor, 'name')
+ cur_actor_name.text = actor
+
+ if getattr(myEp, '_actors', None) is not None:
+ for actor in myShow['_actors']:
+ cur_actor = etree.SubElement(episode, 'actor')
+
+ cur_actor_name = etree.SubElement(cur_actor, 'name')
+ cur_actor_name_text = actor['name']
+ if isinstance(cur_actor_name_text, basestring):
+ cur_actor_name.text = cur_actor_name_text.strip()
+
+ cur_actor_role = etree.SubElement(cur_actor, 'role')
+ cur_actor_role_text = actor['role']
+ if cur_actor_role_text != None:
+ cur_actor_role.text = cur_actor_role_text
+
+ cur_actor_thumb = etree.SubElement(cur_actor, 'thumb')
+ cur_actor_thumb_text = actor['image']
+ if cur_actor_thumb_text != None:
+ cur_actor_thumb.text = cur_actor_thumb_text
+
+ # Make it purdy
+ helpers.indentXML(rootNode)
+
+ data = etree.ElementTree(rootNode)
+
+ return data
+
+
+# present a standard "interface" from the module
+metadata_class = KODIMetadata
diff --git a/sickbeard/notifiers/__init__.py b/sickbeard/notifiers/__init__.py
index fa2f4203..b35be15a 100644
--- a/sickbeard/notifiers/__init__.py
+++ b/sickbeard/notifiers/__init__.py
@@ -19,6 +19,7 @@
import sickbeard
import xbmc
+import kodi
import plex
import nmj
import nmjv2
@@ -43,6 +44,7 @@ from sickbeard.common import *
# home theater / nas
xbmc_notifier = xbmc.XBMCNotifier()
+kodi_notifier = kodi.KODINotifier()
plex_notifier = plex.PLEXNotifier()
nmj_notifier = nmj.NMJNotifier()
nmjv2_notifier = nmjv2.NMJv2Notifier()
@@ -66,6 +68,7 @@ email_notifier = emailnotify.EmailNotifier()
notifiers = [
libnotify_notifier, # Libnotify notifier goes first because it doesn't involve blocking on network activity.
xbmc_notifier,
+ kodi_notifier,
plex_notifier,
nmj_notifier,
nmjv2_notifier,
diff --git a/sickbeard/notifiers/kodi.py b/sickbeard/notifiers/kodi.py
new file mode 100644
index 00000000..55252f36
--- /dev/null
+++ b/sickbeard/notifiers/kodi.py
@@ -0,0 +1,241 @@
+# Author: Nic Wolfe
+# URL: http://code.google.com/p/sickbeard/
+#
+# This file is part of SickGear.
+#
+# SickGear is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SickGear is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SickGear. If not, see .
+
+import urllib
+import urllib2
+import socket
+import base64
+import time
+
+import sickbeard
+
+from sickbeard import logger
+from sickbeard import common
+from sickbeard.exceptions import ex
+from sickbeard.encodingKludge import fixStupidEncodings
+
+try:
+ import xml.etree.cElementTree as etree
+except ImportError:
+ import xml.etree.ElementTree as etree
+
+try:
+ import json
+except ImportError:
+ from lib import simplejson as json
+
+
+class KODINotifier:
+ sg_logo_url = 'https://raw.githubusercontent.com/SickGear/SickGear/master/gui/slick/images/ico/apple-touch-icon-precomposed.png'
+
+ def _notify_kodi(self, message, title='SickGear', host=None, username=None, password=None, force=False):
+
+ # fill in omitted parameters
+ if not host:
+ host = sickbeard.KODI_HOST
+ if not username:
+ username = sickbeard.KODI_USERNAME
+ if not password:
+ password = sickbeard.KODI_PASSWORD
+
+ # suppress notifications if the notifier is disabled but the notify options are checked
+ if not sickbeard.USE_KODI and not force:
+ logger.log(u'KODI: Notifications are not enabled, skipping this notification', logger.DEBUG)
+ return False
+
+ result = ''
+ for curHost in [x.strip() for x in host.split(',')]:
+ logger.log(u'KODI: Sending Kodi notification to \'%s\' - %s' % (curHost, message), logger.MESSAGE)
+
+ command = '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"%s","message":"%s", "image": "%s"},"id":1}' % (title.encode('utf-8'), message.encode('utf-8'), self.sg_logo_url)
+ notifyResult = self._send_to_kodi(command, curHost, username, password)
+ if notifyResult:
+ result += curHost + ':' + notifyResult['result'].decode(sickbeard.SYS_ENCODING)
+ else:
+ if sickbeard.KODI_ALWAYS_ON or force:
+ result += curHost + ':False'
+
+ return result
+
+ def _send_to_kodi(self, command, host=None, username=None, password=None):
+
+ # fill in omitted parameters
+ if not username:
+ username = sickbeard.KODI_USERNAME
+ if not password:
+ password = sickbeard.KODI_PASSWORD
+
+ if not host:
+ logger.log(u'KODI: No host specified, check your settings', logger.ERROR)
+ return False
+
+ command = command.encode('utf-8')
+ logger.log(u'KODI: JSON command: ' + command, logger.DEBUG)
+
+ url = 'http://%s/jsonrpc' % (host)
+ try:
+ req = urllib2.Request(url, command)
+ req.add_header('Content-type', 'application/json')
+ # if we have a password, use authentication
+ if password:
+ base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
+ authheader = 'Basic %s' % base64string
+ req.add_header('Authorization', authheader)
+ logger.log(u'KODI: Contacting (with auth header) via url: ' + fixStupidEncodings(url), logger.DEBUG)
+ else:
+ logger.log(u'KODI: Contacting via url: ' + fixStupidEncodings(url), logger.DEBUG)
+
+ try:
+ response = urllib2.urlopen(req)
+ except urllib2.URLError, e:
+ logger.log(u'KODI: Warning: Couldn\'t contact Kodi at ' + host + '- ' + ex(e), logger.WARNING)
+ return False
+
+ # parse the json result
+ try:
+ result = json.load(response)
+ response.close()
+ logger.log(u'KODI: JSON response: ' + str(result), logger.DEBUG)
+ return result # need to return response for parsing
+ except ValueError, e:
+ logger.log(u'KODI: Unable to decode JSON response: ' + response, logger.WARNING)
+ return False
+
+ except IOError, e:
+ logger.log(u'KODI: Warning: Couldn\'t contact Kodi at ' + host + ' - ' + ex(e), logger.WARNING)
+ return False
+
+ def _update_library(self, host=None, showName=None):
+
+ if not host:
+ logger.log(u'KODI: No host specified, check your settings', logger.DEBUG)
+ return False
+
+ logger.log(u'KODI: Updating library on host: ' + host, logger.MESSAGE)
+
+ # if we're doing per-show
+ if showName:
+ tvshowid = -1
+ logger.log(u'KODI: Updating library for show ' + showName, logger.DEBUG)
+
+ # get tvshowid by showName
+ showsCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShows","id":1}'
+ showsResponse = self._send_to_kodi(showsCommand, host)
+
+ if showsResponse and 'result' in showsResponse and 'tvshows' in showsResponse['result']:
+ shows = showsResponse['result']['tvshows']
+ else:
+ logger.log(u'KODI: No TV shows in Kodi TV show list', logger.DEBUG)
+ return False
+
+ for show in shows:
+ if (show['label'] == showName):
+ tvshowid = show['tvshowid']
+ break # exit out of loop otherwise the label and showname will not match up
+
+ # this can be big, so free some memory
+ del shows
+
+ # we didn't find the show (exact match), thus revert to just doing a full update if enabled
+ if (tvshowid == -1):
+ logger.log(u'KODI: Exact show name not matched in KODI TV show list', logger.DEBUG)
+ return False
+
+ # lookup tv-show path
+ pathCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShowDetails","params":{"tvshowid":%d, "properties": ["file"]},"id":1}' % (tvshowid)
+ pathResponse = self._send_to_kodi(pathCommand, host)
+
+ path = pathResponse['result']['tvshowdetails']['file']
+ logger.log(u'KODI: Received Show: ' + showName + ' with ID: ' + str(tvshowid) + ' Path: ' + path, logger.DEBUG)
+
+ if (len(path) < 1):
+ logger.log(u'KODI: No valid path found for ' + showName + ' with ID: ' + str(tvshowid) + ' on ' + host, logger.WARNING)
+ return False
+
+ logger.log(u'KODI: Updating ' + showName + ' on ' + host + ' at ' + path, logger.DEBUG)
+ updateCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.Scan","params":{"directory":%s},"id":1}' % (json.dumps(path))
+ request = self._send_to_kodi(updateCommand, host)
+ if not request:
+ logger.log(u'KODI: Update of show directory failed on ' + showName + ' on ' + host + ' at ' + path, logger.ERROR)
+ return False
+
+ # catch if there was an error in the returned request
+ for r in request:
+ if 'error' in r:
+ logger.log(u'KODI: Error while attempting to update show directory for ' + showName + ' on ' + host + ' at ' + path, logger.ERROR)
+ return False
+
+ # do a full update if requested
+ else:
+ logger.log(u'KODI: Performing full library update on host: ' + host, logger.DEBUG)
+ updateCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}'
+ request = self._send_to_kodi(updateCommand, host, sickbeard.KODI_USERNAME, sickbeard.KODI_PASSWORD)
+
+ if not request:
+ logger.log(u'KODI: Full library update failed on host: ' + host, logger.ERROR)
+ return False
+
+ return True
+
+ def notify_snatch(self, ep_name):
+ if sickbeard.KODI_NOTIFY_ONSNATCH:
+ self._notify_kodi(ep_name, common.notifyStrings[common.NOTIFY_SNATCH])
+
+ def notify_download(self, ep_name):
+ if sickbeard.KODI_NOTIFY_ONDOWNLOAD:
+ self._notify_kodi(ep_name, common.notifyStrings[common.NOTIFY_DOWNLOAD])
+
+ def notify_subtitle_download(self, ep_name, lang):
+ if sickbeard.KODI_NOTIFY_ONSUBTITLEDOWNLOAD:
+ self._notify_kodi(ep_name + ': ' + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD])
+
+ def notify_git_update(self, new_version = '??'):
+ if sickbeard.USE_KODI:
+ update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT]
+ title=common.notifyStrings[common.NOTIFY_GIT_UPDATE]
+ self._notify_kodi(update_text + new_version, title)
+
+ def test_notify(self, host, username, password):
+ return self._notify_kodi('Testing Kodi notifications from SickGear', 'Test', host, username, password, force=True)
+
+ def update_library(self, showName=None):
+
+ if sickbeard.USE_KODI and sickbeard.KODI_UPDATE_LIBRARY:
+ if not sickbeard.KODI_HOST:
+ logger.log(u'KODI: No host specified, check your settings', logger.DEBUG)
+ return False
+
+ # either update each host, or only attempt to update first only
+ result = 0
+ for host in [x.strip() for x in sickbeard.KODI_HOST.split(',')]:
+ if self._update_library(host, showName):
+ if sickbeard.KODI_UPDATE_ONLYFIRST:
+ logger.log(u'KODI: Update first host successful on host ' + host + ', stopped sending library update commands', logger.DEBUG)
+ return True
+ else:
+ if sickbeard.KODI_ALWAYS_ON:
+ result = result + 1
+
+ # needed for the 'update kodi' submenu command
+ # as it only cares of the final result vs the individual ones
+ if result == 0:
+ return True
+ else:
+ return False
+
+notifier = KODINotifier
diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py
index 731e5e2c..900ce674 100644
--- a/sickbeard/postProcessor.py
+++ b/sickbeard/postProcessor.py
@@ -1012,6 +1012,9 @@ class PostProcessor(object):
# do the library update for XBMC
notifiers.xbmc_notifier.update_library(ep_obj.show.name)
+ # do the library update for Kodi
+ notifiers.kodi_notifier.update_library(ep_obj.show.name)
+
# do the library update for Plex
notifiers.plex_notifier.update_library(ep_obj)
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index f32b8903..7264285d 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -511,6 +511,7 @@ class Home(MainHandler):
{'title': 'Add Shows', 'path': 'home/addShows/', },
{'title': 'Manual Post-Processing', 'path': 'home/postprocess/'},
{'title': 'Update XBMC', 'path': 'home/updateXBMC/', 'requires': self.haveXBMC},
+ {'title': 'Update Kodi', 'path': 'home/updateKODI/', 'requires': self.haveKODI},
{'title': 'Update Plex', 'path': 'home/updatePLEX/', 'requires': self.havePLEX},
{'title': 'Manage Torrents', 'path': 'manage/manageTorrents', 'requires': self.haveTORRENT},
{'title': 'Restart', 'path': 'home/restart/?pid=' + str(sickbeard.PID), 'confirm': True},
@@ -521,6 +522,10 @@ class Home(MainHandler):
def haveXBMC():
return sickbeard.USE_XBMC and sickbeard.XBMC_UPDATE_LIBRARY
+ @staticmethod
+ def haveKODI():
+ return sickbeard.USE_KODI and sickbeard.KODI_UPDATE_LIBRARY
+
@staticmethod
def havePLEX():
return sickbeard.USE_PLEX and sickbeard.PLEX_UPDATE_LIBRARY
@@ -714,6 +719,24 @@ class Home(MainHandler):
return finalResult
+ def testKODI(self, host=None, username=None, password=None):
+ self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
+
+ host = config.clean_hosts(host)
+ if None is not password and set('*') == set(password):
+ password = sickbeard.KODI_PASSWORD
+
+ finalResult = ''
+ for curHost in [x.strip() for x in host.split(',')]:
+ curResult = notifiers.kodi_notifier.test_notify(urllib.unquote_plus(curHost), username, password)
+ if len(curResult.split(':')) > 2 and 'OK' in curResult.split(':')[2]:
+ finalResult += 'Test Kodi notice sent successfully to ' + urllib.unquote_plus(curHost)
+ else:
+ finalResult += 'Test Kodi notice failed to ' + urllib.unquote_plus(curHost)
+ finalResult += '
\n'
+
+ return finalResult
+
def testPMC(self, host=None, username=None, password=None):
self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
@@ -1009,7 +1032,10 @@ class Home(MainHandler):
{'title': 'Force Full Update', 'path': 'home/updateShow?show=%d&force=1' % showObj.indexerid})
t.submenu.append({'title': 'Update show in XBMC',
'path': 'home/updateXBMC?showName=%s' % urllib.quote_plus(
- showObj.name.encode('utf-8')), 'requires': self.haveXBMC})
+ showObj.name.encode('utf-8')), 'requires': self.haveXBMC})
+ t.submenu.append({'title': 'Update show in Kodi',
+ 'path': 'home/updateKODI?showName=%s' % urllib.quote_plus(
+ showObj.name.encode('utf-8')), 'requires': haveKODI})
t.submenu.append({'title': 'Preview Rename', 'path': 'home/testRename?show=%d' % showObj.indexerid})
if sickbeard.USE_SUBTITLES and not sickbeard.showQueueScheduler.action.isBeingSubtitled(
showObj) and showObj.subtitles:
@@ -1389,6 +1415,21 @@ class Home(MainHandler):
ui.notifications.error('Unable to contact one or more XBMC host(s): ' + host)
self.redirect('/home/')
+ def updateKODI(self, showName=None):
+
+ # only send update to first host in the list -- workaround for kodi sql backend users
+ if sickbeard.KODI_UPDATE_ONLYFIRST:
+ # only send update to first host in the list -- workaround for kodi sql backend users
+ host = sickbeard.KODI_HOST.split(',')[0].strip()
+ else:
+ host = sickbeard.KODI_HOST
+
+ if notifiers.kodi_notifier.update_library(showName=showName):
+ ui.notifications.message('Library update command sent to Kodi host(s): ' + host)
+ else:
+ ui.notifications.error('Unable to contact one or more Kodi host(s): ' + host)
+ redirect('/home/')
+
def updatePLEX(self, *args, **kwargs):
result = notifiers.plex_notifier.update_library()
if None is result:
@@ -3479,7 +3520,7 @@ class ConfigPostProcessing(Config):
def savePostProcessing(self, naming_pattern=None, naming_multi_ep=None,
xbmc_data=None, xbmc_12plus_data=None, mediabrowser_data=None, sony_ps3_data=None,
- wdtv_data=None, tivo_data=None, mede8er_data=None,
+ wdtv_data=None, tivo_data=None, mede8er_data=None, kodi_data=None,
keep_processed_dir=None, process_method=None, process_automatically=None,
rename_episodes=None, airdate_episodes=None, unpack=None,
move_associated_files=None, postpone_if_sync_files=None, nfo_rename=None, tv_download_dir=None, naming_custom_abd=None,
@@ -3535,6 +3576,7 @@ class ConfigPostProcessing(Config):
sickbeard.METADATA_WDTV = wdtv_data
sickbeard.METADATA_TIVO = tivo_data
sickbeard.METADATA_MEDE8ER = mede8er_data
+ sickbeard.METADATA_KODI = kodi_data
sickbeard.metadata_provider_dict['XBMC'].set_config(sickbeard.METADATA_XBMC)
sickbeard.metadata_provider_dict['XBMC 12+'].set_config(sickbeard.METADATA_XBMC_12PLUS)
@@ -3543,6 +3585,7 @@ class ConfigPostProcessing(Config):
sickbeard.metadata_provider_dict['WDTV'].set_config(sickbeard.METADATA_WDTV)
sickbeard.metadata_provider_dict['TIVO'].set_config(sickbeard.METADATA_TIVO)
sickbeard.metadata_provider_dict['Mede8er'].set_config(sickbeard.METADATA_MEDE8ER)
+ sickbeard.metadata_provider_dict['Kodi'].set_config(sickbeard.METADATA_KODI)
if self.isNamingValid(naming_pattern, naming_multi_ep, anime_type=naming_anime) != 'invalid':
sickbeard.NAMING_PATTERN = naming_pattern
@@ -4117,6 +4160,9 @@ class ConfigNotifications(Config):
xbmc_notify_onsubtitledownload=None, xbmc_update_onlyfirst=None,
xbmc_update_library=None, xbmc_update_full=None, xbmc_host=None, xbmc_username=None,
xbmc_password=None,
+ use_kodi=None, kodi_always_on=None, kodi_notify_onsnatch=None, kodi_notify_ondownload=None,
+ kodi_notify_onsubtitledownload=None, kodi_update_onlyfirst=None, kodi_update_library=None,
+ kodi_update_full=None, kodi_host=None, kodi_username=None, kodi_password=None,
use_plex=None, plex_notify_onsnatch=None, plex_notify_ondownload=None,
plex_notify_onsubtitledownload=None, plex_update_library=None,
plex_server_host=None, plex_host=None, plex_username=None, plex_password=None,
@@ -4170,6 +4216,19 @@ class ConfigNotifications(Config):
if set('*') != set(xbmc_password):
sickbeard.XBMC_PASSWORD = xbmc_password
+ sickbeard.USE_KODI = config.checkbox_to_value(use_kodi)
+ sickbeard.KODI_ALWAYS_ON = config.checkbox_to_value(kodi_always_on)
+ sickbeard.KODI_NOTIFY_ONSNATCH = config.checkbox_to_value(kodi_notify_onsnatch)
+ sickbeard.KODI_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(kodi_notify_ondownload)
+ sickbeard.KODI_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(kodi_notify_onsubtitledownload)
+ sickbeard.KODI_UPDATE_LIBRARY = config.checkbox_to_value(kodi_update_library)
+ sickbeard.KODI_UPDATE_FULL = config.checkbox_to_value(kodi_update_full)
+ sickbeard.KODI_UPDATE_ONLYFIRST = config.checkbox_to_value(kodi_update_onlyfirst)
+ sickbeard.KODI_HOST = config.clean_hosts(kodi_host)
+ sickbeard.KODI_USERNAME = kodi_username
+ if set('*') != set(kodi_password):
+ sickbeard.KODI_PASSWORD = kodi_password
+
sickbeard.USE_PLEX = config.checkbox_to_value(use_plex)
sickbeard.PLEX_NOTIFY_ONSNATCH = config.checkbox_to_value(plex_notify_onsnatch)
sickbeard.PLEX_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(plex_notify_ondownload)