Merge conflicts sync

This commit is contained in:
tomkat83 2016-01-15 10:04:47 +01:00
parent 332e64729a
commit c1c19cbc68
4 changed files with 44 additions and 26 deletions

View file

@ -2160,10 +2160,10 @@ class API():
Output: each track contains a dictionaries Output: each track contains a dictionaries
{ {
'video': videotrack-list, 'videocodec', 'height', 'width', 'video': videotrack-list, 'codec', 'height', 'width',
'aspectratio', 'video3DFormat' 'aspect', 'video3DFormat'
'audio': audiotrack-list, 'audiocodec', 'channels', 'audio': audiotrack-list, 'codec', 'channels',
'audiolanguage' 'language'
'subtitle': list of subtitle languages (or "Unknown") 'subtitle': list of subtitle languages (or "Unknown")
} }
""" """
@ -2186,16 +2186,16 @@ class API():
type = int(mediaStream['streamType']) type = int(mediaStream['streamType'])
if type == 1: # Video streams if type == 1: # Video streams
videotrack = {} videotrack = {}
videotrack['videocodec'] = mediaStream['codec'].lower() videotrack['codec'] = mediaStream['codec'].lower()
if "msmpeg4" in videotrack['videocodec']: if "msmpeg4" in videotrack['codec']:
videotrack['videocodec'] = "divx" videotrack['codec'] = "divx"
elif "mpeg4" in videotrack['videocodec']: elif "mpeg4" in videotrack['codec']:
# if "simple profile" in profile or profile == "": # if "simple profile" in profile or profile == "":
# videotrack['videocodec'] = "xvid" # videotrack['codec'] = "xvid"
pass pass
elif "h264" in videotrack['videocodec']: elif "h264" in videotrack['codec']:
if container in ("mp4", "mov", "m4v"): if container in ("mp4", "mov", "m4v"):
videotrack['videocodec'] = "avc1" videotrack['codec'] = "avc1"
videotrack['height'] = mediaStream.get('height') videotrack['height'] = mediaStream.get('height')
videotrack['width'] = mediaStream.get('width') videotrack['width'] = mediaStream.get('width')
# TODO: 3d Movies?!? # TODO: 3d Movies?!?
@ -2205,22 +2205,22 @@ class API():
except KeyError: except KeyError:
if not aspectratio: if not aspectratio:
aspectratio = round(float(videotrack['width'] / videotrack['height']), 6) aspectratio = round(float(videotrack['width'] / videotrack['height']), 6)
videotrack['aspectratio'] = aspectratio videotrack['aspect'] = aspectratio
# TODO: Video 3d format # TODO: Video 3d format
videotrack['video3DFormat'] = None videotrack['video3DFormat'] = None
videotracks.append(videotrack) videotracks.append(videotrack)
elif type == 2: # Audio streams elif type == 2: # Audio streams
audiotrack = {} audiotrack = {}
audiotrack['audiocodec'] = mediaStream['codec'].lower() audiotrack['codec'] = mediaStream['codec'].lower()
profile = mediaStream['codecID'].lower() profile = mediaStream['codecID'].lower()
if "dca" in audiotrack['audiocodec'] and "dts-hd ma" in profile: if "dca" in audiotrack['codec'] and "dts-hd ma" in profile:
audiotrack['audiocodec'] = "dtshd_ma" audiotrack['codec'] = "dtshd_ma"
audiotrack['channels'] = mediaStream.get('channels') audiotrack['channels'] = mediaStream.get('channels')
try: try:
audiotrack['audiolanguage'] = mediaStream.get('language') audiotrack['language'] = mediaStream.get('language')
except KeyError: except KeyError:
audiotrack['audiolanguage'] = 'unknown' audiotrack['language'] = 'unknown'
audiotracks.append(audiotrack) audiotracks.append(audiotrack)
elif type == 3: # Subtitle streams elif type == 3: # Subtitle streams

View file

@ -1258,6 +1258,7 @@ class TVShows(Items):
kodicursor.execute(query, (title, plot, rating, writer, premieredate, kodicursor.execute(query, (title, plot, rating, writer, premieredate,
runtime, director, season, episode, title, airsBeforeSeason, runtime, director, season, episode, title, airsBeforeSeason,
airsBeforeEpisode, seasonid, episodeid)) airsBeforeEpisode, seasonid, episodeid))
self.logMsg("Checkpoint 1", 2)
else: else:
query = ' '.join(( query = ' '.join((
@ -1271,8 +1272,10 @@ class TVShows(Items):
airsBeforeEpisode, episodeid)) airsBeforeEpisode, episodeid))
# Update the checksum in emby table # Update the checksum in emby table
self.logMsg("Checkpoint 2", 2)
emby_db.updateReference(itemid, checksum) emby_db.updateReference(itemid, checksum)
# Update parentid reference # Update parentid reference
self.logMsg("Checkpoint 3", 2)
emby_db.updateParentId(itemid, seasonid) emby_db.updateParentId(itemid, seasonid)
##### OR ADD THE EPISODE ##### ##### OR ADD THE EPISODE #####
@ -1324,7 +1327,7 @@ class TVShows(Items):
"WHERE idPath = ?" "WHERE idPath = ?"
)) ))
kodicursor.execute(query, (path, None, None, 1, pathid)) kodicursor.execute(query, (path, None, None, 1, pathid))
self.logMsg("Checkpoint 4", 2)
# Update the file # Update the file
query = ' '.join(( query = ' '.join((
@ -1333,18 +1336,24 @@ class TVShows(Items):
"WHERE idFile = ?" "WHERE idFile = ?"
)) ))
kodicursor.execute(query, (pathid, filename, dateadded, fileid)) kodicursor.execute(query, (pathid, filename, dateadded, fileid))
self.logMsg("Checkpoint 5", 2)
# Process cast # Process cast
people = API.getPeopleList() people = API.getPeopleList()
kodi_db.addPeople(episodeid, people, "episode") kodi_db.addPeople(episodeid, people, "episode")
# Process artwork # Process artwork
self.logMsg("Checkpoint 6", 2)
artworks = API.getAllArtwork() artworks = API.getAllArtwork()
self.logMsg("Checkpoint 7", 2)
artwork.addOrUpdateArt(artworks['Primary'], episodeid, "episode", "thumb", kodicursor) artwork.addOrUpdateArt(artworks['Primary'], episodeid, "episode", "thumb", kodicursor)
self.logMsg("Checkpoint 8", 2)
# Process stream details # Process stream details
streams = API.getMediaStreams() streams = API.getMediaStreams()
self.logMsg("Checkpoint 9", 2)
kodi_db.addStreams(fileid, streams, runtime) kodi_db.addStreams(fileid, streams, runtime)
self.logMsg("Checkpoint 7", 2)
# Process playstates # Process playstates
kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed)
self.logMsg("Checkpoint 8", 2)
if not self.directpath and resume: if not self.directpath and resume:
# Create additional entry for widgets. This is only required for plugin/episode. # Create additional entry for widgets. This is only required for plugin/episode.
temppathid = kodi_db.getPath("plugin://plugin.video.plexkodiconnect.tvshows/") temppathid = kodi_db.getPath("plugin://plugin.video.plexkodiconnect.tvshows/")
@ -1355,6 +1364,7 @@ class TVShows(Items):
"SET idPath = ?, strFilename = ?, dateAdded = ?", "SET idPath = ?, strFilename = ?, dateAdded = ?",
"WHERE idFile = ?" "WHERE idFile = ?"
)) ))
self.logMsg("Checkpoint 9", 2)
kodicursor.execute(query, (temppathid, filename, dateadded, tempfileid)) kodicursor.execute(query, (temppathid, filename, dateadded, tempfileid))
kodi_db.addPlaystate(tempfileid, resume, runtime, playcount, dateplayed) kodi_db.addPlaystate(tempfileid, resume, runtime, playcount, dateplayed)

View file

@ -49,6 +49,10 @@ class ThreadedGetMetadata(threading.Thread):
self.addonName = clientinfo.ClientInfo().getAddonName() self.addonName = clientinfo.ClientInfo().getAddonName()
threading.Thread.__init__(self) threading.Thread.__init__(self)
def logMsg(self, msg, lvl=1):
className = self.__class__.__name__
utils.logMsg("%s %s" % (self.addonName, className), msg, lvl)
def run_internal(self): def run_internal(self):
plx = PlexAPI.PlexAPI() plx = PlexAPI.PlexAPI()
global getMetadataCount global getMetadataCount
@ -112,6 +116,10 @@ class ThreadedProcessMetadata(threading.Thread):
self.addonName = clientinfo.ClientInfo().getAddonName() self.addonName = clientinfo.ClientInfo().getAddonName()
threading.Thread.__init__(self) threading.Thread.__init__(self)
def logMsg(self, msg, lvl=1):
className = self.__class__.__name__
utils.logMsg("%s %s" % (self.addonName, className), msg, lvl)
def run_internal(self): def run_internal(self):
# Constructs the method name, e.g. itemtypes.Movies # Constructs the method name, e.g. itemtypes.Movies
itemFkt = getattr(itemtypes, self.itemType) itemFkt = getattr(itemtypes, self.itemType)
@ -386,12 +394,12 @@ class LibrarySync(threading.Thread):
self.maintainViews() self.maintainViews()
# Sync video library # Sync video library
process = { # process = {
'movies': self.movies, # 'movies': self.movies,
'musicvideos': self.musicvideos, # 'musicvideos': self.musicvideos,
'tvshows': self.tvshows # 'tvshows': self.tvshows
} # }
process = { process = {
'movies': self.PlexMovies, 'movies': self.PlexMovies,

View file

@ -124,7 +124,7 @@ class VideoNodes(object):
} }
mediatypes = { mediatypes = {
# label according to nodetype per mediatype # label according to nodetype per mediatype
'movies': 'movie':
{ {
'1': tagname, '1': tagname,
'2': 30174, '2': 30174,
@ -136,7 +136,7 @@ class VideoNodes(object):
'11': 30230 '11': 30230
}, },
'tvshows': 'show':
{ {
'1': tagname, '1': tagname,
'2': 30170, '2': 30170,