commit
ad607f61e7
13 changed files with 152 additions and 119 deletions
|
@ -1,5 +1,5 @@
|
|||
[![stable version](https://img.shields.io/badge/stable_version-2.6.0-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip)
|
||||
[![beta version](https://img.shields.io/badge/beta_version-2.6.0-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip)
|
||||
[![stable version](https://img.shields.io/badge/stable_version-2.6.1-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip)
|
||||
[![beta version](https://img.shields.io/badge/beta_version-2.6.1-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip)
|
||||
|
||||
[![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation)
|
||||
[![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)
|
||||
|
|
11
addon.xml
11
addon.xml
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.6.0" provider-name="croneter">
|
||||
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.6.1" provider-name="croneter">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.requests" version="2.9.1" />
|
||||
|
@ -77,7 +77,14 @@
|
|||
<summary lang="uk_UA">Нативна інтеграція Plex в Kodi</summary>
|
||||
<description lang="uk_UA">Підключає Kodi до серверу Plex. Цей плагін передбачає, що ви керуєте всіма своїми відео за допомогою Plex (і ніяк не Kodi). Ви можете втратити дані, які вже зберігаються у відео та музичних БД Kodi (оскільки цей плагін безпосередньо їх змінює). Використовуйте на свій страх і ризик!</description>
|
||||
<disclaimer lang="uk_UA">Використовуйте на свій ризик</disclaimer>
|
||||
<news>version 2.6.0:
|
||||
<news>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
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# XBMC Media Center language file
|
||||
# Translators:
|
||||
# Croneter None <croneter@gmail.com>, 2018
|
||||
# Croneter None <croneter@gmail.com>, 2019
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
@ -8,7 +8,7 @@ msgstr ""
|
|||
"Report-Msgid-Bugs-To: croneter@gmail.com\n"
|
||||
"POT-Creation-Date: 2017-04-15 13:13+0000\n"
|
||||
"PO-Revision-Date: 2017-04-30 08:30+0000\n"
|
||||
"Last-Translator: Croneter None <croneter@gmail.com>, 2018\n"
|
||||
"Last-Translator: Croneter None <croneter@gmail.com>, 2019\n"
|
||||
"Language-Team: Hungarian (Hungary) (https://www.transifex.com/croneter/teams/73837/hu_HU/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
@ -97,7 +97,7 @@ msgstr "Kapcsolat"
|
|||
# Pop-up notification if user tried to manually initiate fanart download
|
||||
msgctxt "#30015"
|
||||
msgid "Fanart download already running"
|
||||
msgstr ""
|
||||
msgstr "Már fut a művészképek letöltése"
|
||||
|
||||
msgctxt "#30016"
|
||||
msgid "Device Name"
|
||||
|
@ -159,7 +159,7 @@ msgstr "Kodi lejátszási lista előtag szinkronizálásra kijelöléshez"
|
|||
# PKC settings artwork options: status info
|
||||
msgctxt "#30028"
|
||||
msgid "PKC-only image caching completed"
|
||||
msgstr ""
|
||||
msgstr "PKC képek gyorsítótárazása befejeződött"
|
||||
|
||||
msgctxt "#30030"
|
||||
msgid "Port Number"
|
||||
|
@ -322,12 +322,15 @@ msgid ""
|
|||
"In the following window, enter the server's hostname (or IP) where your Plex"
|
||||
" media resides. Mind the case!"
|
||||
msgstr ""
|
||||
"A következő ablakban adja meg a szerver kiszolgálónevét (vagy IP címét) "
|
||||
"amelyen a Plex médiatartalmak megtalálhatók. Figyeljen a kis- és "
|
||||
"nagybetűkre!"
|
||||
|
||||
# For setting up direct paths and adding network credentials - input window
|
||||
# for hostname
|
||||
msgctxt "#30201"
|
||||
msgid "Enter server hostname (or IP)"
|
||||
msgstr ""
|
||||
msgstr "Adja meg a szerver kiszolgálónevét (vagy IP címét)"
|
||||
|
||||
# For setting up direct paths and adding network credentials
|
||||
msgctxt "#30202"
|
||||
|
@ -335,22 +338,24 @@ msgid ""
|
|||
"In the following window, enter the network protocol you would like to use. "
|
||||
"This is likely 'smb'."
|
||||
msgstr ""
|
||||
"A következő ablakban adja meg a használni kívánt hálózati protokollt. Ez "
|
||||
"valószínűleg az 'smb'."
|
||||
|
||||
# For setting up direct paths and adding network credentials - input window
|
||||
# protocol
|
||||
msgctxt "#30203"
|
||||
msgid "Enter network protocol"
|
||||
msgstr ""
|
||||
msgstr "Adja meg a hálózati protokollt"
|
||||
|
||||
# For setting up direct paths and adding network credentials
|
||||
msgctxt "#30204"
|
||||
msgid "The hostname or IP '{0}' that you entered is not valid."
|
||||
msgstr ""
|
||||
msgstr "A megadott kiszolgálónév vagy IP cím '{0}' helytelen."
|
||||
|
||||
# For setting up direct paths and adding network credentials
|
||||
msgctxt "#30205"
|
||||
msgid "The protocol '{0}' that you entered is not supported."
|
||||
msgstr ""
|
||||
msgstr "A megadott hálózati protokoll ('{0}') nem támogatott."
|
||||
|
||||
# Video node naming for random e.g. movies
|
||||
msgctxt "#30227"
|
||||
|
@ -469,6 +474,8 @@ msgid ""
|
|||
"Could not change the Kodi settings file {0}. PKC might not work correctly. "
|
||||
"Error: {1}"
|
||||
msgstr ""
|
||||
"A {0} Kodi beállításfájl megváltoztatása sikertelen. Lehet, hogy a PKC nem "
|
||||
"fog megfelelően működni.Hiba: {1}"
|
||||
|
||||
# PKC Settings - Connection
|
||||
msgctxt "#30500"
|
||||
|
@ -483,7 +490,7 @@ msgstr "Kliens SSL tanúsítvány"
|
|||
# PKC Settings - Artwork
|
||||
msgctxt "#30502"
|
||||
msgid "Sync Plex artwork from the PMS (recommended)"
|
||||
msgstr ""
|
||||
msgstr "Plex művészképek szinkronizálása a szerverről (ajánlott)"
|
||||
|
||||
# PKC Settings, category name
|
||||
msgctxt "#30506"
|
||||
|
@ -545,6 +552,8 @@ msgstr "Lejátszás"
|
|||
msgctxt "#30517"
|
||||
msgid "Set network credentials for Direct Paths and direct play"
|
||||
msgstr ""
|
||||
"Hálózati hozzáférési adatok megadása a közvetlen útvonalakhoz és közvetlen "
|
||||
"lejátszáshoz"
|
||||
|
||||
# PKC Settings - Playback
|
||||
msgctxt "#30518"
|
||||
|
@ -575,6 +584,8 @@ msgstr "h265/HEVC transzkódolás kényszerítése"
|
|||
msgctxt "#30523"
|
||||
msgid "Also show sync progress for playstate and user data"
|
||||
msgstr ""
|
||||
"Szinkronizálási folyamat állapotának mutatása a lejátszási- és felhasználói "
|
||||
"adatok esetén is"
|
||||
|
||||
# PKC Settings - Playback
|
||||
msgctxt "#30527"
|
||||
|
@ -689,11 +700,11 @@ msgstr "Hibás felhasználónév vagy jelszó"
|
|||
|
||||
msgctxt "#33010"
|
||||
msgid "User is unauthorized for server {0}"
|
||||
msgstr ""
|
||||
msgstr "A felhasználó nem jogosult a {0} szerverhez való hozzáférésre"
|
||||
|
||||
msgctxt "#33011"
|
||||
msgid "Plex.tv did not provide us a valid list of Plex users, sorry."
|
||||
msgstr ""
|
||||
msgstr "A Plex.tv sajnos nem adta meg a jogosult Plex felhasználók listáját"
|
||||
|
||||
# Dialog before playback
|
||||
msgctxt "#33013"
|
||||
|
@ -838,7 +849,7 @@ msgstr ""
|
|||
# PKC Settings - Artwork
|
||||
msgctxt "#39020"
|
||||
msgid "Cache all images to Kodi texture cache now"
|
||||
msgstr ""
|
||||
msgstr "Minden kép gyorsítótárazása a Kodi gyorsítótárába most"
|
||||
|
||||
# Appended to a listed PMS if it is in the same LAN network as PKC
|
||||
msgctxt "#39022"
|
||||
|
@ -925,6 +936,7 @@ msgstr ""
|
|||
msgctxt "#39036"
|
||||
msgid "Escape special characters in path (e.g. space to %20)"
|
||||
msgstr ""
|
||||
"A speciális karakterek feloldása az elérési útban (pl. szóköz helyett %20)"
|
||||
|
||||
# PKC Settings - Customize Paths
|
||||
msgctxt "#39037"
|
||||
|
@ -1002,7 +1014,7 @@ msgstr "Semmi sem működik? Próbálja meg a teljes visszaállítást!"
|
|||
# PKC Settings - Connection
|
||||
msgctxt "#39050"
|
||||
msgid "Choose Plex Server from a list"
|
||||
msgstr ""
|
||||
msgstr "Válasszon Plex szervert a listából"
|
||||
|
||||
# PKC Settings - Sync
|
||||
msgctxt "#39051"
|
||||
|
@ -1100,7 +1112,7 @@ msgstr "Az Ön jelenlegi Plex médiaszervere:"
|
|||
# PKC Settings - Connection
|
||||
msgctxt "#39068"
|
||||
msgid "Manually enter Plex Media Server address"
|
||||
msgstr ""
|
||||
msgstr "Plex médiaszerver címének kézi megadása"
|
||||
|
||||
# PKC Settings - Connection
|
||||
msgctxt "#39069"
|
||||
|
@ -1170,20 +1182,24 @@ msgid ""
|
|||
"Use Add-on Paths (default, easy) or Direct Paths? Choose Add-on Paths if "
|
||||
"you're unsure. PKC will not work if your Direct Paths setup is wrong!"
|
||||
msgstr ""
|
||||
"Bővítmény elérési utakat (alapértelmezett, egyszerű) vagy közvetlen elérési "
|
||||
"utakat kíván használni? Ha nem biztos benne, válassza a bővítmény elérési "
|
||||
"utakat. A PKC nem fog működni, ha a közvetlen elérési utak rosszul vannak "
|
||||
"beállítva!"
|
||||
|
||||
# Button text for choosing PKC mode
|
||||
msgctxt "#39081"
|
||||
msgid "Add-on Paths"
|
||||
msgstr ""
|
||||
msgstr "Bővítmény elérési utak"
|
||||
|
||||
# Button text for choosing PKC mode
|
||||
msgctxt "#39082"
|
||||
msgid "Direct Paths"
|
||||
msgstr ""
|
||||
msgstr "Közvetlen elérési utak"
|
||||
|
||||
msgctxt "#39200"
|
||||
msgid "Log-out Plex Home User "
|
||||
msgstr "Kijelentkezés az otthoni Plex felhasználó fiókból"
|
||||
msgstr "Kijelentkezés az otthoni Plex felhasználó fiókból: "
|
||||
|
||||
msgctxt "#39201"
|
||||
msgid "Settings"
|
||||
|
@ -1219,7 +1235,7 @@ msgstr "A PKC visszaállítása sikertelen. Kérem indítsa újra a Kodi-t."
|
|||
# PKC Settings - Plex
|
||||
msgctxt "#39209"
|
||||
msgid "Toggle plex.tv login (sign in or sign out)"
|
||||
msgstr ""
|
||||
msgstr "Plex.tv bejelentkezés átkapcsolása (be- vagy kijelentkezés)"
|
||||
|
||||
msgctxt "#39210"
|
||||
msgid "Not yet connected to Plex Server"
|
||||
|
@ -1265,7 +1281,7 @@ msgstr "plex.tv átkapcsolás sikeres"
|
|||
|
||||
msgctxt "#39222"
|
||||
msgid "Look for missing fanart on FanartTV now"
|
||||
msgstr ""
|
||||
msgstr "Hiányzó művészképek keresése a FanArtTV-n most"
|
||||
|
||||
msgctxt "#39223"
|
||||
msgid ""
|
||||
|
@ -1303,7 +1319,7 @@ msgstr "Plex felhasználó:"
|
|||
# appended at the end of the string
|
||||
msgctxt "#39229"
|
||||
msgid "Login failed with plex.tv for user"
|
||||
msgstr ""
|
||||
msgstr "Sikertelen bejelentkezés a plex.tv-re a következő felhasználóval"
|
||||
|
||||
msgctxt "#39250"
|
||||
msgid ""
|
||||
|
@ -1379,6 +1395,8 @@ msgid ""
|
|||
"The current Kodi version is not supported by PKC. Please consult the Plex "
|
||||
"forum."
|
||||
msgstr ""
|
||||
"A PKC nem támogatja a jelenlegi Kodi verziót. Kérjen tanácsot a Plex "
|
||||
"fórumon."
|
||||
|
||||
msgctxt "#39405"
|
||||
msgid "Plex playlists/nodes refreshed"
|
||||
|
|
|
@ -1288,12 +1288,12 @@ msgstr "Alleen ontbrekende"
|
|||
# Message in the PKC settings if user has not logged in to plex.tv
|
||||
msgctxt "#39226"
|
||||
msgid "Not logged in to plex.tv"
|
||||
msgstr "Niet ingelogd op plek.tv"
|
||||
msgstr "Niet ingelogd op plex.tv"
|
||||
|
||||
# Message in the PKC settings if user is logged in to plex.tv
|
||||
msgctxt "#39227"
|
||||
msgid "Logged in to plex.tv"
|
||||
msgstr "Ingelogd op plek.tv"
|
||||
msgstr "Ingelogd op plex.tv"
|
||||
|
||||
# Message in the PKC settings to display the plex.tv username. Leave the colon
|
||||
# :
|
||||
|
|
|
@ -81,7 +81,7 @@ class MusicMixin(object):
|
|||
self.remove_song(db_item['kodi_id'], db_item['kodi_pathid'])
|
||||
# Album verification
|
||||
if not self.plexdb.album_has_songs(db_item['album_id']):
|
||||
# No episode left for this season - so delete the season
|
||||
# No songleft for this album - so delete the album
|
||||
self.remove_album(db_item['parent_id'])
|
||||
self.plexdb.remove(db_item['album_id'], v.PLEX_TYPE_ALBUM)
|
||||
# Artist verification
|
||||
|
@ -91,8 +91,9 @@ class MusicMixin(object):
|
|||
self.plexdb.remove(db_item['artist_id'], v.PLEX_TYPE_ARTIST)
|
||||
# ALBUM #####
|
||||
elif db_item['plex_type'] == v.PLEX_TYPE_ALBUM:
|
||||
# Remove episodes, season, verify tvshow
|
||||
for song in self.plexdb.song_by_album(db_item['plex_id']):
|
||||
# Remove songs, album, verify artist
|
||||
songs = list(self.plexdb.song_by_album(db_item['plex_id']))
|
||||
for song in songs:
|
||||
self.remove_song(song['kodi_id'], song['kodi_pathid'])
|
||||
self.plexdb.remove(song['plex_id'], v.PLEX_TYPE_SONG)
|
||||
# Remove the album
|
||||
|
@ -100,16 +101,18 @@ class MusicMixin(object):
|
|||
# Show verification
|
||||
if (not self.plexdb.artist_has_albums(db_item['kodi_id']) and
|
||||
not self.plexdb.artist_has_songs(db_item['kodi_id'])):
|
||||
# There's no other season or episode left, delete the show
|
||||
# There's no other album or song left, delete the artist
|
||||
self.remove_artist(db_item['parent_id'])
|
||||
self.plexdb.remove(db_item['artist_id'], v.KODI_TYPE_ARTIST)
|
||||
# ARTIST #####
|
||||
elif db_item['plex_type'] == v.PLEX_TYPE_ARTIST:
|
||||
# Remove songs, albums and the artist himself
|
||||
for song in self.plexdb.song_by_artist(db_item['plex_id']):
|
||||
songs = list(self.plexdb.song_by_artist(db_item['plex_id']))
|
||||
for song in songs:
|
||||
self.remove_song(song['kodi_id'], song['kodi_pathid'])
|
||||
self.plexdb.remove(song['plex_id'], v.PLEX_TYPE_SONG)
|
||||
for album in self.plexdb.album_by_artist(db_item['plex_id']):
|
||||
albums = list(self.plexdb.album_by_artist(db_item['plex_id']))
|
||||
for album in albums:
|
||||
self.remove_album(album['kodi_id'])
|
||||
self.plexdb.remove(album['plex_id'], v.PLEX_TYPE_ALBUM)
|
||||
self.remove_artist(db_item['kodi_id'])
|
||||
|
|
|
@ -70,7 +70,8 @@ class TvShowMixin(object):
|
|||
# SEASON #####
|
||||
elif db_item['plex_type'] == v.PLEX_TYPE_SEASON:
|
||||
# Remove episodes, season, verify tvshow
|
||||
for episode in self.plexdb.episode_by_season(db_item['plex_id']):
|
||||
episodes = list(self.plexdb.episode_by_season(db_item['plex_id']))
|
||||
for episode in episodes:
|
||||
self.remove_episode(episode['kodi_id'], episode['kodi_fileid'])
|
||||
self.plexdb.remove(episode['plex_id'], v.PLEX_TYPE_EPISODE)
|
||||
# Remove season
|
||||
|
@ -84,13 +85,15 @@ class TvShowMixin(object):
|
|||
# TVSHOW #####
|
||||
elif db_item['plex_type'] == v.PLEX_TYPE_SHOW:
|
||||
# Remove episodes, seasons and the tvshow itself
|
||||
for episode in self.plexdb.episode_by_show(db_item['plex_id']):
|
||||
seasons = list(self.plexdb.season_by_show(db_item['plex_id']))
|
||||
for season in seasons:
|
||||
self.remove_season(season['kodi_id'])
|
||||
self.plexdb.remove(season['plex_id'], v.PLEX_TYPE_SEASON)
|
||||
episodes = list(self.plexdb.episode_by_show(db_item['plex_id']))
|
||||
for episode in episodes:
|
||||
self.remove_episode(episode['kodi_id'],
|
||||
episode['kodi_fileid'])
|
||||
self.plexdb.remove(episode['plex_id'], v.PLEX_TYPE_EPISODE)
|
||||
for season in self.plexdb.season_by_show(db_item['plex_id']):
|
||||
self.remove_season(season['kodi_id'])
|
||||
self.plexdb.remove(season['plex_id'], v.PLEX_TYPE_SEASON)
|
||||
self.remove_show(db_item['kodi_id'])
|
||||
|
||||
LOG.debug('Deleted %s %s from all databases',
|
||||
|
|
|
@ -415,6 +415,12 @@ class FullSync(common.fullsync_mixin):
|
|||
self.dialog.close()
|
||||
if self.threader:
|
||||
self.threader.shutdown()
|
||||
if not self.successful and not self.isCanceled():
|
||||
# "ERROR in library sync"
|
||||
utils.dialog('notification',
|
||||
heading='{plex}',
|
||||
message=utils.lang(39410),
|
||||
icon='{error}')
|
||||
if self.callback:
|
||||
self.callback(self.successful)
|
||||
LOG.info('Done full_sync')
|
||||
|
|
|
@ -13,12 +13,17 @@ from .. import plex_functions as PF, music, utils, variables as v, app
|
|||
|
||||
LOG = getLogger('PLEX.sync.sections')
|
||||
|
||||
BATCH_SIZE = 200
|
||||
VNODES = videonodes.VideoNodes()
|
||||
PLAYLISTS = {}
|
||||
NODES = {}
|
||||
SECTIONS = []
|
||||
|
||||
|
||||
def isCanceled():
|
||||
return app.APP.stop_pkc or app.APP.suspend_threads or app.SYNC.stop_sync
|
||||
|
||||
|
||||
def sync_from_pms():
|
||||
"""
|
||||
Sync the Plex library sections
|
||||
|
@ -198,56 +203,61 @@ def _process_section(section_xml, kodidb, plexdb, sorted_sections,
|
|||
return totalnodes
|
||||
|
||||
|
||||
def _delete_kodi_db_items(section_id, section_type):
|
||||
if section_type == v.PLEX_TYPE_MOVIE:
|
||||
kodi_context = kodi_db.KodiVideoDB
|
||||
types = ((v.PLEX_TYPE_MOVIE, itemtypes.Movie), )
|
||||
elif section_type == v.PLEX_TYPE_SHOW:
|
||||
kodi_context = kodi_db.KodiVideoDB
|
||||
types = ((v.PLEX_TYPE_SHOW, itemtypes.Show),
|
||||
(v.PLEX_TYPE_SEASON, itemtypes.Season),
|
||||
(v.PLEX_TYPE_EPISODE, itemtypes.Episode))
|
||||
elif section_type == v.PLEX_TYPE_ARTIST:
|
||||
kodi_context = kodi_db.KodiMusicDB
|
||||
types = ((v.PLEX_TYPE_ARTIST, itemtypes.Artist),
|
||||
(v.PLEX_TYPE_ALBUM, itemtypes.Album),
|
||||
(v.PLEX_TYPE_SONG, itemtypes.Song))
|
||||
for plex_type, context in types:
|
||||
while True:
|
||||
with PlexDB() as plexdb:
|
||||
plex_ids = list(plexdb.plexid_by_sectionid(section_id,
|
||||
plex_type,
|
||||
BATCH_SIZE))
|
||||
with kodi_context(texture_db=True) as kodidb:
|
||||
typus = context(None, plexdb=plexdb, kodidb=kodidb)
|
||||
for plex_id in plex_ids:
|
||||
if isCanceled():
|
||||
return False
|
||||
typus.remove(plex_id)
|
||||
if len(plex_ids) < BATCH_SIZE:
|
||||
break
|
||||
return True
|
||||
|
||||
|
||||
def delete_sections(old_sections):
|
||||
"""
|
||||
Deletes all elements for a Plex section that has been deleted. (e.g. all
|
||||
TV shows, Seasons and Episodes of a Show section)
|
||||
"""
|
||||
utils.dialog('notification',
|
||||
heading='{plex}',
|
||||
message=utils.lang(30052),
|
||||
icon='{plex}',
|
||||
sound=False)
|
||||
video_library_update = False
|
||||
music_library_update = False
|
||||
try:
|
||||
with PlexDB() as plexdb:
|
||||
old_sections = [plexdb.section(x) for x in old_sections]
|
||||
LOG.info("Removing entire Plex library sections: %s", old_sections)
|
||||
with kodi_db.KodiVideoDB(texture_db=True) as kodidb:
|
||||
for section in old_sections:
|
||||
if section[2] == v.KODI_TYPE_PHOTO:
|
||||
# not synced
|
||||
plexdb.remove_section(section[0])
|
||||
continue
|
||||
elif section[2] == v.KODI_TYPE_MOVIE:
|
||||
video_library_update = True
|
||||
context = itemtypes.Movie(None,
|
||||
plexdb=plexdb,
|
||||
kodidb=kodidb)
|
||||
elif section[2] == v.KODI_TYPE_SHOW:
|
||||
video_library_update = True
|
||||
context = itemtypes.Show(None,
|
||||
plexdb=plexdb,
|
||||
kodidb=kodidb)
|
||||
# "Deleting <section_name>"
|
||||
utils.dialog('notification',
|
||||
heading='{plex}',
|
||||
message='%s %s' % (utils.lang(30052), section[1]),
|
||||
icon='{plex}',
|
||||
sound=False)
|
||||
if section[2] == v.PLEX_TYPE_PHOTO:
|
||||
# not synced - just remove the link in our Plex sections table
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
for plex_id in plexdb.plexid_by_sectionid(section[0], section[2]):
|
||||
context.remove(plex_id)
|
||||
if not _delete_kodi_db_items(section[0], section[2]):
|
||||
return
|
||||
# Only remove Plex entry if we've removed all items first
|
||||
with PlexDB() as plexdb:
|
||||
plexdb.remove_section(section[0])
|
||||
|
||||
with kodi_db.KodiMusicDB(texture_db=True) as kodidb:
|
||||
for section in old_sections:
|
||||
if section[2] == v.KODI_TYPE_ARTIST:
|
||||
music_library_update = True
|
||||
context = itemtypes.Artist(None,
|
||||
plexdb=plexdb,
|
||||
kodidb=kodidb)
|
||||
else:
|
||||
continue
|
||||
for plex_id in plexdb.plexid_by_sectionid(section[0], section[2]):
|
||||
context.remove(plex_id)
|
||||
# Only remove Plex entry if we've removed all items first
|
||||
plexdb.remove_section(section[0])
|
||||
common.update_kodi_library(video=video_library_update,
|
||||
music=music_library_update)
|
||||
finally:
|
||||
common.update_kodi_library()
|
||||
|
|
|
@ -1744,7 +1744,13 @@ class API(object):
|
|||
if path.startswith('\\\\'):
|
||||
path = 'smb:' + path.replace('\\', '/')
|
||||
if app.SYNC.escape_path:
|
||||
path = quote(path)
|
||||
try:
|
||||
protocol, hostname, args = path.split(':', 2)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
args = quote(args)
|
||||
path = '%s:%s:%s' % (protocol, hostname, args)
|
||||
if (app.SYNC.path_verified and not force_check) or omit_check:
|
||||
return path
|
||||
|
||||
|
|
|
@ -162,10 +162,11 @@ class PlexDBBase(object):
|
|||
self.cursor.execute('UPDATE %s SET fanart_synced = 1 WHERE plex_id = ?' % plex_type,
|
||||
(plex_id, ))
|
||||
|
||||
def plexid_by_sectionid(self, section_id, plex_type):
|
||||
return (x[0] for x in
|
||||
self.cursor.execute('SELECT plex_id FROM %s WHERE section_id = ?' % plex_type,
|
||||
(section_id, )))
|
||||
def plexid_by_sectionid(self, section_id, plex_type, limit):
|
||||
query = '''
|
||||
SELECT plex_id FROM %s WHERE section_id = ? LIMIT %s
|
||||
''' % (plex_type, limit)
|
||||
return (x[0] for x in self.cursor.execute(query, (section_id, )))
|
||||
|
||||
def kodiid_by_sectionid(self, section_id, plex_type):
|
||||
return (x[0] for x in
|
||||
|
|
|
@ -43,31 +43,6 @@ class Sync(backgroundthread.KillableThread):
|
|||
def isSuspended(self):
|
||||
return self._suspended or app.APP.suspend_threads
|
||||
|
||||
def show_kodi_note(self, message, icon="plex", force=False):
|
||||
"""
|
||||
Shows a Kodi popup, if user selected to do so. Pass message in unicode
|
||||
or string
|
||||
|
||||
icon: "plex": shows Plex icon
|
||||
"error": shows Kodi error icon
|
||||
"""
|
||||
if app.APP.player.isPlaying():
|
||||
LOG.info('Playing media - not showing note: %s', message)
|
||||
return
|
||||
if not force and app.SYNC.sync_dialog is not True and self.force_dialog is not True:
|
||||
return
|
||||
if icon == "plex":
|
||||
utils.dialog('notification',
|
||||
heading='{plex}',
|
||||
message=message,
|
||||
icon='{plex}',
|
||||
sound=False)
|
||||
elif icon == "error":
|
||||
utils.dialog('notification',
|
||||
heading='{plex}',
|
||||
message=message,
|
||||
icon='{error}')
|
||||
|
||||
def triage_lib_scans(self):
|
||||
"""
|
||||
Decides what to do if app.SYNC.run_lib_scan has been set. E.g. manually
|
||||
|
@ -81,7 +56,7 @@ class Sync(backgroundthread.KillableThread):
|
|||
block=True)
|
||||
if not self.sync_successful and not self.isSuspended() and not self.isCanceled():
|
||||
# ERROR in library sync
|
||||
self.show_kodi_note(utils.lang(39410), icon='error')
|
||||
LOG.warn('Triggered full/repair sync has not been successful')
|
||||
elif app.SYNC.run_lib_scan == 'fanart':
|
||||
# Only look for missing fanart (No) or refresh all fanart (Yes)
|
||||
from .windows import optionsdialog
|
||||
|
@ -113,10 +88,7 @@ class Sync(backgroundthread.KillableThread):
|
|||
self.last_full_sync = timing.unix_timestamp()
|
||||
set_library_scan_toggle(boolean=False)
|
||||
if not successful:
|
||||
LOG.error('Could not finish scheduled full sync')
|
||||
self.force_dialog = True
|
||||
self.show_kodi_note(utils.lang(39410), icon='error')
|
||||
self.force_dialog = False
|
||||
LOG.warn('Could not finish scheduled full sync')
|
||||
# try:
|
||||
# self.lock.release()
|
||||
# except backgroundthread.threading.ThreadError:
|
||||
|
|
|
@ -91,7 +91,7 @@ COMPANION_PORT = int(_ADDON.getSetting('companionPort'))
|
|||
PKC_MACHINE_IDENTIFIER = None
|
||||
|
||||
# Minimal PKC version needed for the Kodi database - otherwise need to recreate
|
||||
MIN_DB_VERSION = '2.5.12'
|
||||
MIN_DB_VERSION = '2.6.1'
|
||||
|
||||
# Supported databases
|
||||
SUPPORTED_VIDEO_DB = {
|
||||
|
|
Loading…
Reference in a new issue