Deactivate info "Gathering information from files"

However, Kodi STILL tries to gather info from music files unsuccessfully
(PMS http folder cannot be accessed)
This commit is contained in:
tomkat83 2016-03-22 13:25:30 +01:00
parent 7fcaa79b78
commit cffe8acb69
4 changed files with 112 additions and 15 deletions

View file

@ -2055,17 +2055,18 @@ class Music(Items):
if doIndirect: if doIndirect:
# Plex works a bit differently # Plex works a bit differently
path = "%s%s" % (self.server, item[0][0].attrib.get('key')) path = "%s%s" % (self.server, item[0][0].attrib.get('key'))
filename = API.addPlexCredentialsToUrl(path) path = API.addPlexCredentialsToUrl(path)
# Keep path empty to not let Kodi scan it filename = path.rsplit('/', 1)[1]
path = "" path = path.replace(filename, '')
# UPDATE THE SONG ##### # UPDATE THE SONG #####
if update_item: if update_item:
self.logMsg("UPDATE song itemid: %s - Title: %s with path: %s" self.logMsg("UPDATE song itemid: %s - Title: %s with path: %s"
% (itemid, title, path), 1) % (itemid, title, path), 1)
# Update path # Update path
query = "UPDATE path SET strPath = ? WHERE idPath = ?" # Use dummy strHash '123' for Kodi
kodicursor.execute(query, (path, pathid)) query = "UPDATE path SET strPath = ?, strHash = ? WHERE idPath = ?"
kodicursor.execute(query, (path, '123', pathid))
# Update the song entry # Update the song entry
query = ' '.join(( query = ' '.join((
@ -2087,7 +2088,7 @@ class Music(Items):
self.logMsg("ADD song itemid: %s - Title: %s" % (itemid, title), 1) self.logMsg("ADD song itemid: %s - Title: %s" % (itemid, title), 1)
# Add path # Add path
pathid = kodi_db.addPath(path) pathid = kodi_db.addPath(path, strHash="123")
try: try:
# Get the album # Get the album

View file

@ -47,7 +47,7 @@ class Kodidb_Functions():
self.clientInfo = clientinfo.ClientInfo() self.clientInfo = clientinfo.ClientInfo()
self.artwork = artwork.Artwork() self.artwork = artwork.Artwork()
def addPath(self, path): def addPath(self, path, strHash=None):
# SQL won't return existing paths otherwise # SQL won't return existing paths otherwise
if path is None: if path is None:
path = "" path = ""
@ -64,6 +64,7 @@ class Kodidb_Functions():
except TypeError: except TypeError:
cursor.execute("select coalesce(max(idPath),0) from path") cursor.execute("select coalesce(max(idPath),0) from path")
pathid = cursor.fetchone()[0] + 1 pathid = cursor.fetchone()[0] + 1
if strHash is None:
query = ( query = (
''' '''
INSERT INTO path( INSERT INTO path(
@ -73,6 +74,16 @@ class Kodidb_Functions():
''' '''
) )
cursor.execute(query, (pathid, path)) cursor.execute(query, (pathid, path))
else:
query = (
'''
INSERT INTO path(
idPath, strPath, strHash)
VALUES (?, ?, ?)
'''
)
cursor.execute(query, (pathid, path, strHash))
return pathid return pathid

View file

@ -638,6 +638,12 @@ class LibrarySync(Thread):
# Add sources # Add sources
utils.sourcesXML() utils.sourcesXML()
# Deactivate Kodi popup showing that it's (unsuccessfully) trying to
# scan music folders
if self.enableMusic:
utils.musiclibXML()
utils.advancedSettingsXML()
# Set new timestamp NOW because sync might take a while # Set new timestamp NOW because sync might take a while
self.saveLastSync() self.saveLastSync()

View file

@ -625,6 +625,85 @@ def indent(elem, level=0):
if level and (not elem.tail or not elem.tail.strip()): if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i elem.tail = i
def musiclibXML():
"""
Deactivates Kodi trying to scan music library on startup
Changes guisettings.xml in Kodi userdata folder:
updateonstartup: set to "false"
"""
path = xbmc.translatePath("special://profile/").decode('utf-8')
xmlpath = "%sguisettings.xml" % path
try:
xmlparse = etree.parse(xmlpath)
except:
# Document is blank or missing
root = etree.Element('settings')
else:
root = xmlparse.getroot()
music = root.find('musiclibrary')
if music is None:
music = etree.SubElement(root, 'musiclibrary')
startup = music.find('updateonstartup')
if startup is None:
# Setting does not exist yet; create it
startup = etree.SubElement(music,
'updateonstartup',
attrib={'default': "true"}).text = "false"
else:
startup.text = "false"
# Prettify and write to file
try:
indent(root)
except:
pass
etree.ElementTree(root).write(xmlpath)
def advancedSettingsXML():
"""
Deactivates Kodi popup for scanning of music library
Changes advancedsettings.xml, musiclibrary:
backgroundupdate set to "true"
"""
path = xbmc.translatePath("special://profile/").decode('utf-8')
xmlpath = "%sadvancedsettings.xml" % path
try:
xmlparse = etree.parse(xmlpath)
except:
# Document is blank or missing
root = etree.Element('advancedsettings')
else:
root = xmlparse.getroot()
music = root.find('musiclibrary')
if music is None:
music = etree.SubElement(root, 'musiclibrary')
backgroundupdate = music.find('backgroundupdate')
if backgroundupdate is None:
# Setting does not exist yet; create it
backgroundupdate = etree.SubElement(
music,
'backgroundupdate').text = "true"
else:
backgroundupdate.text = "true"
# Prettify and write to file
try:
indent(root)
except:
pass
etree.ElementTree(root).write(xmlpath)
def sourcesXML(): def sourcesXML():
# To make Master lock compatible # To make Master lock compatible
path = xbmc.translatePath("special://profile/").decode('utf-8') path = xbmc.translatePath("special://profile/").decode('utf-8')