New setting to force transcode all Plex images

This commit is contained in:
tomkat83 2017-01-15 18:01:27 +01:00
parent ccaeca0019
commit 8680410ab2
8 changed files with 48 additions and 18 deletions

View file

@ -319,6 +319,7 @@
<string id="30542">Always pick best quality for trailers</string> <string id="30542">Always pick best quality for trailers</string>
<string id="30543">Kodi runs on a low-power device (e.g. Raspberry Pi)</string> <string id="30543">Kodi runs on a low-power device (e.g. Raspberry Pi)</string>
<string id="30544">Artwork</string> <string id="30544">Artwork</string>
<string id="30545">Force transcode pictures</string>
<!-- service add-on --> <!-- service add-on -->
<string id="33000">Welcome</string> <string id="33000">Welcome</string>

View file

@ -36,6 +36,7 @@
<string id="30542">Trailer immer in der besten Qualität abspielen</string> <string id="30542">Trailer immer in der besten Qualität abspielen</string>
<string id="30543">Kodi läuft auf langsamer Hardware (z.B. Raspberry Pi)</string> <string id="30543">Kodi läuft auf langsamer Hardware (z.B. Raspberry Pi)</string>
<string id="30544">Artwork</string> <string id="30544">Artwork</string>
<string id="30545">Bilder immer transkodieren</string>
<string id="30014">Verbindung</string> <string id="30014">Verbindung</string>
<string id="30015">Netzwerk</string> <string id="30015">Netzwerk</string>

View file

@ -51,7 +51,7 @@ from utils import window, settings, language as lang, tryDecode, tryEncode, \
DateToKodi, KODILANGUAGE DateToKodi, KODILANGUAGE
from PlexFunctions import PLEX_TO_KODI_TIMEFACTOR, PMSHttpsEnabled, \ from PlexFunctions import PLEX_TO_KODI_TIMEFACTOR, PMSHttpsEnabled, \
REMAP_TYPE_FROM_PLEXTYPE, PLEX_TYPE_MOVIE, PLEX_TYPE_SHOW, \ REMAP_TYPE_FROM_PLEXTYPE, PLEX_TYPE_MOVIE, PLEX_TYPE_SHOW, \
PLEX_TYPE_EPISODE PLEX_TYPE_EPISODE, KODI_SUPPORTED_IMAGES
import plexdb_functions as plexdb import plexdb_functions as plexdb
############################################################################### ###############################################################################
@ -2359,15 +2359,21 @@ class API():
else: else:
listItem.setLabel(title) listItem.setLabel(title)
listItem.setProperty('IsPlayable', 'true') listItem.setProperty('IsPlayable', 'true')
if settings('useDirectPaths') == '0': extension = self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower()
# Addon paths if (window('plex_force_transcode_pix') == 'true' or
if not self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower() in ('.bmp', '.jpg', '.jpeg', '.gif', '.png', '.tiff', '.mng', '.ico', '.pcx', '.tga'): extension not in KODI_SUPPORTED_IMAGES):
# Check if Kodi supports the file, if not transcode it by Plex # Let Plex transcode
# extensions from: http://kodi.wiki/view/Features_and_supported_codecs#Format_support (RAW image formats, BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX and Targa/TGA)
path = str(self.server) + str(PlexAPI().getTranscodeImagePath(self.item[0][0].attrib.get('key'), window('pms_token'), "%s%s" % (self.server, self.item[0][0].attrib.get('key')), 1920, 1080))
# max width/height supported by plex image transcoder is 1920x1080 # max width/height supported by plex image transcoder is 1920x1080
path = self.server + PlexAPI().getTranscodeImagePath(
self.item[0][0].attrib.get('key'),
window('pms_token'),
"%s%s" % (self.server, self.item[0][0].attrib.get('key')),
1920,
1080)
else: else:
# Just give the path of the file to Kodi # Don't transcode
if settings('useDirectPaths') == '0':
# Addon Mode. Just give the path of the file to Kodi
path = self.addPlexCredentialsToUrl( path = self.addPlexCredentialsToUrl(
'%s%s' % (window('pms_server'), '%s%s' % (window('pms_server'),
self.item[0][0].attrib['key'])) self.item[0][0].attrib['key']))
@ -2376,6 +2382,7 @@ class API():
path = self.validatePlayurl( path = self.validatePlayurl(
self.getFilePath(forceFirstMediaStream=True), self.getFilePath(forceFirstMediaStream=True),
'photo') 'photo')
path = tryEncode(path) path = tryEncode(path)
metadata = { metadata = {
'date': self.GetKodiPremierDate(), 'date': self.GetKodiPremierDate(),

View file

@ -147,6 +147,23 @@ REMAP_TYPE_FROM_PLEXTYPE = {
} }
# extensions from:
# http://kodi.wiki/view/Features_and_supported_codecs#Format_support (RAW image
# formats, BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX and Targa/TGA)
KODI_SUPPORTED_IMAGES = (
'.bmp',
'.jpg',
'.jpeg',
'.gif',
'.png',
'.tiff',
'.mng',
'.ico',
'.pcx',
'.tga'
)
def ConvertPlexToKodiTime(plexTime): def ConvertPlexToKodiTime(plexTime):
""" """
Converts Plextime to Koditime. Returns an int (in seconds). Converts Plextime to Koditime. Returns an int (in seconds).

View file

@ -53,6 +53,7 @@ class KodiMonitor(Monitor):
'dbSyncIndicator': 'dbSyncIndicator', 'dbSyncIndicator': 'dbSyncIndicator',
'remapSMB': 'remapSMB', 'remapSMB': 'remapSMB',
'replaceSMB': 'replaceSMB', 'replaceSMB': 'replaceSMB',
'force_transcode_pix': 'plex_force_transcode_pix'
} }
# Path replacement # Path replacement
for typus in REMAP_TYPE_FROM_PLEXTYPE.values(): for typus in REMAP_TYPE_FROM_PLEXTYPE.values():

View file

@ -180,6 +180,8 @@ class UserClient(threading.Thread):
window('useDirectPaths', value='true' window('useDirectPaths', value='true'
if settings('useDirectPaths') == "1" else 'false') if settings('useDirectPaths') == "1" else 'false')
window('plex_force_transcode_pix', value='true'
if settings('force_transcode_pix') == "1" else 'false')
# Start DownloadUtils session # Start DownloadUtils session
doUtils.startSession(reset=True) doUtils.startSession(reset=True)

View file

@ -108,6 +108,7 @@
<setting id="networkCreds" type="text" visible="false" default="" /> <setting id="networkCreds" type="text" visible="false" default="" />
<setting id="bestQuality" type="bool" label="30541" default="false" /> <setting id="bestQuality" type="bool" label="30541" default="false" />
<setting id="bestTrailer" type="bool" label="30542" default="true" /> <setting id="bestTrailer" type="bool" label="30542" default="true" />
<setting id="force_transcode_pix" type="bool" label="30545" default="false" />
</category> </category>
<category label="30544"><!-- artwork --> <category label="30544"><!-- artwork -->

View file

@ -113,7 +113,7 @@ class Service():
"suspend_LibraryThread", "plex_terminateNow", "suspend_LibraryThread", "plex_terminateNow",
"kodiplextimeoffset", "countError", "countUnauthorized", "kodiplextimeoffset", "countError", "countUnauthorized",
"plex_restricteduser", "plex_allows_mediaDeletion", "plex_restricteduser", "plex_allows_mediaDeletion",
"plex_play_new_item", "plex_result" "plex_play_new_item", "plex_result", "plex_force_transcode_pix"
] ]
for prop in properties: for prop in properties:
window(prop, clear=True) window(prop, clear=True)