Repository: pymedusa/Medusa

Issue:
General Update Kodi button not working
Medusa Info: | Branch: master                 Commit: 77b20916ab577b82112ebc624f816054788c63f2                 Version: v0.2.2                 Database: 44.9
-- | --
Python Version: | 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
SSL Version: | OpenSSL 1.0.2k  26 Jan 2017
OS: | Windows-10-10.0.14393
Locale: | nl_NL.cp1252

The general `Update Kodi` menu item does not work any more.
Link goes to: `https://xxx.yyy/home/updateKODI/`
![image](https://user-images.githubusercontent.com/4103090/39408794-191728fe-4bdc-11e8-947c-fb8fe22ed239.png)

```
Error
Invalid show ID 
```


Discussion:
I think it also applies to `EMBY`.

Resolving patch:
diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py
--- a/medusa/server/web/home/handler.py
+++ b/medusa/server/web/home/handler.py
@@ -1851,23 +1851,21 @@ def subtitleShow(self, indexername=None, seriesid=None):
         return self.redirect('/home/displayShow?indexername={series_obj.indexer_name}&seriesid={series_obj.series_id}'.format(series_obj=series_obj))
 
     def updateKODI(self, indexername=None, seriesid=None):
-        if seriesid is None:
-            return self._genericMessage('Error', 'Invalid show ID')
+        series_name = series_obj = None
+        if seriesid:
+            indexer = indexer_name_to_id(indexername)
+            series_obj = Show.find_by_id(app.showList, indexer, seriesid)
+            if series_obj is None:
+                return self._genericMessage('Error', 'Unable to find the specified show')
 
-        indexer_id = indexer_name_to_id(indexername)
-        series_obj = Show.find_by_id(app.showList, indexer_id, seriesid)
-
-        if series_obj is None:
-            return self._genericMessage('Error', 'Unable to find the specified show')
-        else:
-            show_name = quote_plus(series_obj.name.encode('utf-8'))
+            series_name = quote_plus(series_obj.name.encode('utf-8'))
 
         if app.KODI_UPDATE_ONLYFIRST:
             host = app.KODI_HOST[0].strip()
         else:
             host = ', '.join(app.KODI_HOST)
 
-        if notifiers.kodi_notifier.update_library(series_name=show_name):
+        if notifiers.kodi_notifier.update_library(series_name=series_name):
             ui.notifications.message('Library update command sent to KODI host(s): {host}'.format(host=host))
         else:
             ui.notifications.error('Unable to contact one or more KODI host(s): {host}'.format(host=host))
@@ -1887,12 +1885,11 @@ def updatePLEX(self):
 
     def updateEMBY(self, indexername=None, seriesid=None):
         series_obj = None
-
-        if seriesid is None:
-            return self._genericMessage('Error', 'Invalid show ID')
-
-        indexer_id = indexer_name_to_id(indexername)
-        series_obj = Show.find_by_id(app.showList, indexer_id, seriesid)
+        if seriesid:
+            indexer = indexer_name_to_id(indexername)
+            series_obj = Show.find_by_id(app.showList, indexer, seriesid)
+            if series_obj is None:
+                return self._genericMessage('Error', 'Unable to find the specified show')
 
         if notifiers.emby_notifier.update_library(series_obj):
             ui.notifications.message(


Test patch: