mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Add option to ask to play trailers
This commit is contained in:
parent
22b62133eb
commit
1893e79014
2 changed files with 28 additions and 17 deletions
|
@ -125,25 +125,35 @@ class PlaybackUtils():
|
||||||
|
|
||||||
if utils.settings('disableCinema') == "false" and not seekTime:
|
if utils.settings('disableCinema') == "false" and not seekTime:
|
||||||
# if we have any play them when the movie/show is not being resumed
|
# if we have any play them when the movie/show is not being resumed
|
||||||
url = "{server}/mediabrowser/Users/{UserId}/Items/%s/Intros?format=json&ImageTypeLimit=1&Fields=Etag" % id
|
getTrailers = True
|
||||||
intros = doUtils.downloadUrl(url)
|
|
||||||
|
|
||||||
if intros['TotalRecordCount'] != 0:
|
if utils.settings('askCinema') == "true":
|
||||||
for intro in intros['Items']:
|
resp = xbmcgui.Dialog().yesno("Emby Cinema Mode", "Play trailers?")
|
||||||
# The server randomly returns intros, process them.
|
if not resp:
|
||||||
introId = intro['Id']
|
# User selected to not play trailers
|
||||||
|
getTrailers = False
|
||||||
introPlayurl = PlayUtils().getPlayUrl(server, introId, intro)
|
self.logMsg("Skip trailers.", 1)
|
||||||
introListItem = xbmcgui.ListItem()
|
|
||||||
self.logMsg("Adding Intro: %s" % introPlayurl, 1)
|
|
||||||
|
|
||||||
# Set listitem and properties for intros
|
if getTrailers:
|
||||||
self.setProperties(introPlayurl, intro, introListItem)
|
url = "{server}/mediabrowser/Users/{UserId}/Items/%s/Intros?format=json&ImageTypeLimit=1&Fields=Etag" % id
|
||||||
self.setListItemProps(server, introId, introListItem, intro)
|
intros = doUtils.downloadUrl(url)
|
||||||
|
|
||||||
playlist.add(introPlayurl, introListItem, index=currentPosition)
|
if intros['TotalRecordCount'] != 0:
|
||||||
introsPlaylist = True
|
for intro in intros['Items']:
|
||||||
currentPosition += 1
|
# The server randomly returns intros, process them.
|
||||||
|
introId = intro['Id']
|
||||||
|
|
||||||
|
introPlayurl = PlayUtils().getPlayUrl(server, introId, intro)
|
||||||
|
introListItem = xbmcgui.ListItem()
|
||||||
|
self.logMsg("Adding Intro: %s" % introPlayurl, 1)
|
||||||
|
|
||||||
|
# Set listitem and properties for intros
|
||||||
|
self.setProperties(introPlayurl, intro, introListItem)
|
||||||
|
self.setListItemProps(server, introId, introListItem, intro)
|
||||||
|
|
||||||
|
playlist.add(introPlayurl, introListItem, index=currentPosition)
|
||||||
|
introsPlaylist = True
|
||||||
|
currentPosition += 1
|
||||||
|
|
||||||
|
|
||||||
############### -- ADD MAIN ITEM ONLY FOR HOMESCREEN ###############
|
############### -- ADD MAIN ITEM ONLY FOR HOMESCREEN ###############
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
|
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
|
||||||
<setting type="sep" />
|
<setting type="sep" />
|
||||||
<setting id="disableCinema" type="bool" label="Disable Emby cinema mode" default="false" visible="true" enable="true" />
|
<setting id="disableCinema" type="bool" label="Disable Emby cinema mode" default="false" visible="true" enable="true" />
|
||||||
|
<setting id="askCinema" type="bool" label="Ask to play trailers" default="false" visible="eq(-1,false)" enable="true" subsetting="true" />
|
||||||
<setting id="offerDelete" type="bool" label="30114" visible="true" enable="true" default="false" />
|
<setting id="offerDelete" type="bool" label="30114" visible="true" enable="true" default="false" />
|
||||||
<setting id="offerDeleteTV" type="bool" label="30115" visible="eq(-1,true)" enable="true" default="false" subsetting="true" />
|
<setting id="offerDeleteTV" type="bool" label="30115" visible="eq(-1,true)" enable="true" default="false" subsetting="true" />
|
||||||
<setting id="offerDeleteMovies" type="bool" label="30116" visible="eq(-2,true)" enable="true" default="false" subsetting="true" />
|
<setting id="offerDeleteMovies" type="bool" label="30116" visible="eq(-2,true)" enable="true" default="false" subsetting="true" />
|
||||||
|
|
Loading…
Reference in a new issue