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
|
||||
|
||||
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):
|
||||
item = self.item
|
||||
try:
|
||||
|
|
|
@ -265,6 +265,7 @@ class Artwork():
|
|||
# Process backdrops and extra fanart
|
||||
index = ""
|
||||
for backdrop in backdrops:
|
||||
self.logMsg("imageURL: %s, kodiId: %s, mediatype: %s, imagetype: %s, cursor: %s" % (backdrop, kodiId, mediaType, index, cursor), 2)
|
||||
self.addOrUpdateArt(
|
||||
imageUrl=backdrop,
|
||||
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 doesn't exist, we'll add it to the database
|
||||
update_item = True
|
||||
itemid = item['key']
|
||||
itemid = API.getKey()
|
||||
emby_dbitem = emby_db.getItem_byId(itemid)
|
||||
try:
|
||||
movieid = emby_dbitem[0]
|
||||
fileid = emby_dbitem[1]
|
||||
pathid = emby_dbitem[2]
|
||||
self.logMsg("movieid: %s fileid: %s pathid: %s" % (movieid, fileid, pathid), 1)
|
||||
|
||||
|
||||
except TypeError:
|
||||
update_item = False
|
||||
self.logMsg("movieid: %s not found." % itemid, 2)
|
||||
|
@ -292,6 +292,11 @@ class Movies(Items):
|
|||
kodicursor.execute("select coalesce(max(idMovie),0) from movie")
|
||||
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
|
||||
checksum = API.getChecksum()
|
||||
dateadded = API.getDateCreated()
|
||||
|
@ -365,7 +370,6 @@ class Movies(Items):
|
|||
}
|
||||
filename = "%s?%s" % (path, urllib.urlencode(params))
|
||||
|
||||
|
||||
##### UPDATE THE MOVIE #####
|
||||
if update_item:
|
||||
self.logMsg("UPDATE movie itemid: %s - Title: %s" % (itemid, title), 1)
|
||||
|
|
|
@ -520,7 +520,7 @@ class LibrarySync(threading.Thread):
|
|||
return False
|
||||
|
||||
API = PlexAPI.API(embymovie)
|
||||
itemid = embymovie['key']
|
||||
itemid = API.getKey()
|
||||
all_embymoviesIds.add(itemid)
|
||||
|
||||
if all_kodimovies.get(itemid) != API.getChecksum():
|
||||
|
@ -559,6 +559,8 @@ class LibrarySync(threading.Thread):
|
|||
|
||||
##### PROCESS DELETES #####
|
||||
if compare:
|
||||
self.logMsg("all_kodimovies: %s" % all_kodimovies, 1)
|
||||
self.logMsg("all_embymovies: %s" % all_embymoviesIds, 1)
|
||||
# Manual sync, process deletes
|
||||
for kodimovie in all_kodimovies:
|
||||
if kodimovie not in all_embymoviesIds:
|
||||
|
|
Loading…
Reference in a new issue