Before recoding Plexmovies function
This commit is contained in:
parent
1b254fdd37
commit
54a20f0b13
4 changed files with 17 additions and 4 deletions
|
@ -1351,6 +1351,12 @@ class API():
|
||||||
)
|
)
|
||||||
return checksum
|
return checksum
|
||||||
|
|
||||||
|
def getKey(self):
|
||||||
|
item = self.item
|
||||||
|
key_regex = re.compile(r'/(\d+)$')
|
||||||
|
key = key_regex.findall(item['key'])[0]
|
||||||
|
return int(key)
|
||||||
|
|
||||||
def getDateCreated(self):
|
def getDateCreated(self):
|
||||||
item = self.item
|
item = self.item
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -265,6 +265,7 @@ class Artwork():
|
||||||
# Process backdrops and extra fanart
|
# Process backdrops and extra fanart
|
||||||
index = ""
|
index = ""
|
||||||
for backdrop in backdrops:
|
for backdrop in backdrops:
|
||||||
|
self.logMsg("imageURL: %s, kodiId: %s, mediatype: %s, imagetype: %s, cursor: %s" % (backdrop, kodiId, mediaType, index, cursor), 2)
|
||||||
self.addOrUpdateArt(
|
self.addOrUpdateArt(
|
||||||
imageUrl=backdrop,
|
imageUrl=backdrop,
|
||||||
kodiId=kodiId,
|
kodiId=kodiId,
|
||||||
|
|
|
@ -277,14 +277,14 @@ class Movies(Items):
|
||||||
# If the item already exist in the local Kodi DB we'll perform a full item update
|
# If the item already exist in the local Kodi DB we'll perform a full item update
|
||||||
# If the item doesn't exist, we'll add it to the database
|
# If the item doesn't exist, we'll add it to the database
|
||||||
update_item = True
|
update_item = True
|
||||||
itemid = item['key']
|
itemid = API.getKey()
|
||||||
emby_dbitem = emby_db.getItem_byId(itemid)
|
emby_dbitem = emby_db.getItem_byId(itemid)
|
||||||
try:
|
try:
|
||||||
movieid = emby_dbitem[0]
|
movieid = emby_dbitem[0]
|
||||||
fileid = emby_dbitem[1]
|
fileid = emby_dbitem[1]
|
||||||
pathid = emby_dbitem[2]
|
pathid = emby_dbitem[2]
|
||||||
self.logMsg("movieid: %s fileid: %s pathid: %s" % (movieid, fileid, pathid), 1)
|
self.logMsg("movieid: %s fileid: %s pathid: %s" % (movieid, fileid, pathid), 1)
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
update_item = False
|
update_item = False
|
||||||
self.logMsg("movieid: %s not found." % itemid, 2)
|
self.logMsg("movieid: %s not found." % itemid, 2)
|
||||||
|
@ -292,6 +292,11 @@ class Movies(Items):
|
||||||
kodicursor.execute("select coalesce(max(idMovie),0) from movie")
|
kodicursor.execute("select coalesce(max(idMovie),0) from movie")
|
||||||
movieid = kodicursor.fetchone()[0] + 1
|
movieid = kodicursor.fetchone()[0] + 1
|
||||||
|
|
||||||
|
# if not viewtag or not viewid:
|
||||||
|
# # Get view tag from emby
|
||||||
|
# viewtag, viewid, mediatype = self.emby.getView_embyId(itemid)
|
||||||
|
# self.logMsg("View tag found: %s" % viewtag, 2)
|
||||||
|
|
||||||
# fileId information
|
# fileId information
|
||||||
checksum = API.getChecksum()
|
checksum = API.getChecksum()
|
||||||
dateadded = API.getDateCreated()
|
dateadded = API.getDateCreated()
|
||||||
|
@ -365,7 +370,6 @@ class Movies(Items):
|
||||||
}
|
}
|
||||||
filename = "%s?%s" % (path, urllib.urlencode(params))
|
filename = "%s?%s" % (path, urllib.urlencode(params))
|
||||||
|
|
||||||
|
|
||||||
##### UPDATE THE MOVIE #####
|
##### UPDATE THE MOVIE #####
|
||||||
if update_item:
|
if update_item:
|
||||||
self.logMsg("UPDATE movie itemid: %s - Title: %s" % (itemid, title), 1)
|
self.logMsg("UPDATE movie itemid: %s - Title: %s" % (itemid, title), 1)
|
||||||
|
|
|
@ -520,7 +520,7 @@ class LibrarySync(threading.Thread):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
API = PlexAPI.API(embymovie)
|
API = PlexAPI.API(embymovie)
|
||||||
itemid = embymovie['key']
|
itemid = API.getKey()
|
||||||
all_embymoviesIds.add(itemid)
|
all_embymoviesIds.add(itemid)
|
||||||
|
|
||||||
if all_kodimovies.get(itemid) != API.getChecksum():
|
if all_kodimovies.get(itemid) != API.getChecksum():
|
||||||
|
@ -559,6 +559,8 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
##### PROCESS DELETES #####
|
##### PROCESS DELETES #####
|
||||||
if compare:
|
if compare:
|
||||||
|
self.logMsg("all_kodimovies: %s" % all_kodimovies, 1)
|
||||||
|
self.logMsg("all_embymovies: %s" % all_embymoviesIds, 1)
|
||||||
# Manual sync, process deletes
|
# Manual sync, process deletes
|
||||||
for kodimovie in all_kodimovies:
|
for kodimovie in all_kodimovies:
|
||||||
if kodimovie not in all_embymoviesIds:
|
if kodimovie not in all_embymoviesIds:
|
||||||
|
|
Loading…
Reference in a new issue