From 23b5b93bddc90bec43ca0bceaf7c9e9fd16c9187 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Fri, 28 Jul 2017 02:11:41 -0500 Subject: [PATCH] Add warning for clean on update --- README.md | 1 + resources/language/English/strings.xml | 1 + resources/lib/librarysync.py | 4 ++++ resources/lib/utils.py | 33 ++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/README.md b/README.md index 750ea44f..a45fc3f6 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The Emby addon synchronizes your media on your Emby server to the native Kodi da - To achieve direct play, you will need to ensure your Emby library paths point to network paths (e.g: "\\\\server\Media\Movies"). See the [Emby wiki](https://github.com/MediaBrowser/Wiki/wiki/Path%20Substitution) for additional information. - **The addon is not (and will not be) compatible with the MySQL database replacement in Kodi.** In fact, Emby takes over the point of having a MySQL database because it acts as a "man in the middle" for your entire media library. - Emby for Kodi is not currently compatible with Kodi's Video Extras addon unless native playback mode is used. **Deactivate Video Extras if content start randomly playing.** +- Emby for Kodi adds entries to your Kodi database. To stop them from being removed, make sure is not enabled in your advancedsettings.xml ### What is currently supported? diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index d2b9e0cc..07d33436 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -354,5 +354,6 @@ Backup folder Select content type to repair Failed to retrieve latest updates using fast sync, using full sync. + Important, cleanonupdate was removed in your advanced settings to prevent conflict with Emby for Kodi. Kodi will restart now. \ No newline at end of file diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 6d4fe5b6..57878de7 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -644,6 +644,10 @@ class LibrarySync(threading.Thread): startupComplete = False log.warn("---===### Starting LibrarySync ###===---") + if utils.verify_advancedsettings(): + # Advancedsettings was modified, Kodi needs to restart + log.warn("###===--- LibrarySync Aborted ---===###") + return while not self.monitor.abortRequested(): diff --git a/resources/lib/utils.py b/resources/lib/utils.py index c7601e98..60e47c60 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -347,3 +347,36 @@ def passwordsXML(): icon="special://home/addons/plugin.video.emby/icon.png", time=1000, sound=False) + +def verify_advancedsettings(): + # Track the existance of true + # incompatible with plugin paths + log.info("verifying advanced settings") + if settings('useDirectPaths') != "0": return + + path = xbmc.translatePath("special://userdata/").decode('utf-8') + xmlpath = "%sadvancedsettings.xml" % path + + try: + xmlparse = etree.parse(xmlpath) + except: # Document is blank or missing + return + else: + root = xmlparse.getroot() + + video = root.find('videolibrary') + if video is not None: + cleanonupdate = video.find('cleanonupdate') + if cleanonupdate is not None and cleanonupdate.text == "true": + log.warn("cleanonupdate disabled") + video.remove(cleanonupdate) + + try: + indent(root) + except: pass + etree.ElementTree(root).write(xmlpath) + + xbmcgui.Dialog().ok(heading=language(29999), line1=language(33096)) + xbmc.executebuiltin('RestartApp') + return True + return