From 9ecbd401f42fef83701ea8145a8fec91773016ed Mon Sep 17 00:00:00 2001 From: echel0n Date: Fri, 28 Nov 2014 14:47:43 -0800 Subject: [PATCH] Name change XBMC -> Kodi --- CHANGES.md | 2 +- gui/slick/css/dark.css | 4 +- gui/slick/css/light.css | 4 +- gui/slick/css/style.css | 4 +- .../default/config_notifications.tmpl | 76 +++--- gui/slick/interfaces/default/inc_top.tmpl | 8 +- gui/slick/js/configNotifications.js | 24 +- readme.md | 4 +- sickbeard/__init__.py | 92 +++---- sickbeard/config.py | 12 +- sickbeard/metadata/__init__.py | 4 +- sickbeard/metadata/generic.py | 2 +- sickbeard/metadata/mediabrowser.py | 4 +- sickbeard/metadata/xbmc.py | 10 +- sickbeard/metadata/xbmc_12plus.py | 14 +- sickbeard/notifiers/__init__.py | 6 +- sickbeard/notifiers/plex.py | 6 +- sickbeard/notifiers/xbmc.py | 240 +++++++++--------- sickbeard/postProcessor.py | 4 +- sickbeard/webserve.py | 82 +++--- 20 files changed, 301 insertions(+), 301 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f7206bb1..ae53e9f0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -49,7 +49,7 @@ * Add image to be used when Trakt posters are void on Add Show/Add Trending Show page * Fix growl registration not sending sickrage an update notification registration * Add an anonymous redirect builder for external links -* Update xbmc link to Kodi at Config Notifications +* Update kodi link to Kodi at Config Notifications * Fix missing url for kickasstorrents in config_providers * Fix post processing when using tvrage indexer and mediabrowser metadata generation * Change reporting failed network_timezones.txt updates from an error to a warning diff --git a/gui/slick/css/dark.css b/gui/slick/css/dark.css index 65c75ede..aa102da7 100644 --- a/gui/slick/css/dark.css +++ b/gui/slick/css/dark.css @@ -452,7 +452,7 @@ inc_top.tmpl background-position: -357px 0px; } -.menu-icon-xbmc { +.menu-icon-kodi { background-position: -378px 0px; } @@ -486,7 +486,7 @@ inc_top.tmpl background-position: -294px 0px; } -.submenu-icon-xbmc { +.submenu-icon-kodi { background-position: -378px 0px; } diff --git a/gui/slick/css/light.css b/gui/slick/css/light.css index 96f3fa95..809a7c41 100644 --- a/gui/slick/css/light.css +++ b/gui/slick/css/light.css @@ -434,7 +434,7 @@ inc_top.tmpl background-position: -357px 0px; } -.menu-icon-xbmc { +.menu-icon-kodi { background-position: -378px 0px; } @@ -468,7 +468,7 @@ inc_top.tmpl background-position: -294px 0px; } -.submenu-icon-xbmc { +.submenu-icon-kodi { background-position: -378px 0px; } diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index c6808db9..2100c582 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -434,7 +434,7 @@ inc_top.tmpl background-position: -357px 0px; } -.menu-icon-xbmc { +.menu-icon-kodi { background-position: -378px 0px; } @@ -468,7 +468,7 @@ inc_top.tmpl background-position: -294px 0px; } -.submenu-icon-xbmc { +.submenu-icon-kodi { background-position: -378px 0px; } diff --git a/gui/slick/interfaces/default/config_notifications.tmpl b/gui/slick/interfaces/default/config_notifications.tmpl index acbf68b7..4d3dd470 100644 --- a/gui/slick/interfaces/default/config_notifications.tmpl +++ b/gui/slick/interfaces/default/config_notifications.tmpl @@ -32,93 +32,93 @@
- -

XBMC

+ +

KODI

A free and open source cross-platform media center and home entertainment system software with a 10-foot user interface designed for the living-room TV.

-
-
+
-
-
-
-
-
-
-
-
-
-
-
Click below to test.
- +
Click below to test.
+ -
+
-
+
@@ -160,7 +160,7 @@

Plex Media Server

Experience your media on a visually stunning, easy to use interface on your Mac connected to your TV. Your media library has never looked this good!

-

For sending notifications to Plex Home Theater (PHT) clients, use the XBMC notifier with port 3005.

+

For sending notifications to Plex Home Theater (PHT) clients, use the KODI notifier with port 3005.

diff --git a/gui/slick/interfaces/default/inc_top.tmpl b/gui/slick/interfaces/default/inc_top.tmpl index f5973689..81f78bf1 100644 --- a/gui/slick/interfaces/default/inc_top.tmpl +++ b/gui/slick/interfaces/default/inc_top.tmpl @@ -109,8 +109,8 @@ \$("#SubMenu a:contains('Manage Torrents')").addClass('btn').html(' Manage Torrents'); \$("#SubMenu a[href$='/manage/failedDownloads/']").addClass('btn').html(' Failed Downloads'); \$("#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() { @@ -169,8 +169,8 @@ #if $sickbeard.USE_PLEX and $sickbeard.PLEX_SERVER_HOST != "":
  •  Update PLEX
  • #end if - #if $sickbeard.USE_XBMC and $sickbeard.XBMC_HOST != "": -
  •  Update XBMC
  • + #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' \ diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js index d430aa96..1f1c8f2a 100644 --- a/gui/slick/js/configNotifications.js +++ b/gui/slick/js/configNotifications.js @@ -37,22 +37,22 @@ $(document).ready(function(){ }); }); - $('#testXBMC').click(function () { - var xbmc_host = $.trim($('#xbmc_host').val()); - var xbmc_username = $.trim($('#xbmc_username').val()); - var xbmc_password = $.trim($('#xbmc_password').val()); - if (!xbmc_host) { - $('#testXBMC-result').html('Please fill out the necessary fields above.'); - $('#xbmc_host').addClass('warning'); + $('#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; } - $('#xbmc_host').removeClass('warning'); + $('#kodi_host').removeClass('warning'); $(this).prop('disabled', true); - $('#testXBMC-result').html(loading); - $.get(sbRoot + '/home/testXBMC', {'host': xbmc_host, 'username': xbmc_username, 'password': xbmc_password}) + $('#testKODI-result').html(loading); + $.get(sbRoot + '/home/testKODI', {'host': kodi_host, 'username': kodi_username, 'password': kodi_password}) .done(function (data) { - $('#testXBMC-result').html(data); - $('#testXBMC').prop('disabled', false); + $('#testKODI-result').html(data); + $('#testKODI').prop('disabled', false); }); }); diff --git a/readme.md b/readme.md index 6c064798..ddca59f8 100644 --- a/readme.md +++ b/readme.md @@ -9,10 +9,10 @@ Video File Manager for TV Shows, It watches for new episodes of your favorite sh [![Build Status](https://travis-ci.org/SiCKRAGETV/SickRage.svg?branch=master)](https://travis-ci.org/SiCKRAGETV/SickRage) ## Features - - XBMC library updates, poster/fanart downloads, and NFO/TBN generation + - KODI library updates, poster/fanart downloads, and NFO/TBN generation - configurable episode renaming - available for any platform, uses simple HTTP interface - - can notify XBMC, Growl, or Twitter when new episodes are available + - can notify KODI, Growl, or Twitter when new episodes are available - specials and double episode support - Automatic XEM Scene Numbering/Naming for seasons/episodes - Episode Status Manager now allows for mass failing seasons/episodes to force retrying. diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index 3571ff8a..314479f7 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -161,8 +161,8 @@ SORT_ARTICLE = False DEBUG = False USE_LISTVIEW = False -METADATA_XBMC = None -METADATA_XBMC_12PLUS = None +METADATA_KODI = None +METADATA_KODI_12PLUS = None METADATA_MEDIABROWSER = None METADATA_PS3 = None METADATA_WDTV = None @@ -277,17 +277,17 @@ TORRENT_LABEL = '' TORRENT_LABEL_ANIME = '' TORRENT_VERIFY_CERT = False -USE_XBMC = False -XBMC_ALWAYS_ON = True -XBMC_NOTIFY_ONSNATCH = False -XBMC_NOTIFY_ONDOWNLOAD = False -XBMC_NOTIFY_ONSUBTITLEDOWNLOAD = False -XBMC_UPDATE_LIBRARY = False -XBMC_UPDATE_FULL = False -XBMC_UPDATE_ONLYFIRST = False -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 @@ -483,8 +483,8 @@ def initialize(consoleLogging=True): SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, SAB_CATEGORY_ANIME, SAB_HOST, \ NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_CATEGORY_ANIME, NZBGET_PRIORITY, NZBGET_HOST, NZBGET_USE_HTTPS, backlogSearchScheduler, \ TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_LABEL_ANIME, 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, BACKLOG_FREQUENCY, \ 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, \ @@ -510,7 +510,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_KODI, METADATA_KODI_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \ NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, POSTPONE_IF_SYNC_FILES, dailySearchScheduler, NFO_RENAME, \ GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, THEME_NAME, \ POSTER_SORTBY, POSTER_SORTDIR, \ @@ -529,7 +529,7 @@ def initialize(consoleLogging=True): CheckSection(CFG, 'Newzbin') CheckSection(CFG, 'SABnzbd') CheckSection(CFG, 'NZBget') - CheckSection(CFG, 'XBMC') + CheckSection(CFG, 'KODI') CheckSection(CFG, 'PLEX') CheckSection(CFG, 'Growl') CheckSection(CFG, 'Prowl') @@ -771,17 +771,17 @@ def initialize(consoleLogging=True): TORRENT_LABEL_ANIME = check_setting_str(CFG, 'TORRENT', 'torrent_label_anime', '') TORRENT_VERIFY_CERT = bool(check_setting_int(CFG, 'TORRENT', 'torrent_verify_cert', 0)) - USE_XBMC = bool(check_setting_int(CFG, 'XBMC', 'use_xbmc', 0)) - XBMC_ALWAYS_ON = bool(check_setting_int(CFG, 'XBMC', 'xbmc_always_on', 1)) - XBMC_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_onsnatch', 0)) - XBMC_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_ondownload', 0)) - XBMC_NOTIFY_ONSUBTITLEDOWNLOAD = bool(check_setting_int(CFG, 'XBMC', 'xbmc_notify_onsubtitledownload', 0)) - XBMC_UPDATE_LIBRARY = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_library', 0)) - XBMC_UPDATE_FULL = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_full', 0)) - XBMC_UPDATE_ONLYFIRST = bool(check_setting_int(CFG, 'XBMC', 'xbmc_update_onlyfirst', 0)) - XBMC_HOST = check_setting_str(CFG, 'XBMC', 'xbmc_host', '') - 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)) @@ -955,8 +955,8 @@ def initialize(consoleLogging=True): ANIME_SPLIT_HOME = bool(check_setting_int(CFG, 'ANIME', 'anime_split_home', 0)) - METADATA_XBMC = check_setting_str(CFG, 'General', 'metadata_xbmc', '0|0|0|0|0|0|0|0|0|0') - METADATA_XBMC_12PLUS = check_setting_str(CFG, 'General', 'metadata_xbmc_12plus', '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') + METADATA_KODI_12PLUS = check_setting_str(CFG, 'General', 'metadata_kodi_12plus', '0|0|0|0|0|0|0|0|0|0') METADATA_MEDIABROWSER = check_setting_str(CFG, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0|0|0|0|0') METADATA_PS3 = check_setting_str(CFG, 'General', 'metadata_ps3', '0|0|0|0|0|0|0|0|0|0') METADATA_WDTV = check_setting_str(CFG, 'General', 'metadata_wdtv', '0|0|0|0|0|0|0|0|0|0') @@ -1111,8 +1111,8 @@ def initialize(consoleLogging=True): # initialize metadata_providers metadata_provider_dict = metadata.get_metadata_generator_dict() - for cur_metadata_tuple in [(METADATA_XBMC, metadata.xbmc), - (METADATA_XBMC_12PLUS, metadata.xbmc_12plus), + for cur_metadata_tuple in [(METADATA_KODI, metadata.kodi), + (METADATA_KODI_12PLUS, metadata.kodi_12plus), (METADATA_MEDIABROWSER, metadata.mediabrowser), (METADATA_PS3, metadata.ps3), (METADATA_WDTV, metadata.wdtv), @@ -1461,8 +1461,8 @@ def save_config(): new_config['General']['proxy_indexers'] = int(PROXY_INDEXERS) new_config['General']['use_listview'] = int(USE_LISTVIEW) - new_config['General']['metadata_xbmc'] = METADATA_XBMC - new_config['General']['metadata_xbmc_12plus'] = METADATA_XBMC_12PLUS + new_config['General']['metadata_kodi'] = METADATA_KODI + new_config['General']['metadata_kodi_12plus'] = METADATA_KODI_12PLUS new_config['General']['metadata_mediabrowser'] = METADATA_MEDIABROWSER new_config['General']['metadata_ps3'] = METADATA_PS3 new_config['General']['metadata_wdtv'] = METADATA_WDTV @@ -1620,18 +1620,18 @@ def save_config(): new_config['TORRENT']['torrent_label_anime'] = TORRENT_LABEL_ANIME new_config['TORRENT']['torrent_verify_cert'] = int(TORRENT_VERIFY_CERT) - new_config['XBMC'] = {} - new_config['XBMC']['use_xbmc'] = int(USE_XBMC) - new_config['XBMC']['xbmc_always_on'] = int(XBMC_ALWAYS_ON) - new_config['XBMC']['xbmc_notify_onsnatch'] = int(XBMC_NOTIFY_ONSNATCH) - new_config['XBMC']['xbmc_notify_ondownload'] = int(XBMC_NOTIFY_ONDOWNLOAD) - new_config['XBMC']['xbmc_notify_onsubtitledownload'] = int(XBMC_NOTIFY_ONSUBTITLEDOWNLOAD) - new_config['XBMC']['xbmc_update_library'] = int(XBMC_UPDATE_LIBRARY) - new_config['XBMC']['xbmc_update_full'] = int(XBMC_UPDATE_FULL) - new_config['XBMC']['xbmc_update_onlyfirst'] = int(XBMC_UPDATE_ONLYFIRST) - new_config['XBMC']['xbmc_host'] = XBMC_HOST - 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) diff --git a/sickbeard/config.py b/sickbeard/config.py index b8e28814..f2af47be 100644 --- a/sickbeard/config.py +++ b/sickbeard/config.py @@ -661,11 +661,11 @@ class ConfigMigrator(): new format: 0|0|0|0|0|0|0|0|0|0 -- 10 places Drop the use of use_banner option. - Migrate the poster override to just using the banner option (applies to xbmc only). + Migrate the poster override to just using the banner option (applies to kodi only). """ - metadata_xbmc = check_setting_str(self.config_obj, 'General', 'metadata_xbmc', '0|0|0|0|0|0') - metadata_xbmc_12plus = check_setting_str(self.config_obj, 'General', 'metadata_xbmc_12plus', '0|0|0|0|0|0') + metadata_kodi = check_setting_str(self.config_obj, 'General', 'metadata_kodi', '0|0|0|0|0|0') + metadata_kodi_12plus = check_setting_str(self.config_obj, 'General', 'metadata_kodi_12plus', '0|0|0|0|0|0') metadata_mediabrowser = check_setting_str(self.config_obj, 'General', 'metadata_mediabrowser', '0|0|0|0|0|0') metadata_ps3 = check_setting_str(self.config_obj, 'General', 'metadata_ps3', '0|0|0|0|0|0') metadata_wdtv = check_setting_str(self.config_obj, 'General', 'metadata_wdtv', '0|0|0|0|0|0') @@ -686,7 +686,7 @@ class ConfigMigrator(): # swap show fanart, show poster cur_metadata[3], cur_metadata[2] = cur_metadata[2], cur_metadata[3] # if user was using use_banner to override the poster, instead enable the banner option and deactivate poster - if metadata_name == 'XBMC' and use_banner: + if metadata_name == 'KODI' and use_banner: cur_metadata[4], cur_metadata[3] = cur_metadata[3], '0' # write new format metadata = '|'.join(cur_metadata) @@ -705,8 +705,8 @@ class ConfigMigrator(): return metadata - sickbeard.METADATA_XBMC = _migrate_metadata(metadata_xbmc, 'XBMC', use_banner) - sickbeard.METADATA_XBMC_12PLUS = _migrate_metadata(metadata_xbmc_12plus, 'XBMC 12+', use_banner) + sickbeard.METADATA_KODI = _migrate_metadata(metadata_kodi, 'KODI', use_banner) + sickbeard.METADATA_KODI_12PLUS = _migrate_metadata(metadata_kodi_12plus, 'KODI 12+', use_banner) sickbeard.METADATA_MEDIABROWSER = _migrate_metadata(metadata_mediabrowser, 'MediaBrowser', use_banner) sickbeard.METADATA_PS3 = _migrate_metadata(metadata_ps3, 'PS3', use_banner) sickbeard.METADATA_WDTV = _migrate_metadata(metadata_wdtv, 'WDTV', use_banner) diff --git a/sickbeard/metadata/__init__.py b/sickbeard/metadata/__init__.py index 6a01fdcf..3645c5b4 100644 --- a/sickbeard/metadata/__init__.py +++ b/sickbeard/metadata/__init__.py @@ -16,10 +16,10 @@ # You should have received a copy of the GNU General Public License # along with SickRage. If not, see . -__all__ = ['generic', 'helpers', 'xbmc', 'xbmc_12plus', 'mediabrowser', 'ps3', 'wdtv', 'tivo', 'mede8er'] +__all__ = ['generic', 'helpers', 'kodi', 'kodi_12plus', 'mediabrowser', 'ps3', 'wdtv', 'tivo', 'mede8er'] import sys -import xbmc, xbmc_12plus, mediabrowser, ps3, wdtv, tivo, mede8er +import kodi, kodi_12plus, mediabrowser, ps3, wdtv, tivo, mede8er def available_generators(): diff --git a/sickbeard/metadata/generic.py b/sickbeard/metadata/generic.py index 4234404d..c623be2b 100644 --- a/sickbeard/metadata/generic.py +++ b/sickbeard/metadata/generic.py @@ -39,7 +39,7 @@ from lib.tmdb_api.tmdb_api import TMDB class GenericMetadata(): """ Base class for all metadata providers. Default behavior is meant to mostly - follow XBMC 12+ metadata standards. Has support for: + follow KODI 12+ metadata standards. Has support for: - show metadata file - episode metadata file - episode thumbnail diff --git a/sickbeard/metadata/mediabrowser.py b/sickbeard/metadata/mediabrowser.py index 5f303fed..ef626f92 100644 --- a/sickbeard/metadata/mediabrowser.py +++ b/sickbeard/metadata/mediabrowser.py @@ -154,7 +154,7 @@ class MediaBrowserMetadata(generic.GenericMetadata): for cur_dir in dir_list: # MediaBrowser 1.x only supports 'Specials' # MediaBrowser 2.x looks to only support 'Season 0' - # MediaBrowser 3.x looks to mimic XBMC/Plex support + # MediaBrowser 3.x looks to mimic KODI/Plex support if season == 0 and cur_dir == "Specials": season_dir = cur_dir break @@ -194,7 +194,7 @@ class MediaBrowserMetadata(generic.GenericMetadata): for cur_dir in dir_list: # MediaBrowser 1.x only supports 'Specials' # MediaBrowser 2.x looks to only support 'Season 0' - # MediaBrowser 3.x looks to mimic XBMC/Plex support + # MediaBrowser 3.x looks to mimic KODI/Plex support if season == 0 and cur_dir == "Specials": season_dir = cur_dir break diff --git a/sickbeard/metadata/xbmc.py b/sickbeard/metadata/xbmc.py index 3e26756f..71d1eedf 100644 --- a/sickbeard/metadata/xbmc.py +++ b/sickbeard/metadata/xbmc.py @@ -17,7 +17,7 @@ # along with SickRage. If not, see . import generic -import xbmc_12plus +import kodi_12plus import os @@ -25,9 +25,9 @@ from sickbeard import helpers from sickbeard import encodingKludge as ek -class XBMCMetadata(xbmc_12plus.XBMC_12PlusMetadata): +class KODIMetadata(kodi_12plus.KODI_12PlusMetadata): """ - Metadata generation class for XBMC (legacy). + Metadata generation class for KODI (legacy). The following file structure is used: @@ -66,7 +66,7 @@ class XBMCMetadata(xbmc_12plus.XBMC_12PlusMetadata): season_all_poster, season_all_banner) - self.name = 'XBMC' + self.name = 'KODI' self.poster_name = self.banner_name = "folder.jpg" self.season_all_poster_name = "season-all.tbn" @@ -123,4 +123,4 @@ class XBMCMetadata(xbmc_12plus.XBMC_12PlusMetadata): # present a standard "interface" from the module -metadata_class = XBMCMetadata +metadata_class = KODIMetadata diff --git a/sickbeard/metadata/xbmc_12plus.py b/sickbeard/metadata/xbmc_12plus.py index b1664dd1..17fd0e0c 100644 --- a/sickbeard/metadata/xbmc_12plus.py +++ b/sickbeard/metadata/xbmc_12plus.py @@ -26,9 +26,9 @@ from sickbeard.exceptions import ex import xml.etree.cElementTree as etree -class XBMC_12PlusMetadata(generic.GenericMetadata): +class KODI_12PlusMetadata(generic.GenericMetadata): """ - Metadata generation class for XBMC 12+. + Metadata generation class for KODI 12+. The following file structure is used: @@ -69,7 +69,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): season_all_poster, season_all_banner) - self.name = 'XBMC 12+' + self.name = 'KODI 12+' self.poster_name = "poster.jpg" self.season_all_poster_name = "season-all-poster.jpg" @@ -88,7 +88,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): def _show_data(self, show_obj): """ - Creates an elementTree XML structure for an XBMC-style tvshow.nfo and + Creates an elementTree XML structure for an KODI-style tvshow.nfo and returns the resulting data object. show_obj: a TVShow instance to create the NFO for @@ -212,7 +212,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): def _ep_data(self, ep_obj): """ - Creates an elementTree XML structure for an XBMC-style episode.nfo and + Creates an elementTree XML structure for an KODI-style episode.nfo and returns the resulting data object. show_obj: a TVEpisode instance to create the NFO for """ @@ -242,7 +242,7 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): return if len(eps_to_write) > 1: - rootNode = etree.Element("xbmcmultiepisode") + rootNode = etree.Element("kodimultiepisode") else: rootNode = etree.Element("episodedetails") @@ -373,4 +373,4 @@ class XBMC_12PlusMetadata(generic.GenericMetadata): # present a standard "interface" from the module -metadata_class = XBMC_12PlusMetadata +metadata_class = KODI_12PlusMetadata diff --git a/sickbeard/notifiers/__init__.py b/sickbeard/notifiers/__init__.py index b8299fb4..ad718dc8 100644 --- a/sickbeard/notifiers/__init__.py +++ b/sickbeard/notifiers/__init__.py @@ -18,7 +18,7 @@ import sickbeard -import xbmc +import kodi import plex import nmj import nmjv2 @@ -43,7 +43,7 @@ import emailnotify 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() @@ -67,7 +67,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/plex.py b/sickbeard/notifiers/plex.py index 3d9f8717..d0d20688 100644 --- a/sickbeard/notifiers/plex.py +++ b/sickbeard/notifiers/plex.py @@ -27,13 +27,13 @@ from sickbeard import common from sickbeard.exceptions import ex from sickbeard.encodingKludge import toUnicode -from sickbeard.notifiers.xbmc import XBMCNotifier +from sickbeard.notifiers.kodi import KODINotifier # TODO: switch over to using ElementTree from xml.dom import minidom -class PLEXNotifier(XBMCNotifier): +class PLEXNotifier(KODINotifier): def _notify_pmc(self, message, title="SickRage", host=None, username=None, password=None, force=False): # fill in omitted parameters if not host: @@ -52,7 +52,7 @@ class PLEXNotifier(XBMCNotifier): logger.log("Notification for Plex not enabled, skipping this notification", logger.DEBUG) return False - return self._notify_xbmc(message=message, title=title, host=host, username=username, password=password, + return self._notify_kodi(message=message, title=title, host=host, username=username, password=password, force=True) def notify_snatch(self, ep_name): diff --git a/sickbeard/notifiers/xbmc.py b/sickbeard/notifiers/xbmc.py index 49683bba..12468b32 100644 --- a/sickbeard/notifiers/xbmc.py +++ b/sickbeard/notifiers/xbmc.py @@ -40,27 +40,27 @@ except ImportError: from lib import simplejson as json -class XBMCNotifier: +class KODINotifier: sb_logo_url = 'https://raw.githubusercontent.com/SiCKRAGETV/SickRage/master/gui/slick/images/sickrage-shark-mascot.png' - def _get_xbmc_version(self, host, username, password): - """Returns XBMC JSON-RPC API version (odd # = dev, even # = stable) + def _get_kodi_version(self, host, username, password): + """Returns KODI JSON-RPC API version (odd # = dev, even # = stable) - Sends a request to the XBMC host using the JSON-RPC to determine if + Sends a request to the KODI host using the JSON-RPC to determine if the legacy API or if the JSON-RPC API functions should be used. Fallback to testing legacy HTTPAPI before assuming it is just a badly configured host. Args: - host: XBMC webserver host:port - username: XBMC webserver username - password: XBMC webserver password + host: KODI webserver host:port + username: KODI webserver username + password: KODI webserver password Returns: Returns API number or False List of possible known values: - API | XBMC Version + API | KODI Version -----+--------------- 2 | v10 (Dharma) 3 | (pre Eden) @@ -75,7 +75,7 @@ class XBMCNotifier: socket.setdefaulttimeout(10) checkCommand = '{"jsonrpc":"2.0","method":"JSONRPC.Version","id":1}' - result = self._send_to_xbmc_json(checkCommand, host, username, password) + result = self._send_to_kodi_json(checkCommand, host, username, password) # revert back to default socket timeout socket.setdefaulttimeout(sickbeard.SOCKET_TIMEOUT) @@ -85,14 +85,14 @@ class XBMCNotifier: else: # fallback to legacy HTTPAPI method testCommand = {'command': 'Help'} - request = self._send_to_xbmc(testCommand, host, username, password) + request = self._send_to_kodi(testCommand, host, username, password) if request: # return a fake version number, so it uses the legacy method return 1 else: return False - def _notify_xbmc(self, message, title="SickRage", host=None, username=None, password=None, force=False): + def _notify_kodi(self, message, title="SickRage", host=None, username=None, password=None, force=False): """Internal wrapper for the notify_snatch and notify_download functions Detects JSON-RPC version then branches the logic for either the JSON-RPC or legacy HTTP API methods. @@ -100,9 +100,9 @@ class XBMCNotifier: Args: message: Message body of the notice to send title: Title of the notice to send - host: XBMC webserver host:port - username: XBMC webserver username - password: XBMC webserver password + host: KODI webserver host:port + username: KODI webserver username + password: KODI webserver password force: Used for the Test method to override config saftey checks Returns: @@ -113,42 +113,42 @@ class XBMCNotifier: # fill in omitted parameters if not host: - host = sickbeard.XBMC_HOST + host = sickbeard.KODI_HOST if not username: - username = sickbeard.XBMC_USERNAME + username = sickbeard.KODI_USERNAME if not password: - password = sickbeard.XBMC_PASSWORD + password = sickbeard.KODI_PASSWORD # suppress notifications if the notifier is disabled but the notify options are checked - if not sickbeard.USE_XBMC and not force: - logger.log("Notification for XBMC not enabled, skipping this notification", logger.DEBUG) + if not sickbeard.USE_KODI and not force: + logger.log("Notification for KODI not enabled, skipping this notification", logger.DEBUG) return False result = '' for curHost in [x.strip() for x in host.split(",")]: - logger.log(u"Sending XBMC notification to '" + curHost + "' - " + message, logger.MESSAGE) + logger.log(u"Sending KODI notification to '" + curHost + "' - " + message, logger.MESSAGE) - xbmcapi = self._get_xbmc_version(curHost, username, password) - if xbmcapi: - if (xbmcapi <= 4): - logger.log(u"Detected XBMC version <= 11, using XBMC HTTP API", logger.DEBUG) + kodiapi = self._get_kodi_version(curHost, username, password) + if kodiapi: + if (kodiapi <= 4): + logger.log(u"Detected KODI version <= 11, using KODI HTTP API", logger.DEBUG) command = {'command': 'ExecBuiltIn', 'parameter': 'Notification(' + title.encode("utf-8") + ',' + message.encode( "utf-8") + ')'} - notifyResult = self._send_to_xbmc(command, curHost, username, password) + notifyResult = self._send_to_kodi(command, curHost, username, password) if notifyResult: result += curHost + ':' + str(notifyResult) else: - logger.log(u"Detected XBMC version >= 12, using XBMC JSON API", logger.DEBUG) + logger.log(u"Detected KODI version >= 12, using KODI JSON API", logger.DEBUG) 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.sb_logo_url) - notifyResult = self._send_to_xbmc_json(command, curHost, username, password) + notifyResult = self._send_to_kodi_json(command, curHost, username, password) if notifyResult.get('result'): result += curHost + ':' + notifyResult["result"].decode(sickbeard.SYS_ENCODING) else: - if sickbeard.XBMC_ALWAYS_ON or force: + if sickbeard.KODI_ALWAYS_ON or force: logger.log( - u"Failed to detect XBMC version for '" + curHost + "', check configuration and try again.", + u"Failed to detect KODI version for '" + curHost + "', check configuration and try again.", logger.ERROR) result += curHost + ':False' @@ -157,10 +157,10 @@ class XBMCNotifier: def _send_update_library(self, host, showName=None): """Internal wrapper for the update library function to branch the logic for JSON-RPC or legacy HTTP API - Checks the XBMC API version to branch the logic to call either the legacy HTTP API or the newer JSON-RPC over HTTP methods. + Checks the KODI API version to branch the logic to call either the legacy HTTP API or the newer JSON-RPC over HTTP methods. Args: - host: XBMC webserver host:port + host: KODI webserver host:port showName: Name of a TV show to specifically target the library update for Returns: @@ -168,43 +168,43 @@ class XBMCNotifier: """ - logger.log(u"Sending request to update library for XBMC host: '" + host + "'", logger.MESSAGE) + logger.log(u"Sending request to update library for KODI host: '" + host + "'", logger.MESSAGE) - xbmcapi = self._get_xbmc_version(host, sickbeard.XBMC_USERNAME, sickbeard.XBMC_PASSWORD) - if xbmcapi: - if (xbmcapi <= 4): + kodiapi = self._get_kodi_version(host, sickbeard.KODI_USERNAME, sickbeard.KODI_PASSWORD) + if kodiapi: + if (kodiapi <= 4): # try to update for just the show, if it fails, do full update if enabled - if not self._update_library(host, showName) and sickbeard.XBMC_UPDATE_FULL: + if not self._update_library(host, showName) and sickbeard.KODI_UPDATE_FULL: logger.log(u"Single show update failed, falling back to full update", logger.WARNING) return self._update_library(host) else: return True else: # try to update for just the show, if it fails, do full update if enabled - if not self._update_library_json(host, showName) and sickbeard.XBMC_UPDATE_FULL: + if not self._update_library_json(host, showName) and sickbeard.KODI_UPDATE_FULL: logger.log(u"Single show update failed, falling back to full update", logger.WARNING) return self._update_library_json(host) else: return True else: - logger.log(u"Failed to detect XBMC version for '" + host + "', check configuration and try again.", + logger.log(u"Failed to detect KODI version for '" + host + "', check configuration and try again.", logger.DEBUG) return False return False # ############################################################################# - # Legacy HTTP API (pre XBMC 12) methods + # Legacy HTTP API (pre KODI 12) methods ############################################################################## - def _send_to_xbmc(self, command, host=None, username=None, password=None): - """Handles communication to XBMC servers via HTTP API + def _send_to_kodi(self, command, host=None, username=None, password=None): + """Handles communication to KODI servers via HTTP API Args: - command: Dictionary of field/data pairs, encoded via urllib and passed to the XBMC API via HTTP - host: XBMC webserver host:port - username: XBMC webserver username - password: XBMC webserver password + command: Dictionary of field/data pairs, encoded via urllib and passed to the KODI API via HTTP + host: KODI webserver host:port + username: KODI webserver username + password: KODI webserver password Returns: Returns response.result for successful commands or False if there was an error @@ -213,12 +213,12 @@ class XBMCNotifier: # fill in omitted parameters if not username: - username = sickbeard.XBMC_USERNAME + username = sickbeard.KODI_USERNAME if not password: - password = sickbeard.XBMC_PASSWORD + password = sickbeard.KODI_PASSWORD if not host: - logger.log(u'No XBMC host passed, aborting update', logger.DEBUG) + logger.log(u'No KODI host passed, aborting update', logger.DEBUG) return False for key in command: @@ -226,9 +226,9 @@ class XBMCNotifier: command[key] = command[key].encode('utf-8') enc_command = urllib.urlencode(command) - logger.log(u"XBMC encoded API command: " + enc_command, logger.DEBUG) + logger.log(u"KODI encoded API command: " + enc_command, logger.DEBUG) - url = 'http://%s/xbmcCmds/xbmcHttp/?%s' % (host, enc_command) + url = 'http://%s/kodiCmds/kodiHttp/?%s' % (host, enc_command) try: req = urllib2.Request(url) # if we have a password, use authentication @@ -236,30 +236,30 @@ class XBMCNotifier: base64string = base64.encodestring('%s:%s' % (username, password))[:-1] authheader = "Basic %s" % base64string req.add_header("Authorization", authheader) - logger.log(u"Contacting XBMC (with auth header) via url: " + toUnicode(url), logger.DEBUG) + logger.log(u"Contacting KODI (with auth header) via url: " + toUnicode(url), logger.DEBUG) else: - logger.log(u"Contacting XBMC via url: " + toUnicode(url), logger.DEBUG) + logger.log(u"Contacting KODI via url: " + toUnicode(url), logger.DEBUG) response = urllib2.urlopen(req) result = response.read().decode(sickbeard.SYS_ENCODING) response.close() - logger.log(u"XBMC HTTP response: " + result.replace('\n', ''), logger.DEBUG) + logger.log(u"KODI HTTP response: " + result.replace('\n', ''), logger.DEBUG) return result except (urllib2.URLError, IOError), e: - logger.log(u"Warning: Couldn't contact XBMC HTTP at " + toUnicode(url) + " " + ex(e), + logger.log(u"Warning: Couldn't contact KODI HTTP at " + toUnicode(url) + " " + ex(e), logger.WARNING) return False def _update_library(self, host=None, showName=None): - """Handles updating XBMC host via HTTP API + """Handles updating KODI host via HTTP API - Attempts to update the XBMC video library for a specific tv show if passed, + Attempts to update the KODI video library for a specific tv show if passed, otherwise update the whole library if enabled. Args: - host: XBMC webserver host:port + host: KODI webserver host:port showName: Name of a TV show to specifically target the library update for Returns: @@ -268,14 +268,14 @@ class XBMCNotifier: """ if not host: - logger.log(u'No XBMC host passed, aborting update', logger.DEBUG) + logger.log(u'No KODI host passed, aborting update', logger.DEBUG) return False logger.log(u"Updating XMBC library via HTTP method for host: " + host, logger.DEBUG) # if we're doing per-show if showName: - logger.log(u"Updating library in XBMC via HTTP method for show " + showName, logger.DEBUG) + logger.log(u"Updating library in KODI via HTTP method for show " + showName, logger.DEBUG) pathSql = 'select path.strPath from path, tvshow, tvshowlinkpath where ' \ 'tvshow.c00 = "%s" and tvshowlinkpath.idShow = tvshow.idShow ' \ @@ -290,12 +290,12 @@ class XBMCNotifier: resetCommand = {'command': 'SetResponseFormat()'} # set xml response format, if this fails then don't bother with the rest - request = self._send_to_xbmc(xmlCommand, host) + request = self._send_to_kodi(xmlCommand, host) if not request: return False - sqlXML = self._send_to_xbmc(sqlCommand, host) - request = self._send_to_xbmc(resetCommand, host) + sqlXML = self._send_to_kodi(sqlCommand, host) + request = self._send_to_kodi(resetCommand, host) if not sqlXML: logger.log(u"Invalid response for " + showName + " on " + host, logger.DEBUG) @@ -305,7 +305,7 @@ class XBMCNotifier: try: et = etree.fromstring(encSqlXML) except SyntaxError, e: - logger.log(u"Unable to parse XML returned from XBMC: " + ex(e), logger.ERROR) + logger.log(u"Unable to parse XML returned from KODI: " + ex(e), logger.ERROR) return False paths = et.findall('.//field') @@ -317,40 +317,40 @@ class XBMCNotifier: for path in paths: # we do not need it double-encoded, gawd this is dumb unEncPath = urllib.unquote(path.text).decode(sickbeard.SYS_ENCODING) - logger.log(u"XBMC Updating " + showName + " on " + host + " at " + unEncPath, logger.DEBUG) - updateCommand = {'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video, %s)' % (unEncPath)} - request = self._send_to_xbmc(updateCommand, host) + logger.log(u"KODI Updating " + showName + " on " + host + " at " + unEncPath, logger.DEBUG) + updateCommand = {'command': 'ExecBuiltIn', 'parameter': 'KODI.updatelibrary(video, %s)' % (unEncPath)} + request = self._send_to_kodi(updateCommand, host) if not request: logger.log(u"Update of show directory failed on " + showName + " on " + host + " at " + unEncPath, logger.ERROR) return False - # sleep for a few seconds just to be sure xbmc has a chance to finish each directory + # sleep for a few seconds just to be sure kodi has a chance to finish each directory if len(paths) > 1: time.sleep(5) # do a full update if requested else: - logger.log(u"Doing Full Library XBMC update on host: " + host, logger.MESSAGE) - updateCommand = {'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'} - request = self._send_to_xbmc(updateCommand, host) + logger.log(u"Doing Full Library KODI update on host: " + host, logger.MESSAGE) + updateCommand = {'command': 'ExecBuiltIn', 'parameter': 'KODI.updatelibrary(video)'} + request = self._send_to_kodi(updateCommand, host) if not request: - logger.log(u"XBMC Full Library update failed on: " + host, logger.ERROR) + logger.log(u"KODI Full Library update failed on: " + host, logger.ERROR) return False return True ############################################################################## - # JSON-RPC API (XBMC 12+) methods + # JSON-RPC API (KODI 12+) methods ############################################################################## - def _send_to_xbmc_json(self, command, host=None, username=None, password=None): - """Handles communication to XBMC servers via JSONRPC + def _send_to_kodi_json(self, command, host=None, username=None, password=None): + """Handles communication to KODI servers via JSONRPC Args: - command: Dictionary of field/data pairs, encoded via urllib and passed to the XBMC JSON-RPC via HTTP - host: XBMC webserver host:port - username: XBMC webserver username - password: XBMC webserver password + command: Dictionary of field/data pairs, encoded via urllib and passed to the KODI JSON-RPC via HTTP + host: KODI webserver host:port + username: KODI webserver username + password: KODI webserver password Returns: Returns response.result for successful commands or False if there was an error @@ -359,16 +359,16 @@ class XBMCNotifier: # fill in omitted parameters if not username: - username = sickbeard.XBMC_USERNAME + username = sickbeard.KODI_USERNAME if not password: - password = sickbeard.XBMC_PASSWORD + password = sickbeard.KODI_PASSWORD if not host: - logger.log(u'No XBMC host passed, aborting update', logger.DEBUG) + logger.log(u'No KODI host passed, aborting update', logger.DEBUG) return False command = command.encode('utf-8') - logger.log(u"XBMC JSON command: " + command, logger.DEBUG) + logger.log(u"KODI JSON command: " + command, logger.DEBUG) url = 'http://%s/jsonrpc' % (host) try: @@ -379,14 +379,14 @@ class XBMCNotifier: base64string = base64.encodestring('%s:%s' % (username, password))[:-1] authheader = "Basic %s" % base64string req.add_header("Authorization", authheader) - logger.log(u"Contacting XBMC (with auth header) via url: " + toUnicode(url), logger.DEBUG) + logger.log(u"Contacting KODI (with auth header) via url: " + toUnicode(url), logger.DEBUG) else: - logger.log(u"Contacting XBMC via url: " + toUnicode(url), logger.DEBUG) + logger.log(u"Contacting KODI via url: " + toUnicode(url), logger.DEBUG) try: response = urllib2.urlopen(req) except urllib2.URLError, e: - logger.log(u"Error while trying to retrieve XBMC API version for " + host + ": " + ex(e), + logger.log(u"Error while trying to retrieve KODI API version for " + host + ": " + ex(e), logger.WARNING) return False @@ -394,25 +394,25 @@ class XBMCNotifier: try: result = json.load(response) response.close() - logger.log(u"XBMC JSON response: " + str(result), logger.DEBUG) + logger.log(u"KODI JSON response: " + str(result), logger.DEBUG) return result # need to return response for parsing except ValueError, e: logger.log(u"Unable to decode JSON: " + response, logger.WARNING) return False except IOError, e: - logger.log(u"Warning: Couldn't contact XBMC JSON API at " + toUnicode(url) + " " + ex(e), + logger.log(u"Warning: Couldn't contact KODI JSON API at " + toUnicode(url) + " " + ex(e), logger.WARNING) return False def _update_library_json(self, host=None, showName=None): - """Handles updating XBMC host via HTTP JSON-RPC + """Handles updating KODI host via HTTP JSON-RPC - Attempts to update the XBMC video library for a specific tv show if passed, + Attempts to update the KODI video library for a specific tv show if passed, otherwise update the whole library if enabled. Args: - host: XBMC webserver host:port + host: KODI webserver host:port showName: Name of a TV show to specifically target the library update for Returns: @@ -421,7 +421,7 @@ class XBMCNotifier: """ if not host: - logger.log(u'No XBMC host passed, aborting update', logger.DEBUG) + logger.log(u'No KODI host passed, aborting update', logger.DEBUG) return False logger.log(u"Updating XMBC library via JSON method for host: " + host, logger.MESSAGE) @@ -429,16 +429,16 @@ class XBMCNotifier: # if we're doing per-show if showName: tvshowid = -1 - logger.log(u"Updating library in XBMC via JSON method for show " + showName, logger.DEBUG) + logger.log(u"Updating library in KODI via JSON method for show " + showName, logger.DEBUG) # get tvshowid by showName showsCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.GetTVShows","id":1}' - showsResponse = self._send_to_xbmc_json(showsCommand, host) + showsResponse = self._send_to_kodi_json(showsCommand, host) if showsResponse and "result" in showsResponse and "tvshows" in showsResponse["result"]: shows = showsResponse["result"]["tvshows"] else: - logger.log(u"XBMC: No tvshows in XBMC TV show list", logger.DEBUG) + logger.log(u"KODI: No tvshows in KODI TV show list", logger.DEBUG) return False for show in shows: @@ -451,13 +451,13 @@ class XBMCNotifier: # we didn't find the show (exact match), thus revert to just doing a full update if enabled if (tvshowid == -1): - logger.log(u'Exact show name not matched in XBMC TV show list', logger.DEBUG) + logger.log(u'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_xbmc_json(pathCommand, host) + pathResponse = self._send_to_kodi_json(pathCommand, host) path = pathResponse["result"]["tvshowdetails"]["file"] logger.log(u"Received Show: " + showName + " with ID: " + str(tvshowid) + " Path: " + path, @@ -468,10 +468,10 @@ class XBMCNotifier: logger.WARNING) return False - logger.log(u"XBMC Updating " + showName + " on " + host + " at " + path, logger.DEBUG) + 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_xbmc_json(updateCommand, host) + request = self._send_to_kodi_json(updateCommand, host) if not request: logger.log(u"Update of show directory failed on " + showName + " on " + host + " at " + path, logger.ERROR) @@ -487,12 +487,12 @@ class XBMCNotifier: # do a full update if requested else: - logger.log(u"Doing Full Library XBMC update on host: " + host, logger.MESSAGE) + logger.log(u"Doing Full Library KODI update on host: " + host, logger.MESSAGE) updateCommand = '{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}' - request = self._send_to_xbmc_json(updateCommand, host, sickbeard.XBMC_USERNAME, sickbeard.XBMC_PASSWORD) + request = self._send_to_kodi_json(updateCommand, host, sickbeard.KODI_USERNAME, sickbeard.KODI_PASSWORD) if not request: - logger.log(u"XBMC Full Library update failed on: " + host, logger.ERROR) + logger.log(u"KODI Full Library update failed on: " + host, logger.ERROR) return False return True @@ -502,31 +502,31 @@ class XBMCNotifier: ############################################################################## def notify_snatch(self, ep_name): - if sickbeard.XBMC_NOTIFY_ONSNATCH: - self._notify_xbmc(ep_name, common.notifyStrings[common.NOTIFY_SNATCH]) + if sickbeard.KODI_NOTIFY_ONSNATCH: + self._notify_kodi(ep_name, common.notifyStrings[common.NOTIFY_SNATCH]) def notify_download(self, ep_name): - if sickbeard.XBMC_NOTIFY_ONDOWNLOAD: - self._notify_xbmc(ep_name, common.notifyStrings[common.NOTIFY_DOWNLOAD]) + 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.XBMC_NOTIFY_ONSUBTITLEDOWNLOAD: - self._notify_xbmc(ep_name + ": " + lang, common.notifyStrings[common.NOTIFY_SUBTITLE_DOWNLOAD]) + 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_XBMC: + if sickbeard.USE_KODI: update_text=common.notifyStrings[common.NOTIFY_GIT_UPDATE_TEXT] title=common.notifyStrings[common.NOTIFY_GIT_UPDATE] - self._notify_xbmc(update_text + new_version, title) + self._notify_kodi(update_text + new_version, title) def test_notify(self, host, username, password): - return self._notify_xbmc("Testing XBMC notifications from SickRage", "Test Notification", host, username, + return self._notify_kodi("Testing KODI notifications from SickRage", "Test Notification", host, username, password, force=True) def update_library(self, showName=None): """Public wrapper for the update library functions to branch the logic for JSON-RPC or legacy HTTP API - Checks the XBMC API version to branch the logic to call either the legacy HTTP API or the newer JSON-RPC over HTTP methods. + Checks the KODI API version to branch the logic to call either the legacy HTTP API or the newer JSON-RPC over HTTP methods. Do the ability of accepting a list of hosts deliminated by comma, only one host is updated, the first to respond with success. This is a workaround for SQL backend users as updating multiple clients causes duplicate entries. Future plan is to revist how we store the host/ip/username/pw/options so that it may be more flexible. @@ -539,27 +539,27 @@ class XBMCNotifier: """ - if sickbeard.USE_XBMC and sickbeard.XBMC_UPDATE_LIBRARY: - if not sickbeard.XBMC_HOST: - logger.log(u"No XBMC hosts specified, check your settings", logger.DEBUG) + if sickbeard.USE_KODI and sickbeard.KODI_UPDATE_LIBRARY: + if not sickbeard.KODI_HOST: + logger.log(u"No KODI hosts specified, check your settings", logger.DEBUG) return False # either update each host, or only attempt to update until one successful result result = 0 - for host in [x.strip() for x in sickbeard.XBMC_HOST.split(",")]: + for host in [x.strip() for x in sickbeard.KODI_HOST.split(",")]: if self._send_update_library(host, showName): - if sickbeard.XBMC_UPDATE_ONLYFIRST: + if sickbeard.KODI_UPDATE_ONLYFIRST: logger.log(u"Successfully updated '" + host + "', stopped sending update library commands.", logger.DEBUG) return True else: - if sickbeard.XBMC_ALWAYS_ON: + if sickbeard.KODI_ALWAYS_ON: logger.log( - u"Failed to detect XBMC version for '" + host + "', check configuration and try again.", + u"Failed to detect KODI version for '" + host + "', check configuration and try again.", logger.ERROR) result = result + 1 - # needed for the 'update xbmc' submenu command + # needed for the 'update kodi' submenu command # as it only cares of the final result vs the individual ones if result == 0: return True @@ -567,4 +567,4 @@ class XBMCNotifier: return False -notifier = XBMCNotifier +notifier = KODINotifier diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 9e749782..7208bcb8 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -1009,8 +1009,8 @@ class PostProcessor(object): # send notifications notifiers.notify_download(ep_obj._format_pattern('%SN - %Sx%0E - %EN - %QN')) - # 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() diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 7225fd7c..9135a21e 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1763,7 +1763,7 @@ class ConfigPostProcessing(MainHandler): def savePostProcessing(self, naming_pattern=None, naming_multi_ep=None, - xbmc_data=None, xbmc_12plus_data=None, mediabrowser_data=None, sony_ps3_data=None, + kodi_data=None, kodi_12plus_data=None, mediabrowser_data=None, sony_ps3_data=None, wdtv_data=None, tivo_data=None, mede8er_data=None, keep_processed_dir=None, process_method=None, process_automatically=None, rename_episodes=None, airdate_episodes=None, unpack=None, @@ -1823,16 +1823,16 @@ class ConfigPostProcessing(MainHandler): sickbeard.SKIP_REMOVED_FILES = config.checkbox_to_value(skip_removed_files) sickbeard.NFO_RENAME = config.checkbox_to_value(nfo_rename) - sickbeard.METADATA_XBMC = xbmc_data - sickbeard.METADATA_XBMC_12PLUS = xbmc_12plus_data + sickbeard.METADATA_KODI = kodi_data + sickbeard.METADATA_KODI_12PLUS = kodi_12plus_data sickbeard.METADATA_MEDIABROWSER = mediabrowser_data sickbeard.METADATA_PS3 = sony_ps3_data sickbeard.METADATA_WDTV = wdtv_data sickbeard.METADATA_TIVO = tivo_data sickbeard.METADATA_MEDE8ER = mede8er_data - sickbeard.metadata_provider_dict['XBMC'].set_config(sickbeard.METADATA_XBMC) - sickbeard.metadata_provider_dict['XBMC 12+'].set_config(sickbeard.METADATA_XBMC_12PLUS) + sickbeard.metadata_provider_dict['KODI'].set_config(sickbeard.METADATA_KODI) + sickbeard.metadata_provider_dict['KODI 12+'].set_config(sickbeard.METADATA_KODI_12PLUS) sickbeard.metadata_provider_dict['MediaBrowser'].set_config(sickbeard.METADATA_MEDIABROWSER) sickbeard.metadata_provider_dict['Sony PS3'].set_config(sickbeard.METADATA_PS3) sickbeard.metadata_provider_dict['WDTV'].set_config(sickbeard.METADATA_WDTV) @@ -2398,11 +2398,11 @@ class ConfigNotifications(MainHandler): return _munge(t) - def saveNotifications(self, use_xbmc=None, xbmc_always_on=None, xbmc_notify_onsnatch=None, - xbmc_notify_ondownload=None, - 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, + def saveNotifications(self, 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, @@ -2445,17 +2445,17 @@ class ConfigNotifications(MainHandler): results = [] - sickbeard.USE_XBMC = config.checkbox_to_value(use_xbmc) - sickbeard.XBMC_ALWAYS_ON = config.checkbox_to_value(xbmc_always_on) - sickbeard.XBMC_NOTIFY_ONSNATCH = config.checkbox_to_value(xbmc_notify_onsnatch) - sickbeard.XBMC_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(xbmc_notify_ondownload) - sickbeard.XBMC_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(xbmc_notify_onsubtitledownload) - sickbeard.XBMC_UPDATE_LIBRARY = config.checkbox_to_value(xbmc_update_library) - sickbeard.XBMC_UPDATE_FULL = config.checkbox_to_value(xbmc_update_full) - sickbeard.XBMC_UPDATE_ONLYFIRST = config.checkbox_to_value(xbmc_update_onlyfirst) - sickbeard.XBMC_HOST = config.clean_hosts(xbmc_host) - sickbeard.XBMC_USERNAME = xbmc_username - 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 + 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) @@ -2710,8 +2710,8 @@ class Config(MainHandler): anime = ConfigAnime -def haveXBMC(): - return sickbeard.USE_XBMC and sickbeard.XBMC_UPDATE_LIBRARY +def haveKODI(): + return sickbeard.USE_KODI and sickbeard.KODI_UPDATE_LIBRARY def havePLEX(): @@ -2731,7 +2731,7 @@ def HomeMenu(): return [ {'title': 'Add Shows', 'path': 'home/addShows/', }, {'title': 'Manual Post-Processing', 'path': 'home/postprocess/'}, - {'title': 'Update XBMC', 'path': 'home/updateXBMC/', 'requires': haveXBMC}, + {'title': 'Update KODI', 'path': 'home/updateKODI/', 'requires': haveKODI}, {'title': 'Update Plex', 'path': 'home/updatePLEX/', 'requires': havePLEX}, {'title': 'Manage Torrents', 'path': 'manage/manageTorrents', 'requires': haveTORRENT}, {'title': 'Restart', 'path': 'home/restart/?pid=' + str(sickbeard.PID), 'confirm': True}, @@ -2878,7 +2878,7 @@ class NewHomeAddShows(MainHandler): cur_path), } - # see if the folder is in XBMC already + # see if the folder is in KODI already dirResults = myDB.select("SELECT * FROM tv_shows WHERE location = ?", [cur_path]) if dirResults: @@ -3494,17 +3494,17 @@ class Home(MainHandler): return "Error sending tweet" - def testXBMC(self, host=None, username=None, password=None): + 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) finalResult = '' for curHost in [x.strip() for x in host.split(",")]: - curResult = notifiers.xbmc_notifier.test_notify(urllib.unquote_plus(curHost), username, password) + 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 XBMC notice sent successfully to " + urllib.unquote_plus(curHost) + finalResult += "Test KODI notice sent successfully to " + urllib.unquote_plus(curHost) else: - finalResult += "Test XBMC notice failed to " + urllib.unquote_plus(curHost) + finalResult += "Test KODI notice failed to " + urllib.unquote_plus(curHost) finalResult += "
    \n" return finalResult @@ -3760,9 +3760,9 @@ class Home(MainHandler): t.submenu.append({'title': 'Re-scan files', 'path': 'home/refreshShow?show=%d' % showObj.indexerid}) t.submenu.append( {'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': 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: @@ -4182,19 +4182,19 @@ class Home(MainHandler): redirect("/home/displayShow?show=" + str(showObj.indexerid)) - def updateXBMC(self, showName=None): + def updateKODI(self, showName=None): - # only send update to first host in the list -- workaround for xbmc sql backend users - if sickbeard.XBMC_UPDATE_ONLYFIRST: - # only send update to first host in the list -- workaround for xbmc sql backend users - host = sickbeard.XBMC_HOST.split(",")[0].strip() + # 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.XBMC_HOST + host = sickbeard.KODI_HOST - if notifiers.xbmc_notifier.update_library(showName=showName): - ui.notifications.message("Library update command sent to XBMC host(s): " + 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 XBMC host(s): " + host) + ui.notifications.error("Unable to contact one or more KODI host(s): " + host) redirect('/home/')