<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon  id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.12.20" provider-name="croneter">
  <requires>
    <import addon="xbmc.python" version="2.1.0"/>
    <import addon="script.module.requests" version="2.9.1" />
    <import addon="script.module.defusedxml" version="0.5.0"/>
    <import addon="plugin.video.plexkodiconnect.movies" version="2.1.3" />
    <import addon="plugin.video.plexkodiconnect.tvshows" version="2.1.3" />
  </requires>
  <extension point="xbmc.python.pluginsource" library="default.py">
        <provides>video audio image</provides>
  </extension>
  <extension point="xbmc.service" library="service.py" start="login">
  </extension>
  <extension point="kodi.context.item" library="contextmenu.py">
      <item>
        <label>30401</label>
              <description>30416</description>
              <visible>[!IsEmpty(ListItem.DBID) + !StringCompare(ListItem.DBID,-1) | !IsEmpty(ListItem.Property(plexid))]</visible>
      </item>
  </extension>
  <extension point="xbmc.addon.metadata">
    <summary lang="en">Native Integration of Plex into Kodi</summary>
    <description lang="en">Connect Kodi to your Plex Media Server. This plugin assumes that you manage all your videos with Plex (and none with Kodi). You might lose data already stored in the Kodi video and music databases (as this plugin directly changes them). Use at your own risk!</description>
    <disclaimer lang="en">Use at your own risk</disclaimer>
    <platform>all</platform>
    <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
    <forum>https://forums.plex.tv</forum>
    <website>https://github.com/croneter/PlexKodiConnect</website>
    <email></email>
    <source>https://github.com/croneter/PlexKodiConnect</source>
    <summary lang="nl_NL">Directe integratie van Plex in Kodi</summary>
    <description lang="nl_NL">Verbind Kodi met je Plex Media Server. Deze plugin gaat ervan uit dat je al je video's met Plex (en niet met Kodi) beheerd. Je kunt gegevens reeds opgeslagen in de databases voor video en muziek van Kodi (deze plugin wijzigt deze gegevens direct) verliezen. Gebruik op eigen risico!</description>
    <disclaimer lang="nl_NL">Gebruik op eigen risico</disclaimer>
    <summary lang="fr_CA">Intégration native de Plex dans Kodi</summary>
    <description lang="fr_CA">Connecter Kodi à votre Plex Media Server. Ce plugin assume que vous souhaitez gérer toutes vos vidéos avec Plex (et aucune avec Kodi). Vous pourriez perdre les données déjà stockées dans les bases de données vidéo et musique de Kodi (ce plugin les modifie directement). Utilisez à vos propres risques !</description>
    <disclaimer lang="fr_CA">A utiliser à vos propres risques</disclaimer>
    <summary lang="fr_FR">Intégration native de Plex dans Kodi</summary>
    <description lang="fr_FR">Connecter Kodi à votre Plex Media Server. Ce plugin assume que vous souhaitez gérer toutes vos vidéos avec Plex (et aucune avec Kodi). Vous pourriez perdre les données déjà stockées dans les bases de données vidéo et musique de Kodi (ce plugin les modifie directement). Utilisez à vos propres risques !</description>
    <disclaimer lang="fr_FR">A utiliser à vos propres risques</disclaimer>
    <summary lang="de_DE">Komplette Integration von Plex in Kodi</summary>
    <description lang="de_DE">Verbindet Kodi mit deinem Plex Media Server. Dieses Addon geht davon aus, dass du all deine Videos mit Plex verwaltest (und keine direkt mit Kodi). Du wirst möglicherweise Daten verlieren, die bereits in der Kodi Video- und/oder Musik-Datenbank gespeichert sind (da dieses Addon beide Datenbanken direkt verändert). Benutzung auf eigene Gefahr!</description>
    <disclaimer lang="de_DE">Benutzung auf eigene Gefahr</disclaimer>
    <summary lang="pt_PT">Integração nativa do Plex no Kodi</summary>
    <description lang="pt_PT">Conectar o Kodi ao Servidor Plex Media. Este plugin assume que gerirá todos os vídeos com o Plex (e nenhum com Kodi). Poderá perder dados guardados nas bases de dados de vídeo e musica do Kodi (pois este plugin interfere diretamente com as mesmas). Use por risco de conta própria</description>
    <disclaimer lang="pt_PT">Use por risco de conta própria</disclaimer>
    <summary lang="pt_BR">Integração nativa do Plex no Kodi</summary>
    <description lang="pt_BR">Conectar o Kodi ao Servidor Plex Media. Este plugin assume que gerirá todos os vídeos com o Plex (e nenhum com Kodi). Poderá perder dados guardados nas bases de dados de vídeo e musica do Kodi (pois este plugin interfere diretamente com as mesmas). Use por risco de conta própria</description>
    <disclaimer lang="pt_BR">Use por risco de conta própria</disclaimer>
    <summary lang="es_ES">Integración Nativa de Plex en Kodi</summary>
    <description lang="es_ES">Conecte Kodi a su Plex Media Server.  Este plugin asume que usted gestiona todos sus vídeos con Plex (y ninguno con Kodi). Puede perder datos ya guardados en las bases de datos de vídeo y música de Kodi (ya que este plugin las actualiza directamente). ¡Úselo a su propio riesgo!</description>
    <disclaimer lang="es_ES">Usar a su propio riesgo</disclaimer>
    <summary lang="es_AR">Integración Nativa de Plex en Kodi</summary>
    <description lang="es_AR">Conecte Kodi a su Plex Media Server.  Este plugin asume que usted gestiona todos sus vídeos con Plex (y ninguno con Kodi). Puede perder datos ya guardados en las bases de datos de vídeo y música de Kodi (ya que este plugin las actualiza directamente). ¡Úselo a su propio riesgo!</description>
    <disclaimer lang="es_AR">Usar a su propio riesgo</disclaimer>
    <summary lang="es_MX">Integración Nativa de Plex en Kodi</summary>
    <description lang="es_MX">Conecte Kodi a su Plex Media Server.  Este plugin asume que usted gestiona todos sus vídeos con Plex (y ninguno con Kodi). Puede perder datos ya guardados en las bases de datos de vídeo y música de Kodi (ya que este plugin las actualiza directamente). ¡Úselo a su propio riesgo!</description>
    <disclaimer lang="es_MX">Usar a su propio riesgo</disclaimer>
    <summary lang="cs_CZ">Úplná integrace Plexu do Kodi</summary>
    <description lang="cs_CZ">Připojte Kodi ke svému Plex Media Serveru. Tento doplněk předpokládá, že spravujete veškerá svá videa pomocí Plexu (nikoliv pomocí Kodi). Můžete přijít o data uložená ve video a hudební databázi Kodi (tento doplněk je přímo mění). Používejte na vlastní nebezpečí!</description>
    <disclaimer lang="cs_CZ">Používejte na vlastní nebezpečí</disclaimer>
    <summary lang="da_DK">Indbygget Integration af Plex i Kodi</summary>
    <description lang="da_DK">Tilslut Kodi til din Plex Media Server. Dette plugin forudsætter, at du administrere alle dine videoer med Plex (og ikke med Kodi). Du kan miste data som allerede er gemt i Kodi video og musik-databaser (dette plugin ændrer direkte i dem). Brug på eget ansvar!</description>
    <disclaimer lang="da_DK">Brug på eget ansvar</disclaimer>
    <summary lang="it_IT">Integrazione nativa di Plex su Kodi</summary>
    <description lang="it_IT">Connetti Kodi al tuo Plex Media Server. Questo plugin assume che tu gestisca tutti i video con Plex (e non con Kodi). Potresti perdere i dati dei film e della musica già memorizzati nel database di Kodi (questo plugin modifica direttamente il database stesso). Usa a tuo rischio e pericolo!</description>
    <disclaimer lang="it_IT">Usa a tuo rischio e pericolo</disclaimer>
    <summary lang="no_NO">Naturlig integrasjon av Plex til Kodi</summary>
    <description lang="no_NO">Koble Kodi til din Plex Media Server. Denne plugin forventer at du organiserer alle dine videor med Plex (og ingen med Kodi). Du kan miste all data allerede lagret i Kodi video- og musikkdatabasene (da denne plugin umiddelbart forandrer dem). Bruk på egen risiko!</description>
    <disclaimer lang="no_NO">Bruk på eget ansvar</disclaimer>
    <summary lang="hu_HU">a Plex natív integrációja a Kodi-ba</summary>
    <description lang="hu_HU">Csatlakoztassa a Kodi-t a Plex médiaszerveréhez. Ez a kiegészítő feltételezi, hogy az összes videóját a Plex-szel kezeli (és egyiket sem a Kodi-val). Elveszítheti a már a Kodi videó- és zene-adatbázisában tárolt adatokat (mivel ez a kiegészítő közvetlenül módosítja az adatbázisokat). Csak saját felelősségére használja!</description>
    <disclaimer lang="hu_HU">Csak saját felelősségre használja</disclaimer>
    <summary lang="ru_RU">Нативная интеграция сервера Plex в Kodi</summary>
    <description lang="ru_RU">Подключите Kodi к своему серверу Plex. Плагин предполагает что вы управляете своими видео с помощью Plex (а не в Kodi). Вы можете потерять текущие базы данных музыки и видео в Kodi (так как плагин напрямую их изменяет). Используйте на свой страх и риск</description>
    <disclaimer lang="ru_RU">Используйте на свой страх и риск</disclaimer>
    <summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
    <description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
    <disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer>
    <summary lang="sv_SE">Inbyggd integrering av Plex i Kodi</summary>
    <description lang="sv_SE">Anslut Kodi till din Plex Media Server. Detta tillägg antar att du hanterar alla dina filmer med Plex (och ingen med Kodi). Du kan förlora data redan sparad i Kodis video och musik databaser (eftersom detta tillägg direkt ändrar dem). Använd på egen risk!</description>
    <disclaimer lang="sv_SE">Använd på egen risk</disclaimer>
    <summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary>
    <description lang="lt_LT">Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika!</description>
    <disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer>
    <news>version 2.12.20 (beta only):
- Add information to PKC settings for background sync and Alexa whether a connection has been successfully made

version 2.12.19:
- 2.12.17 and 2.12.18 for everyone
- Rename skip intro skin file

version 2.12.18 (beta only):
- Quickly sync recently watched items before synching the playstates of the entire Plex library
- Improve logging for websocket JSON loads

version 2.12.17 (beta only):
- Sync name and user rating of a TV show season to Kodi
- Fix rare TypeError: expected string or buffer on playback start

version 2.12.16:
- versions 2.12.14 and 2.12.15 for everyone

version 2.12.15 (beta only):
- Fix skip intros sometimes not working due to a RuntimeError
- Update translations

version 2.12.14:
- Add skip intro functionality

version 2.12.13:
- Fix KeyError: u'game' if Plex Arcade has been activated
- Fix AttributeError: 'App' object has no attribute 'threads' when sync is cancelled

version 2.12.12:
- Hopefully fix rare case when sync would get stuck indefinitely
- Fix ValueError: invalid literal for int() for invalid dates sent by Plex
- version 2.12.11 for everyone

version 2.12.11 (beta only):
- Fix PKC not auto-picking audio/subtitle stream when transcoding
- Fix ValueError when deleting a music album
- Fix OSError: Invalid argument when Plex returns an invalid timestamp

version 2.12.10:
- Fix pictures from Plex picture libraries not working/displaying

version 2.12.9:
- Fix Local variable 'user' referenced before assignement

version 2.12.8:
- version 2.12.7 for everyone

version 2.12.7 (beta only):
- Fix PKC suddenly using main Plex user's credentials, e.g. when the PMS address changed
- Fix missing Kodi tags for movie collections/sets

version 2.12.6:
- Fix rare KeyError when using PKC widgets
- Fix suspension of artwork caching and PKC becoming unresponsive
- Update translations
- Versions 2.12.4 and 2.12.5 for everyone

version 2.12.5 (beta only):
- Greatly improve matching logic for The Movie Database if Plex does not provide an appropriate id
- Fix high transcoding resolutions not being available for Win10
- Fix rare playback progress report failing and KeyError: u'containerKey'
- Fix rare KeyError: None when trying to sync playlists
- Fix TypeError when canceling Plex sync section dialog

version 2.12.4 (beta only):
- Hopefully fix freeze during sync: Don't assign multiple sets/collections for a specific movie
- Support metadata provider ids (e.g. for IMDB) for the new Plex Movie Agent

version 2.12.3:
- Fix playback failing due to caching of subtitles with non-ascii chars
- Fix ValueError: invalid literal for int() with base 10 during show sync
- Fix UnboundLocalError when certain Plex sections are deleted or being un-synched
- New method to install PlexKodiConnect directly via an URL. You thus do not need to upload a ZIP file to Kodi anymore.

version 2.12.2:
- version 2.12.0 and 2.12.1 for everyone 
- Fix regression: sync dialog not showing up when it should 

version 2.12.1 (beta only):
- Fix PKC shutdown on Kodi profile switch
- Fix Kodi content type for images/photos
- Added support for custom set of safe characters when escaping paths (thanks @geropan)
- Revert "Don't allow spaces in devicename"
- Fix sync dialog showing in certain cases even though user opted out

version 2.12.0 (beta only):
- Fix websocket threads; enable PKC background sync for all Plex Home users!
- Fix PKC incorrectly marking a video as unwatched if an external player has been used
- Update translations

version 2.11.7:
- Fix PKC crashing on devices running Microsoft UWP, e.g. XBox

version 2.11.6:
- Fix rare sync crash when queue was full
- Set "Auto-adjust transcoding quality" to false by default

version 2.11.5:
- Versions 2.11.0-2.11.4 for everyone

version 2.11.4 (beta only):
- Fix another TypeError: 'NoneType' object has no attribute '__getitem__', e.g. when trying to play trailers

version 2.11.3 (beta only):
- Fix TypeError: 'NoneType' object has no attribute '__getitem__', e.g. when displaying albums

version 2.11.2 (beta only):
- Refactor direct and add-on paths. Enables use of Plex music playlists synched to Kodi

version 2.11.1 (beta only):
- Rewire the set-up of audio and subtitle streams, esp. before starting a transcoding session. Fixes playback not starting at all

version 2.11.0 (beta only):
- Fix PKC not burning in (and thus not showing) subtitles when transcoding
- When transcoding, only let user choose to burn-in subtitles that can't be displayed otherwise by Kodi
- Improve PKC automatically connecting to local PMS
- Ensure that our only video transcoding target is h264 
- Fix adjusted subtitle size not working when burning in subtitles
- Fix regression: burn-in subtitles picking up the last user setting instead of the current one

version 2.10.12:
- versions 2.10.5-11 for everyone

version 2.10.11 (beta only):
- Fix yet another rare but annoying bug where PKC becomes unresponsive during sync 

version 2.10.10 (beta only):
- Fix rare but annoying bug where PKC becomes unresponsive during sync
- Fix PKC background sync not working in some cases

version 2.10.9 (beta only):
- Other Kodi add-ons can now search for Plex items using plugin://plugin.video.plexkodiconnect?mode=search&amp;query=YOUR SEARCH STRING HERE 

version 2.10.8 (beta only):
- Improve thread pool management to render PKC snappier
- Attempt to fix broken pipe error
- Fix DirectPaths when a video's folder name is identical to a video's filename (you will need to manually reset the Kodi database) 

version 2.10.7 (beta only):
- Fix PKC not starting up on iOS
- Optimize the new sync process and fix some bugs that were introduced
- Fix PKC becoming unresponsive e.g. when switching the PMS

version 2.10.6 (beta only):
- Fix AttributeError if user enters an invalid pin code
- Fix OperationalError when starting with a fresh PKC installation
- Fix IndexError

version 2.10.5 (beta only):
- Rewire library sync to speed it up and fix sync getting stuck in rare cases 
- Optimize threads by using events instead of a polling mechanism. Fixes PKC becoming unresponsive, e.g. when switching users
- Optimize adding values to Kodi databases by not using sqlite COALESCE command
- Fix OperationalError when resetting PKC
- Improve sync resiliance when certain items are not to be synced to Kodi or PKC skipped an item in the past
- Make sure bool is returned instead of an int 
- Don't use WAL mode for sqlite connections, it is not making any difference

version 2.10.4:
- version 2.10.3 for everyone
- Fix to correctly wipe Kodi databases

version 2.10.3 (beta only):
- Fix a couple of issues with music when using direct paths: correctly escape music paths for Kodi regex matching
- Fix Recently Added Albums sort order (you will have to reset the Kodi database manually)
- Fix database being locked in rare cases
- Increase batch size for library sync from 500 to 2000 to increase sync speed
- Optimize some code
- Fix KeyError when using Plex search capabilities
- Check faster for available Plex Media Server to connect to

version 2.10.2:
- Fix Kodi playback jumping to the beginning of a video that just started
- Fix transcoding quality degenerating quickly while playing with a new setting to deactivate auto quality for transcoding (applicable e.g. for Chromecast) 
- Update translations

version 2.10.1:
- Fix resume for Kodi on low powered devices, e.g. Raspberry Pi
- Fix resume when using an external player
- Fix UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal 

version 2.10.0:
- version 2.9.12 - 2.9.14 for everyone
- Get rid of some obsolete code for the ContextMonitor we dropped

version 2.9.14 (beta only):
- Fix resume when starting playback via PMS or when force transcoding
- Get rid of ContextMonitor and the dedicated Python thread - with new resume mechanics, this is not needed anymore
- Optimize clean-up of file table in the Kodi video database after stopping playback
- Get rid of some obsolete imports

version 2.9.13 (beta only):
- Fix PKC resuming instead of playing from the beginning

version 2.9.12 (beta only):
- Fix resume not working in some cases
- Support Plex search across all media and Plex Media Servers: Navigate to the PlexKodiConnect Add-on, then "Search"
- Always use the current Kodi language when communicating with the PMS (restart Kodi when changing the language!)
- Fix Kodi crashing when casting from e.g. Plex Web or Plex for Windows
- Fix PKC throwing error if m3u playlist contains resume information

version 2.9.11:
- version 2.9.10 for everyone

version 2.9.10 (beta only):
- Add tmdb provider sync
- Fix external subtitles not being available
- Fix PKC increasing the Plex watch count by 2 instead of 1
- Improve subtitle naming
- Delete temporary subtitles on playback stop
- Fix a missleading string

version 2.9.9:
- Versions 2.9.6 - 2.9.8 for everyone

version 2.9.8 (beta only):
- Fix Play Error in scenarios (older PMS version?) where posting playqueues using an uri `server://` is not possible and `library://` is necessary
- Fix rare AttributeError on PKC startup when modifying advancedsettings.xml
- Update translations

version 2.9.7 (beta only):
- Correctly escape URLs for Direct Paths
- Update settings to inform user that reboot is necessary
- Optimize code
- Don't migrate PKC settings if we're dealing with a clean new PKC installation
- Force-scan every single item in the library - seems like we could lose some recently added items otherwise when updating PKC

version 2.9.6 (beta only):
- Rework logic for using direct paths, direct play, direct streaming and transcoding, using the PMS StreamingBrain: Let PMS StreamingBrain decide on whether we need to force-transcode, New setting to choose "Direct Streaming", Allow for 4k transcoding and direct streaming, New setting to force transcode only 4K and above
- Fix PKC background sync synching items to Kodi even though entire section should not be synched
- Force a full sync of all items after choosing a new PMS, changing a PMS' address and changing which Plex libraries to sync
- Only enforce advancedsettings.xml 'cleanonupdate' to be false for PKC add-on paths
- Never give up trying to connect to the PMS or Alexa using websockets
- Fix resume when force-transcoding

version 2.9.5:
- Version 2.9.4 for everyone

version 2.9.4 (beta only):
- Fix extras not playing when path substitution is enabled
- Fix Plex Companion device restarting playback when reconnecting to PKC
- Fix playback report not working after having played a non-Plex video file
- Change how items are added to Plex playqueues by using PMS machine identifier
- Optimize code for playqueue items
- Fix rare AttributeError when shutting down Kodi

version 2.9.3:
- version 2.9.2 for everyone

version 2.9.2 (beta only):
- Fix Plex Companion casting from iOS and Android
- Faster sync of playlists
- Sync playlists immediately after synching new/changed items and show an info dialog
- Fix potential playlist sync issues if there is a dot in the playlist name
- Correctly detect whether we already synched a Kodi playlist
- Remove obsolete check if path is indeed in unicode
- Add unicode representation to Playlist() class
- Separate function to wipe all synched Plex playlists
- Less logging when comparing PKC versions

version 2.9.1:
- Fix On Deck and Recently Added Episodes for shows not appending showname and season and episode number

version 2.9.0:
WARNING: You might have to manually select your PKC widgets again
- versions 2.8.8 - 2.8.11 for everyone
- Fix AttributeError: 'NoneType' object has no attribute 'attrib' on playback startup
- Add new Lithuanian translations (thanks @egidusm)

version 2.8.11 (beta only):
- Support for the Up Next Kodi add-on
- Fix casting to PlexKodiConnect always starting the first episode
- Rename video nodes for ondeck

version 2.8.10 (beta only):
- Fix broken PKC update

version 2.8.9 (beta only):
- Fix sections that are not synced not displaying menu but entire library 
- Provide more metadata for unsynced directory-like items like a tv show
- Fix 'Plex.nodes."id".path' not linking directly to entire library

version 2.8.8 (beta only):
WARNING: You might have to manually select your PKC widgets again
- Ensure correct Kodi Container.Type is set for PKC widgets
- Fix missing cast artwork if an actor also acted as director or writer for another movie. You will have to manually reset the Kodi DB.

version 2.8.7:
- Fix PKC potentially marking a video as watched on startup; don't sync time by toggling a video watch status but use PMS epoch time

version 2.8.6:
- Fix PKC creating thousands of playlists if a single Kodi playlist wasn't unique
- Fix FutureWarning

version 2.8.5:
- Fix Trakt add-on not recognizing id of tv shows (you will need to manually reset the Kodi database in the PKC settings under Advanced)
- Update translations

version 2.8.4:
- Fix for Kodi 17 Krypton TypeError on playback start: 'offscreen' is an invalid keyword argument for this function
- Fix widgets not being populated after very first PlexKodiConnect library sync without a restart of Kodi
- Don't restart Kodi if user chose to enter PKC settings on install 

version 2.8.3:
- Versions 2.8.1-2.8.2 for everyone

version 2.8.2 (beta only):
- Add an additional, faster On Deck node for movies (for tv shows, this is impossible, unfortunately)
- Introduce limits to the number of videos shown in PKC widgets to speed them up
- Fix TypeError for Direct Paths: init() got an unexpected keyword argument ‘item’
- Fix In Progress widgets being broken and tv shows showing up as completely watched
- Update translations

version 2.8.1 (beta only):
- Fix playback startup and RuntimeError: Unknown exception thrown from the call "XBMCAddon::xbmcplugin::setResolvedUrl"
- Refactor Plex API 
- Fix TV Show clearlogo not displaying during playback
- Fix rare UnicodeDecodeError on library sync 
- Add additional info dialog for PKC synching playlists
- Update translations

version 2.8.0:
- Finally fix Kodi crashing on playback startup for add-on paths!
- All the good stuff from 2.7.15-2.7.18 for everyone

version 2.7.18 (beta only):
- Fix Kodi always playing the same file version of a video if several are present
- Also play trailers if user chose to resume movie from the beginning
- Ask user whether to resume if using Direct Paths and user initiated playback via PMS
- Fix video thrown by Plex Companion not resuming

version 2.7.17 (beta only):
- Another attempt to keep Kodi from crashing on playback startup

version 2.7.16 (beta only):
- Hopefully fix Kodi crashing on playback startup for good

version 2.7.15 (beta only):
- Hopefully fix Kodi crashing on playback startup
- Refresh widgets only on homescreen to prevent cursor from jumping within libraries
- Don't refresh container when user chose to delete or refresh an item from the context menu 

version 2.7.14:
- Correctly clear window variables e.g. on user switch
- Reload skin on resetting PKC video nodes
- Fix last-played node value to ensure a playcount greater than zero
- 2.7.11-2.7.13 for everyone

version 2.7.13 (beta only):
- Fix transcoding not working
- Fix 4k H265 not being transcoded
- Fix some appearance tweak settings
- Fix music and picture nodes pointing to video library
- Fix unequality when comparing sections
- Fix Plex Companion logging error messages

version 2.7.12 (beta only):
- Fix UnicodeEncodeError on playback startup for direct paths
- Attempt to fix rare Kodi crash on PKC exit

version 2.7.11 (beta only):
- Fixes to unicode
- Cleanup code, remove some obsolet methods and functions
- Fix FutureWarning

version 2.7.10:
- Fix duplicate music entries for direct paths (you will need to manually reset the Kodi database)
- Fix UnicodeEncodeError for Direct Paths and some PKC video nodes
- Fix playback sometimes not being reported for direct paths
- Update translations

version 2.7.9:
- Wait for PKC to authorize before loading widgets
- Fix UnicodeDecodeError for libraries with non-ASCII paths
- Fix TypeError on Kodi start
- Fix Kodi Masterlock for nfs paths (requires restart) 

version 2.7.8:
- Fix widgets not working in some cases like NVidia Shield
- Fix appending of show title, season and episode number
- Fix node paths for skins

version 2.7.7:
- Fix sync not working due to non-ASCII Plex library names
- Fix PKC synching playstate to wrong user on profile switch. Be aware that Kodi profile switches are error-prone
- Fix playback sometimes not being reported for direct paths
- Fix float() argument must be a string or a number
- Fix nodes for skin use
- Fix 'NoneType' object has no attribute 'kodi_path'

version 2.7.6:
- Make 2.7.5 available for everyone

version 2.7.5:
- Giant overhaul of widgets
- Fix some KeyErrors when playing songs
- Fix rare cases where playlists were being created

version 2.7.4:
- Fix PKC not synching new items if an older Kodi db is present

version 2.7.3:
- Fix PKC trying to initialize playqueues over and over again
- Fix PKC not starting due to a higher version Kodi database

version 2.7.2:
- Fix Kodi profile switch not working correctly and PKC not exiting cleanly

version 2.7.1:
- Fix playback not starting at all 
- Fix rare TypeError: unsupported operand type(s) for /: 'NoneType' and 'int' on playback startup
- Improve plex db lookups by creating better db indicees 
- Fix background sync crashing in rare cases
- Update translations
- Add Ko-fi donate button 

version 2.7.0:
- WARNING: You will need to reset the Kodi database if you're using the stable version of PKC!
- Version 2.6.6-9 for everyone
- Choose which Plex libraries get synched to Kodi

version 2.6.9 (beta only):
- Fix PKC crashing on resetting the database

version 2.6.8 (beta only):
- Choose which Plex libraries get synched to Kodi
- Fix PKC becoming unresponsive
- Fix rare case where thousands of identical playlists could be generated
- Fix movies or shows disappearing in fringe cases
- Fix processing of collections in special cases
- Implement Codacy suggestions

version 2.6.7 (beta only):
- Fix "Unauthorized for PMS" e.g. on switching Plex users
- Improve error messages when playback failes

version 2.6.6 (beta only):
- WARNING: You will need to reset the Kodi database!
- Greatly speed up sync for episodes, especially for large libraries
- Allow websocket redirects. Never allow insecure HTTPs connections for Kodi Leia
- Optimize headers for communication with PMS to appear like a Plex Media Player
- Fix PMS log entries 'Unable to find client profile for device'
- Improve sync dialog

version 2.6.5:
- Fix extras not playing
- Hide "Verify SSL certificate" setting for Kodi 18 Krypton
- Improve logging
- Update translations

version 2.6.4:
- Fix music items getting deleted on startup
- Never ignore SSL certificate errors for Kodi >= 18 - just like Kodi 
- Fix playback not starting at the beginning
- Improve dialog to manually enter PMS IP and port
- Show logged in Plex home user in the settings and allow changing it
- Update German strings
- Implement Codacy suggestions 

version 2.6.3:
- Fix PKC crashing on Xbox

version 2.6.2:
- Fix playlist sync: sequence item 0: expected string or unicode
- Fix PKC not deleting all the items it should
- Fix keyError 'sessionKey' for weird PMS messages 
- Fix artwork caching AttributeError: 'ImageCachingThread' object has no attribute 'cancel'
- Improve pop-up "Searching for PMS"
- Fix FutureWarning

version 2.6.1:
- WARNING: You will need to reset the Kodi database!
- Fix TV sections not being deleted e.g. after user switch
- Don't show a library sync error pop-up when full sync is interrupted
- Fix to correctly escape paths 
- Update translations

version 2.6.0:
- Support for Kodi 18 Leia
- Big overhaul of the synching process, it's now much faster
- PKC now supports really big Plex and Kodi libraries
- Too many other improvements to recount. See the changelog for the 2.5.x versions
Furthermore:
- Don't lock Plex DB when processing websocket messages
- Fix KeyError: u'kodi_fileid' for some Plex websocket messages
- Update translations

version 2.5.23 (beta only):
- Hopefully fix slow playback startup just after Kodi startup
- Better, safer way to enter network credentials for Direct Paths
- Fix check whether a direct path is accessible 
- Fix OperationalError: no such table on database reset 
- Fix widgets not displaying correct playstate after PKC startup 
- Fix 'NoneType' object has no attribute 'execute' when Plex artwork is not synced and an item is deleted 
- Update translations
- Log whether Plex artwork is synced to Kodi 

version 2.5.22 (beta only):
- Fix rare EOFError and PKC starting wrong video as a consequence

version 2.5.21 (beta only):
- Fix KodiVideoDB object has no attribute kodiconn
- Fix local variable 'set_api' referenced before assignment

version 2.5.20 (beta only):
- Begin a new transaction when database was locked
- Fix browsing to show from info dialog
- Fix rare KeyError if user is playing something somewhere else

version 2.5.19 (beta only):
- Fix crash on startup-sync due to missing albums
- Fix browsing to show from info dialog

version 2.5.18 (beta only):
- Fix playback start: Don't lock databases when starting playback
- Refresh Kodi view only once on full syncs
- Ignore playstate updates for full sync time stamps croneter committed
- Try even longer to write to Kodi database
- Fix some items rarely not being synced

version 2.5.17 (beta only):
- Fix playback not starting for really large libraries

version 2.5.16 (beta only):
- Fix KeyError due to malformed PMS messages
- Fix to database parameter must be string

version 2.5.15 (beta only):
- Make PKC potentially compatible with several database schemas
- Support for Kodi 18 Leia RC 5.2
- Increase number of attempts to write to Kodi DB
- Further increase database sync resiliance

version 2.5.14 (beta only):
Fix rare OperationalError: Locked Database

version 2.5.13 (beta only):
- Fix playback not starting up
- Fix Plex channels and watch later not working
- Hopefully fix playstate not being synced to PMS

version 2.5.12 (beta only):
- WARNING: You will need to reset the Kodi database!
- New option to not use Plex artwork
- Add-on paths: Fix resume if playback not initiated with PKC
- Increase database resiliance with sqlite WAL mode

version 2.5.11 (beta only):
- Direct Paths: Fix AttributeError for widgets

version 2.5.10 (beta only):
- Enable Plex Hub listings to be used for widgets
- Finally fix deleteting of items from PMS not working
- Catch sqlite OperationalError for websocket messages
- Revert "Increase database timeouts"

version 2.5.9 (beta only):
- Compatibility with Kodi 18 RC 4
- New setting to escape paths e.g. for HTTP direct paths
- Ensure path replacement never contains trailing (back)slash
- Leia: fix resetting of videoplayer autoplay next item 
- Don't store identical show artwork for seasons
- Close DB connections while caching images
- Increase database timeouts
- Improve logging for seasons

version 2.5.8 (beta only):
- Hopefully fix Kodi crashing on playback start
- Fix video resuming from old resume point
- Fix database is locked
- Faster way to initialize playlists on the Plex side
- Fix PKC recreating playlists too often
- Shutdown playlist sync if necessary

version 2.5.7 (beta only):
- WARNING: You will need to reset the Kodi database!
- Increase timeout for database connections
- Fix music DB not being wiped on database reset
- Improve Plex playQueue resiliance

version 2.5.6 (beta only):
- Fix many items not getting synced
- Fix episodes not being synced to due a missing season
- Fix some very few items not being synced
- Fix ValueError during sync due to missing Plex timestamp
- Fix resume for episodes for add-on paths
- Fix movies not showing up on switching PMS
- Finish full syncs during playbacks, don't start new ones
- Fix AttributeError when a playlist disappeared
- Close sync dialog if video playback starts
- Don't show sync messages while Kodi is playing something
- Only marking full sync as successful if that is indeed the case
- Optimize code

version 2.5.5 (beta only):
- Fix OperationalError and PKC not starting up

version 2.5.4 (beta only):
- Fix a couple of issues related to episodes
- Fix permanent missing library items if PMS failed to send a single response
- Fix OperationalError: enforce Kodi restart with clean DB once
- Fix switching PMS not recognizing when old PMS is selected
- Fix PKC not automatically connecting to changed PMS IP on startup
- Remove message "Full library sync finished"
- Fix PKC not automatically connecting to changed PMS IP on startup
- Remove cProfile program metrics measurements

version 2.5.3 (beta only):
- Fix Plex sections not showing up or disappearing

version 2.5.2 (beta only):
- Rewire library sync
- Optimize sqlite transactions
- Replace annoying sync message with PKC settings info
- Add PKC settings status indication for caching
- Fix KeyError when synching playlists
- Fix ImportError for Plex Companion gdm issues
- Increase database connection cache size
- Force-Reboot Kodi immediately if sqlite PRAGMA WAL causes errors
- Force a full sync on switching Plex username
- Fix wierd behavior upon switching to another PMS
- More bugfixes and code optimizations

version 2.5.1 (beta only):
- Fix OSError on resetting the database

version 2.5.0 (beta only):
- Huge rewrite of the sync mechanism - it should now be faster and more stable
- Sync huge Plex libraries now: the sync will load all data bit by bit
- Rewrote code for the main program loop, reducing the need for separate Python threads
- Rewrote and sped up code to access and change Kodi and Plex databases
- Fixes to Kodi 18 Leia music library
- Tons of other small fixes I can't remember

version 2.4.10 (beta only):
- Use xml.etree.cElementTree whenever possible to avoid memory leaks

version 2.4.9:
- Fix Kodi crashing due to PKC memory leak 

version 2.4.8:
- Make 2.4.4-2.4.7 available for everyone

version 2.4.7 (beta only):
- Try to fix PKC for Enigma 2
- Fix Kodi 18 wanting to scan tags for songs all the time (you will need to reset the database in the PKC settings)
- Optimize resetting of Kodi and Plex databases

version 2.4.6 (beta only):
- Fix PKC not starting up on Enigma
- Fix sync issues if video lies in root of file system
- Make sure we retain a dummy first music artist entry
- Increase logging

version 2.4.5 (beta only):
- Fix playback not starting up at all
- Rewire Kodi library refreshs
- Wipe Kodi database on first PKC run to more reliably install PKC

version 2.4.4 (beta only):
- Fix rare case when playback would not start-up
- Increase logging

version 2.4.3:
- Fix Kodi addons throwing jsonrpc errors (database reset needed)

version 2.4.2:
- Make version 2.4.1 available for everyone

version 2.4.1 (beta only):
- Hopefully fix endless playlist sync loops
- Ensure shows are deleted before seasons before episodes
- Fix library sync crash on deleting episode with missing season
- Fix numbering of already existing playlist files
- Optimize logging

version 2.4.0:
- Use pretty Plex dialogs for everyone!

version 2.3.14 (beta only):
- Fix AttributeError on forcing texture caching
- Switch to Plex style dialogs
- Include PKC info in plex.tv dialogs
- Include PKC info in user selection dialog

version 2.3.13 (beta only):
- Pretty Plex dialogs for plex.tv sign-in and user selection
- Fix UnicodeDecodeError for PMS with non ASCII chars on local LAN discovery
- Fix add-on settings not opening on installation
- Greatly speed up deleting of items on the Kodi side
- Safely parse XMLs using defusedxml
- Fix PKC trying to sync audio playlists even when audio sync disabled
- Some code cleanup

version 2.3.12:
- Fix Kodi hanging if media stream selection is aborted
- Fix potential sync crash
- Revert "Fix Kodi crash by committing to DB frequently"

version 2.3.11 (beta only):
- Fix Kodi crash by committing to DB frequently

version 2.3.10:
- Compatibility with Kodi 18 Leia Beta 1
- Update translations
- Make version 2.3.9 available for everyone

version 2.3.9 (beta only):
- Fix playback not resuming (Kodi 18 ignores listitem "StartOffset")
- Fix playerid not being retrieved for Kodi 18
- Prefer local trailers; new setting to list extras instead of playing trailer

version 2.3.8:
- Fix typo
- Make version 2.3.4-2.3.7 available for everyone

version 2.3.7 (beta only):
- Fix library sync crash due to exotic playlist characters
- Force-deactivate playlist sync for Microsoft UWP for Kodi 18

version 2.3.6 (beta only):
- Fix PKC not starting by decoupling watchdog/subprocess modules

version 2.3.5 (beta only):
- Fix PKC not starting by importing playlist module only when sync enabled

version 2.3.4 (beta only):
- Fix playback sometimes not starting and UnicodeEncodeError for logging

version 2.3.3:
- Choose trailer if several are present (DB reset required)

version 2.3.2:
- Fix casting to PKC failing

version 2.3.1:
- Fix library sync crashing due to Plex photo albums

version 2.3.0:
Major stable version bump. Highlights:
- Sync Plex playlists to Kodi and Kodi playlists to Plex!
- Support for Plex collection/set artwork
- Many bug fixes, especially Plex Companion
- Tons of code improvements in the hope that someone else will help with developing PKC
Warning: the 2 helper add-ons for movies and tv shows also received an upgrade from 2.0.4 to 2.0.5. If you want to downgrade PKC, be sure to downgrade these add-ons as well!

version 2.2.18 (beta only):
- Fix PKC tv show node "all"
- Move PKC playlist shortcut

version 2.2.17 (beta only):
- Access Plex Hubs. Listing will be different depending on Kodi section!
- Fix year for songs missing
- Fix Plex extras not playing
- Fix rare library sync crash

version 2.2.16 (beta only):
- Enable Kodi libraries for Plex Music libraries
- New Playlists menu item for video libraries
- Only show Plex libraries in the applicable Kodi media category
- Optimize code

version 2.2.15 (beta only):
- Fix ImportError on first PKC run

version 2.2.14 (beta only):
- Hopefully fix playlist sync loops

version 2.2.13 (beta only):
- Fix library sync crash
- Fix switching to __future__ module
- Fix "Prefer Kodi Artwork" toggle doing the exact opposite
- Fix "Prefer Kodi artwork" setting not being visible

version 2.2.12 (beta only):
- Fix slow sync. Fix endless sync of corrupted PMS elements
- Refactor playlist code
- Fix FutureWarning

version 2.2.11 (beta only):
- Fix OnDeck widget for Direct Paths
- Fix Plex Companion crashing when connected to Plex Web
- Fix Plex Companion crash when connected to Plex Web playing playlist music
- Improve Plex playback report when playing music playlist
- Improve reliability in Kodi song playback
- Catch some errors if user mixes audio and video in Kodi playqueue 

version 2.2.10 (beta only):
- Fix playlists getting recreated and deleted in an endless loop
- Add some safety nets for playlist sync
- Fix FutureWarning
- Fix playlist sync settings not disappearing
- Optimize code

version 2.2.9 (beta only):
- Hopefully fix Kodi and Plex playlists getting out of sync
- Fix and optimize startup of playlist sync
- Hide certain playlist settings under certain conditions
- Fix errors in Kodi log

version 2.2.8 (beta only):
- Support for Plex collection artwork (PKC settings toggle under Artwork)
- Fix hard PKC reset not working (OSError: no such file)
- Deduplication
- Catch exception
- Update translations
- Extend Kodi metadata
- Update readme

version 2.2.7 (beta only):
- Allow to only sync specific Plex or Kodi playlists
- Don't show artwork sync progress, reduce setting-writes
- Fix playback sometimes not starting up
- Use __future__ for contextmenu.py
- Fix imports

version 2.2.6 (beta only):
- Fix default settings string, only show in English, hopefully fixes PKC loosing its settings

version 2.2.5 (beta only):
- Fix AttributeError and add_update has crashed

version 2.2.4 (beta only):
- Fix LibrarySync crashing due to Plex Companion messages

version 2.2.3 (beta only):
- Compatibility with Kodi Krypton Alpha 2
- Append tv show and SxxExx to episode playlist entries

version 2.2.2 (beta only):
- Fixes to locking mechanisms which resulted in weird behavior in some cases
- Switch to Python __future__ unicode_literals and absolute paths
- Fix UnboundLocalError for playlists
- Check all Kodi database versions before starting PKC
- Fix KeyError on non-PKC playback startup
- Speed up subtitle download to Kodi
- Update translations
- PEP-8 stuff

version 2.2.1 (beta only):
- Fix library sync crash due to PMS sending string, not unicode
- Fix playback from playlists for add-on paths
- Detect playback from a Kodi playlist for add-on paths - because we need some hacks due to Kodi bugs
- Fix add-on paths playstate and Plex Companion for playlists
- Fix Kodi telling Plex companion false playqueue position
- Don't try to get a Kodi library items for Plex clips
- Update translations

version 2.2.0 (beta only):
- Support for syncing Plex playlists to Kodi and vice-versa! (Kodi mixed music and video playlists cannot be supported as Plex does not support them)

version 2.1.6:
- Fix slow sync. Fix endless sync of corrupted PMS elements

version 2.1.5:
- Fix OnDeck widget for Direct Paths

version 2.1.4:
- Fix PKC settings suddenly getting lost
- Don't show artwork sync progress, reduce setting-writes

version 2.1.3:
- Fix default settings string, only show in English, hopefully fixes PKC loosing its settings

version 2.1.2:
- Compatibility with Kodi Krypton Alpha 2
- Check all Kodi database versions before starting PKC
- Fix KeyError on non-PKC playback startup
- PEP-8 stuff

version 2.1.1:
- Fix Library Sync crash on Android

version 2.1.0:
Finally a new update for the stable version. You will need to reconnect to your PMS and reset the Kodi database once. Highlights of v2 include:
- Support for Plex extras
- Huge improvements to Plex Companion
- Fixes to Alexa voice control
- Kodi 18 Leia Alpha 1 support
- Improvements to playback start-up
- Improvements to the syncing mechanism, which should get rid of a ton of small bugs
- Fixes to widgets and resuming playback
- Use of plex.direct paths instead of local IP addresses to ensure the SSL certificates shown by the PMS are deemed valid
- Fix Kodi screensaver
- Faster PKC startup
- And tons of other stuff...</news>
  </extension>
</addon>
