Fix some merge conflicts

This commit is contained in:
tomkat83 2016-04-26 14:41:58 +02:00
parent c7b52a1fa4
commit b820953c52
8 changed files with 32 additions and 74 deletions

View file

@ -840,7 +840,7 @@ def BrowseContent(viewname, browse_type="", folderid=""):
##### CREATE LISTITEM FROM EMBY METADATA ##### ##### CREATE LISTITEM FROM EMBY METADATA #####
def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.DownloadUtils()): def createListItemFromEmbyItem(item,art=artwork.Artwork(),doUtils=downloadutils.DownloadUtils()):
API = api.API(item) API = PlexAPI.API(item)
itemid = item['Id'] itemid = item['Id']
title = item.get('Name') title = item.get('Name')

View file

@ -442,8 +442,8 @@ class Movies(Items):
# Even if the item is only updated, the file may have been moved or updated. # Even if the item is only updated, the file may have been moved or updated.
# In the worst case we get exactly the same values as we had before. # In the worst case we get exactly the same values as we had before.
pathid = kodi_db.addPath(path) pathid = self.kodi_db.addPath(path)
fileid = kodi_db.addFile(filename, pathid) fileid = self.kodi_db.addFile(filename, pathid)
# movie table: # movie table:
# c22 - playurl # c22 - playurl
@ -510,7 +510,7 @@ class Movies(Items):
kodicursor.execute(query, (pathid, filename, dateadded, fileid)) kodicursor.execute(query, (pathid, filename, dateadded, fileid))
# Process countries # Process countries
kodi_db.addCountries(movieid, countries, "movie") self.kodi_db.addCountries(movieid, countries, "movie")
# Process cast # Process cast
people = API.getPeopleList() people = API.getPeopleList()
self.kodi_db.addPeople(movieid, people, "movie") self.kodi_db.addPeople(movieid, people, "movie")
@ -531,7 +531,7 @@ class Movies(Items):
tags.append("Favorite movies") tags.append("Favorite movies")
self.kodi_db.addTags(movieid, tags, "movie") self.kodi_db.addTags(movieid, tags, "movie")
# Process playstates # Process playstates
kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) self.kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed)
def remove(self, itemid): def remove(self, itemid):
# Remove movieid, fileid, emby reference # Remove movieid, fileid, emby reference
@ -600,7 +600,7 @@ class MusicVideos(Items):
kodicursor = self.kodicursor kodicursor = self.kodicursor
emby_db = self.emby_db emby_db = self.emby_db
artwork = self.artwork artwork = self.artwork
API = api.API(item) API = PlexAPI.API(item)
# 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
@ -1039,7 +1039,7 @@ class TVShows(Items):
path = "%s%s/" % (toplevelpath, itemid) path = "%s%s/" % (toplevelpath, itemid)
# Add top path # Add top path
toppathid = kodi_db.addPath(toplevelpath) toppathid = self.kodi_db.addPath(toplevelpath)
# UPDATE THE TVSHOW ##### # UPDATE THE TVSHOW #####
if update_item: if update_item:
self.logMsg("UPDATE tvshow itemid: %s - Title: %s" % (itemid, title), 1) self.logMsg("UPDATE tvshow itemid: %s - Title: %s" % (itemid, title), 1)
@ -1160,7 +1160,7 @@ class TVShows(Items):
% (itemid), -1) % (itemid), -1)
return return
seasonid = kodi_db.addSeason(showid, seasonnum) seasonid = self.kodi_db.addSeason(showid, seasonnum)
checksum = API.getChecksum() checksum = API.getChecksum()
# Check whether Season already exists # Check whether Season already exists
update_item = True update_item = True
@ -1320,7 +1320,7 @@ class TVShows(Items):
# Network share # Network share
filename = playurl.rsplit("/", 1)[1] filename = playurl.rsplit("/", 1)[1]
path = playurl.replace(filename, "") path = playurl.replace(filename, "")
parentPathId = kodi_db.getParentPathId(path) parentPathId = self.kodi_db.getParentPathId(path)
if doIndirect: if doIndirect:
# Set plugin path and media flags using real filename # Set plugin path and media flags using real filename
if playurl is not None: if playurl is not None:
@ -1339,13 +1339,13 @@ class TVShows(Items):
} }
filename = "%s?%s" % (path, urllib.urlencode(params)) filename = "%s?%s" % (path, urllib.urlencode(params))
playurl = filename playurl = filename
parentPathId = kodi_db.addPath( parentPathId = self.kodi_db.addPath(
'plugin://plugin.video.plexkodiconnect.tvshows/') 'plugin://plugin.video.plexkodiconnect.tvshows/')
# Even if the item is only updated, the file may have been moved or updated. # Even if the item is only updated, the file may have been moved or updated.
# In the worst case we get exactly the same values as we had before. # In the worst case we get exactly the same values as we had before.
pathid = kodi_db.addPath(path) pathid = self.kodi_db.addPath(path)
fileid = kodi_db.addFile(filename, pathid) fileid = self.kodi_db.addFile(filename, pathid)
# episodes table: # episodes table:
# c18 - playurl # c18 - playurl

View file

@ -71,7 +71,7 @@ class PlaybackUtils():
xml = downloadutils.DownloadUtils().downloadUrl( xml = downloadutils.DownloadUtils().downloadUrl(
'{server}%s' % item[0][0][0].attrib.get('key')) '{server}%s' % item[0][0][0].attrib.get('key'))
if xml in (None, 401): if xml in (None, 401):
log('Could not download %s' self.logMsg('Could not download %s'
% item[0][0][0].attrib.get('key'), -1) % item[0][0][0].attrib.get('key'), -1)
return xbmcplugin.setResolvedUrl( return xbmcplugin.setResolvedUrl(
int(sys.argv[1]), False, listitem) int(sys.argv[1]), False, listitem)
@ -101,7 +101,7 @@ class PlaybackUtils():
dummyPlaylist = False dummyPlaylist = False
self.logMsg("Playlist start position: %s" % startPos, 2) self.logMsg("Playlist start position: %s" % startPos, 2)
self.logMsg("Playlist plugin position: %s" % currentPosition, 2) self.logMsg("Playlist plugin position: %s" % self.currentPosition, 2)
self.logMsg("Playlist size: %s" % sizePlaylist, 2) self.logMsg("Playlist size: %s" % sizePlaylist, 2)
############### RESUME POINT ################ ############### RESUME POINT ################
@ -144,7 +144,7 @@ class PlaybackUtils():
if homeScreen and not seektime and not sizePlaylist: if homeScreen and not seektime and not sizePlaylist:
# Extend our current playlist with the actual item to play # Extend our current playlist with the actual item to play
# only if there's no playlist first # only if there's no playlist first
log("Adding main item to playlist.", 1) self.logMsg("Adding main item to playlist.", 1)
self.pl.addtoPlaylist( self.pl.addtoPlaylist(
dbid, dbid,
PF.GetKodiTypeFromPlex(API.getType())) PF.GetKodiTypeFromPlex(API.getType()))
@ -165,7 +165,7 @@ class PlaybackUtils():
additionalListItem = xbmcgui.ListItem() additionalListItem = xbmcgui.ListItem()
additionalPlayurl = playutils.getPlayUrl( additionalPlayurl = playutils.getPlayUrl(
partNumber=counter) partNumber=counter)
log("Adding additional part: %s" % counter, 1) self.logMsg("Adding additional part: %s" % counter, 1)
self.setProperties(additionalPlayurl, additionalListItem) self.setProperties(additionalPlayurl, additionalListItem)
self.setArtwork(additionalListItem) self.setArtwork(additionalListItem)

View file

@ -216,8 +216,6 @@ class Player(xbmc.Player):
try: try:
runtime = int(runtime) runtime = int(runtime)
except ValueError: except ValueError:
runtime = xbmcplayer.getTotalTime()
log("Runtime is missing, Kodi runtime: %s" % runtime, 1)
runtime = self.xbmcplayer.getTotalTime() runtime = self.xbmcplayer.getTotalTime()
self.logMsg("Runtime is missing, Kodi runtime: %s" % runtime, 1) self.logMsg("Runtime is missing, Kodi runtime: %s" % runtime, 1)
@ -241,7 +239,7 @@ class Player(xbmc.Player):
} }
self.played_info[currentFile] = data self.played_info[currentFile] = data
log("ADDING_FILE: %s" % self.played_info, 1) self.logMsg("ADDING_FILE: %s" % self.played_info, 1)
# log some playback stats # log some playback stats
'''if(itemType != None): '''if(itemType != None):
@ -265,8 +263,6 @@ class Player(xbmc.Player):
self.logMsg("reportPlayback Called", 2) self.logMsg("reportPlayback Called", 2)
log("reportPlayback Called", 2)
# Get current file # Get current file
currentFile = self.currentFile currentFile = self.currentFile
data = self.played_info.get(currentFile) data = self.played_info.get(currentFile)
@ -441,7 +437,7 @@ class Player(xbmc.Player):
# Will be called when user stops xbmc playing a file # Will be called when user stops xbmc playing a file
window = utils.window window = utils.window
log("ONPLAYBACK_STOPPED", 1) self.logMsg("ONPLAYBACK_STOPPED", 1)
self.stopAll() self.stopAll()
@ -449,7 +445,7 @@ class Player(xbmc.Player):
window('emby_customPlaylist', clear=True) window('emby_customPlaylist', clear=True)
window('emby_customPlaylist.seektime', clear=True) window('emby_customPlaylist.seektime', clear=True)
window('emby_customPlaylist.seektime', clear=True) window('emby_customPlaylist.seektime', clear=True)
log("Clear playlist properties.", 1) self.logMsg("Clear playlist properties.", 1)
def onPlayBackEnded(self): def onPlayBackEnded(self):
# Will be called when xbmc stops playing a file, because the file ended # Will be called when xbmc stops playing a file, because the file ended
@ -520,8 +516,8 @@ class Player(xbmc.Player):
continue continue
url = "{server}/emby/Items/%s?format=json" % itemid url = "{server}/emby/Items/%s?format=json" % itemid
log("Deleting request: %s" % itemid, 1) self.logMsg("Deleting request: %s" % itemid, 1)
doUtils(url, action_type="DELETE") self.doUtils(url, action_type="DELETE")
self.stopPlayback(data) self.stopPlayback(data)
# Clean the WINDOW properties # Clean the WINDOW properties
@ -541,8 +537,8 @@ class Player(xbmc.Player):
# Stop transcoding # Stop transcoding
if playMethod == "Transcode": if playMethod == "Transcode":
log("Transcoding for %s terminating" % itemid, 1) self.logMsg("Transcoding for %s terminating" % itemid, 1)
doUtils( self.doUtils(
"{server}/video/:/transcode/universal/stop", "{server}/video/:/transcode/universal/stop",
parameters={'session': self.clientInfo.getDeviceId()}) parameters={'session': self.clientInfo.getDeviceId()})

View file

@ -55,17 +55,19 @@ class Playlist():
mediatype = embydb_item[4] mediatype = embydb_item[4]
except TypeError: except TypeError:
# Item is not found in our database, add item manually # Item is not found in our database, add item manually
log("Item was not found in the database, manually adding item.", 1) self.logMsg("Item was not found in the database, manually "
"adding item.", 1)
item = PlexFunctions.GetPlexMetadata(itemid) item = PlexFunctions.GetPlexMetadata(itemid)
if item is None or item == 401: if item is None or item == 401:
log('Could not download itemid %s' % itemid, -1) self.logMsg('Could not download itemid %s'
% itemid, -1)
else: else:
self.addtoPlaylist_xbmc(playlist, item) self.addtoPlaylist_xbmc(playlist, item)
else: else:
# Add to playlist # Add to playlist
self.addtoPlaylist(dbid, mediatype) self.addtoPlaylist(dbid, mediatype)
log("Adding %s to playlist." % itemid, 1) self.logMsg("Adding %s to playlist." % itemid, 1)
if not started: if not started:
started = True started = True

View file

@ -189,8 +189,6 @@ class PlayUtils():
if utils.settings('playType') == "2": if utils.settings('playType') == "2":
# User forcing to play via HTTP # User forcing to play via HTTP
self.logMsg("User chose to transcode", 1) self.logMsg("User chose to transcode", 1)
self.logMsg("Resolution is: %sP, transcode for resolution: %sP+"
canDirectStream = self.item['MediaSources'][0]['SupportsDirectStream']
return False return False
if self.h265enabled(): if self.h265enabled():
return False return False
@ -201,25 +199,6 @@ class PlayUtils():
return False return False
return True return True
def directStream(self):
server = self.server
itemid = self.API.getRatingKey()
type = self.API.getType()
# if 'Path' in item and item['Path'].endswith('.strm'):
# # Allow strm loading when direct streaming
# playurl = self.directPlay()
if type == "Audio":
playurl = "%s/emby/Audio/%s/stream.mp3" % (server, itemid)
else:
playurl = "%s/emby/Videos/%s/stream?static=true" % (server, itemid)
playurl = "{server}/player/playback/playMedia?key=%2Flibrary%2Fmetadata%2F%s&offset=0&X-Plex-Client-Identifier={clientId}&machineIdentifier={SERVER ID}&address={SERVER IP}&port={SERVER PORT}&protocol=http&path=http%3A%2F%2F{SERVER IP}%3A{SERVER PORT}%2Flibrary%2Fmetadata%2F{MEDIA ID}" % (itemid)
playurl = self.API.replaceURLtags()
return playurl
def isNetworkSufficient(self): def isNetworkSufficient(self):
""" """
Returns True if the network is sufficient (set in file settings) Returns True if the network is sufficient (set in file settings)
@ -244,24 +223,6 @@ class PlayUtils():
return True return True
def transcoding(self):
if 'Path' in self.item and self.item['Path'].endswith('.strm'):
# Allow strm loading when transcoding
playurl = self.directPlay()
else:
itemid = self.item['Id']
deviceId = self.clientInfo.getDeviceId()
playurl = (
"%s/emby/Videos/%s/master.m3u8?MediaSourceId=%s"
% (self.server, itemid, itemid)
)
playurl = (
"%s&VideoCodec=h264&AudioCodec=ac3&MaxAudioChannels=6&deviceId=%s&VideoBitrate=%s"
% (playurl, deviceId, self.getBitrate()*1000))
return playurl
def getBitrate(self): def getBitrate(self):
# get the addon video quality # get the addon video quality
videoQuality = utils.settings('transcoderVideoQualities') videoQuality = utils.settings('transcoderVideoQualities')

View file

@ -126,7 +126,7 @@ class UserClient(threading.Thread):
url = "{server}/emby/Users?format=json" url = "{server}/emby/Users?format=json"
result = self.doUtils.downloadUrl(url) result = self.doUtils.downloadUrl(url)
if result == False: if result is False:
# Access is restricted, set in downloadutils.py via exception # Access is restricted, set in downloadutils.py via exception
log("Access is restricted.", 1) log("Access is restricted.", 1)
self.HasAccess = False self.HasAccess = False

View file

@ -356,7 +356,6 @@ def getKodiVideoDBPath():
"14": 90, # Helix "14": 90, # Helix
"15": 93, # Isengard "15": 93, # Isengard
"16": 99, # Jarvis "16": 99, # Jarvis
"17":104 # Krypton
"17": 104 # Krypton "17": 104 # Krypton
} }