'Public wrapper for the update library functions to branch the logic for JSON-RPC or legacy HTTP API
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.
Args:
showName: Name of a TV show to specifically target the library update for
Returns:
Returns True or False'

def update_library(self, showName=None):

    if (sickrage.srCore.srConfig.USE_KODI and sickrage.srCore.srConfig.KODI_UPDATE_LIBRARY):
        if (not sickrage.srCore.srConfig.KODI_HOST):
            sickrage.srCore.srLogger.debug(u'No    KODI    hosts    specified,    check    your    settings')
            return False
        result = 0
        for host in [x.strip() for x in sickrage.srCore.srConfig.KODI_HOST.split(u',')]:
            if self._send_update_library(host, showName):
                if sickrage.srCore.srConfig.KODI_UPDATE_ONLYFIRST:
                    sickrage.srCore.srLogger.debug(((u"Successfully    updated    '" + host) + u"',    stopped    sending    update    library    commands."))
                    return True
            else:
                if sickrage.srCore.srConfig.KODI_ALWAYS_ON:
                    sickrage.srCore.srLogger.warning(((u"Failed    to    detect    KODI    version    for    '" + host) + u"',    check    configuration    and    try    again."))
                result += 1
        if (result == 0):
            return True
        else:
            return False
