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

View file

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

View file

@ -638,6 +638,12 @@ class LibrarySync(Thread):
# Add sources
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
self.saveLastSync()

View file

@ -625,6 +625,85 @@ def indent(elem, level=0):
if level and (not elem.tail or not elem.tail.strip()):
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():
# To make Master lock compatible
path = xbmc.translatePath("special://profile/").decode('utf-8')