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

View File

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

View File

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

View File

@ -55,17 +55,19 @@ class Playlist():
mediatype = embydb_item[4]
except TypeError:
# 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)
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:
self.addtoPlaylist_xbmc(playlist, item)
else:
# Add to playlist
self.addtoPlaylist(dbid, mediatype)
log("Adding %s to playlist." % itemid, 1)
self.logMsg("Adding %s to playlist." % itemid, 1)
if not started:
started = True
@ -103,7 +105,7 @@ class Playlist():
self.verifyPlaylist()
embycursor.close()
return playlist
def addtoPlaylist(self, dbid=None, mediatype=None, url=None):
pl = {

View File

@ -189,8 +189,6 @@ class PlayUtils():
if utils.settings('playType') == "2":
# User forcing to play via HTTP
self.logMsg("User chose to transcode", 1)
self.logMsg("Resolution is: %sP, transcode for resolution: %sP+"
canDirectStream = self.item['MediaSources'][0]['SupportsDirectStream']
return False
if self.h265enabled():
return False
@ -201,25 +199,6 @@ class PlayUtils():
return False
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):
"""
Returns True if the network is sufficient (set in file settings)
@ -244,24 +223,6 @@ class PlayUtils():
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):
# get the addon video quality
videoQuality = utils.settings('transcoderVideoQualities')

View File

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

View File

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