diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po
index 7ab8955d..ab88a1ee 100644
--- a/resources/language/resource.language.en_gb/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -464,6 +464,11 @@ msgctxt "#30513"
msgid "Limit artwork cache threads (recommended for rpi)"
msgstr ""
+# PKC Settings - Sync Options
+msgctxt "#30514"
+msgid "Show all Plex extras instead of immediately playing trailers"
+msgstr ""
+
# PKC Settings - Sync Options
msgctxt "#30515"
msgid "Maximum items to request from the server at once"
diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py
index 08e8b0ba..ee077fa3 100644
--- a/resources/lib/kodimonitor.py
+++ b/resources/lib/kodimonitor.py
@@ -52,7 +52,8 @@ STATE_SETTINGS = {
'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER',
'imageSyncNotifications': 'IMAGE_SYNC_NOTIFICATIONS',
'syncSpecificPlexPlaylists': 'SYNC_SPECIFIC_PLEX_PLAYLISTS',
- 'syncSpecificKodiPlaylists': 'SYNC_SPECIFIC_KODI_PLAYLISTS'
+ 'syncSpecificKodiPlaylists': 'SYNC_SPECIFIC_KODI_PLAYLISTS',
+ 'showExtrasInsteadOfTrailer': 'SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER'
}
###############################################################################
diff --git a/resources/lib/plex_api.py b/resources/lib/plex_api.py
index 7e3e5331..526076d9 100644
--- a/resources/lib/plex_api.py
+++ b/resources/lib/plex_api.py
@@ -743,26 +743,33 @@ class API(object):
def trailers(self):
"""
- Returns the URL for a single trailer, an addon path for extras
- (route_to_extras) if several trailers are present. Or None
+ Returns the URL for a single trailer (local trailer preferred; first
+ trailer found returned) or an add-on path to list all Plex extras
+ if the user setting showExtrasInsteadOfTrailer is set.
+ Returns None if nothing is found.
"""
url = None
- number = 0
for extras in self.item.iterfind('Extras'):
+ # There will always be only 1 extras element
+ if (len(extras) > 0 and
+ state.SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER):
+ return ('plugin://%s?mode=route_to_extras&plex_id=%s'
+ % (v.ADDON_ID, self.plex_id()))
for extra in extras:
try:
typus = int(extra.attrib['extraType'])
except (KeyError, TypeError):
typus = None
if typus != 1:
+ # Skip non-trailers
continue
- number += 1
- url = extra.get('ratingKey')
- if number > 1:
- # Several trailers present. Hence let the user choose
- url = ('plugin://%s?mode=route_to_extras&plex_id=%s'
- % (v.ADDON_ID, self.plex_id()))
- elif url:
+ if extra.get('guid', '').startswith('file:'):
+ url = extra.get('ratingKey')
+ # Always prefer local trailers (first one listed)
+ break
+ elif not url:
+ url = extra.get('ratingKey')
+ if url:
url = ('plugin://%s.movies/?plex_id=%s&plex_type=%s&mode=play'
% (v.ADDON_ID, url, v.PLEX_TYPE_CLIP))
return url
diff --git a/resources/lib/state.py b/resources/lib/state.py
index ced1b486..1887c690 100644
--- a/resources/lib/state.py
+++ b/resources/lib/state.py
@@ -45,6 +45,9 @@ RESTRICTED_USER = False
DIRECT_PATHS = False
# Shall we replace custom user ratings with the number of versions available?
INDICATE_MEDIA_VERSIONS = False
+# Will sync movie trailer differently: either play trailer directly or show
+# all the Plex extras for the user to choose
+SHOW_EXTRAS_INSTEAD_OF_PLAYING_TRAILER = False
# Do we need to run a special library scan?
RUN_LIB_SCAN = None
# Number of items to fetch and display in widgets
diff --git a/resources/settings.xml b/resources/settings.xml
index 76cdef9c..d8728639 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -75,6 +75,7 @@
+