'Retrieves the NMJv2 database location from Popcorn hour
host: The hostname/IP of the Popcorn Hour server
dbloc: \'local\' for PCH internal harddrive. \'network\' for PCH network shares
instance: Allows for selection of different DB in case of multiple databases
Returns: True if the settings were retrieved successfully, False otherwise'

def notify_settings(self, host, dbloc, instance):

    try:
        url_loc = ((((u'http://' + host) + u':8008/file_operation?arg0=list_user_storage_file&arg1=&arg2=') + instance) + u'&arg3=20&arg4=true&arg5=true&arg6=true&arg7=all&arg8=name_asc&arg9=false&arg10=false')
        req = urllib2.Request(url_loc)
        handle1 = urllib2.urlopen(req)
        response1 = handle1.read()
        xml = parseString(response1)
        time.sleep((300.0 / 1000.0))
        for node in xml.getElementsByTagName(u'path'):
            xmlTag = node.toxml()
            xmlData = xmlTag.replace(u'<path>', u'').replace(u'</path>', u'').replace(u'[=]', u'')
            url_db = (((u'http://' + host) + u':8008/metadata_database?arg0=check_database&arg1=') + xmlData)
            reqdb = urllib2.Request(url_db)
            handledb = urllib2.urlopen(reqdb)
            responsedb = handledb.read()
            xmldb = parseString(responsedb)
            returnvalue = xmldb.getElementsByTagName(u'returnValue')[0].toxml().replace(u'<returnValue>', u'').replace(u'</returnValue>', u'')
            if (returnvalue == u'0'):
                DB_path = xmldb.getElementsByTagName(u'database_path')[0].toxml().replace(u'<database_path>', u'').replace(u'</database_path>', u'').replace(u'[=]', u'')
                if ((dbloc == u'local') and (DB_path.find(u'localhost') > (-1))):
                    sickrage.srCore.srConfig.NMJv2_HOST = host
                    sickrage.srCore.srConfig.NMJv2_DATABASE = DB_path
                    return True
                if ((dbloc == u'network') and (DB_path.find(u'://') > (-1))):
                    sickrage.srCore.srConfig.NMJv2_HOST = host
                    sickrage.srCore.srConfig.NMJv2_DATABASE = DB_path
                    return True
    except IOError as e:
        sickrage.srCore.srLogger.warning((u"Warning:    Couldn't    contact    popcorn    hour    on    host    %s:    %s" % (host, e)))
        return False
    return False
