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

View file

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

View file

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