New contextmenu: Force transcode video

This commit is contained in:
tomkat83 2016-11-06 15:37:22 +01:00
parent 2f1b104b41
commit df67b92768
3 changed files with 15 additions and 8 deletions

View File

@ -92,8 +92,8 @@ class ContextMenu(object):
self.item_type in PF.KODI_VIDEOTYPES):
options.append(OPTIONS['PMS_Play'])
# if self.item_type in ("movie", "episode", "song"):
# options.append(OPTIONS['Transcode'])
if self.item_type in PF.KODI_VIDEOTYPES:
options.append(OPTIONS['Transcode'])
# userdata = self.api.getUserData()
# if userdata['Favorite']:
@ -134,7 +134,8 @@ class ContextMenu(object):
selected = self._selected_option
if selected == OPTIONS['Transcode']:
pass
window('plex_forcetranscode', value='true')
self._PMS_play()
elif selected == OPTIONS['PMS_Play']:
self._PMS_play()

View File

@ -305,11 +305,12 @@ class Player(xbmc.Player):
self.stopAll()
window('plex_currently_playing_itemid', clear=True)
window('plex_customplaylist', clear=True)
window('plex_customplaylist.seektime', clear=True)
window('plex_customplaylist.seektime', clear=True)
window('plex_playbackProps', clear=True)
for item in ('plex_currently_playing_itemid',
'plex_customplaylist',
'plex_customplaylist.seektime',
'plex_playbackProps',
'plex_forcetranscode'):
window(item, clear=True)
log.debug("Cleared playlist properties.")
def onPlayBackEnded(self):

View File

@ -155,6 +155,8 @@ class PlayUtils():
- codec is in h265
- 10bit video codec
- HEVC codec
- window variable 'plex_forcetranscode' set to 'true'
(excepting trailers etc.)
if the corresponding file settings are set to 'true'
"""
videoCodec = self.API.getVideoCodec()
@ -171,6 +173,9 @@ class PlayUtils():
# e.g. trailers. Avoids TypeError with "'h265' in codec"
log.info('No codec from PMS, not transcoding.')
return False
if window('plex_forcetranscode') == 'true':
log.info('User chose to force-transcode')
return True
try:
resolution = int(videoCodec['resolution'])
except (TypeError, ValueError):