add option to play cinema intros

This commit is contained in:
faush01 2020-06-28 12:25:46 +10:00
parent ef5714e5d2
commit 21a5a260e7
4 changed files with 53 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.embycon"
name="EmbyCon"
version="1.9.95"
version="1.9.96"
provider-name="Team B">
<requires>
<import addon="xbmc.python" version="2.25.0"/>

View File

@ -247,7 +247,7 @@ msgid "HTTP direct stream"
msgstr ""
msgctxt "#30211"
msgid "HTTP transcode"
msgid "Transcode options"
msgstr ""
msgctxt "#30212"
@ -319,7 +319,7 @@ msgid "Start from beginning"
msgstr ""
msgctxt "#30238"
msgid "Playback Options"
msgid "Playback stream options"
msgstr ""
msgctxt "#30239"
@ -1057,3 +1057,11 @@ msgstr ""
msgctxt "#30436"
msgid "Speed test data size (MB)"
msgstr ""
msgctxt "#30437"
msgid "Playback options"
msgstr ""
msgctxt "#30438"
msgid "Play cinema intros"
msgstr ""

View File

@ -27,7 +27,7 @@ log = SimpleLogging(__name__)
download_utils = DownloadUtils()
def play_all_files(items, monitor):
def play_all_files(items, monitor, play_items=True):
log.debug("playAllFiles called with items: {0}", items)
server = download_utils.get_server()
@ -95,7 +95,11 @@ def play_all_files(items, monitor):
playlist.add(playurl, list_item)
xbmc.Player().play(playlist)
if play_items:
xbmc.Player().play(playlist)
return None
else:
return playlist
def play_list_of_items(id_list, monitor):
@ -191,6 +195,24 @@ def add_to_playlist(play_info, monitor):
playlist.add(playurl, list_item)
def get_playback_intros(item_id):
log.debug("get_playback_intros")
data_manager = DataManager()
url = "{server}/emby/Users/{userid}/Items/%s/Intros" % item_id
intro_items = data_manager.get_content(url)
if intro_items is None:
log.debug("get_playback_intros failed!")
return
into_list = []
intro_items = intro_items["Items"]
for into in intro_items:
into_list.append(into)
return into_list
@timer
def play_file(play_info, monitor):
item_id = play_info.get("item_id")
@ -221,6 +243,7 @@ def play_file(play_info, monitor):
addon_path = settings.getAddonInfo('path')
force_auto_resume = settings.getSetting('forceAutoResume') == 'true'
jump_back_amount = int(settings.getSetting("jump_back_amount"))
play_cinema_intros = settings.getSetting('play_cinema_intros') == 'true'
server = download_utils.get_server()
@ -428,9 +451,19 @@ def play_file(play_info, monitor):
list_item = set_list_item_props(item_id, list_item, result, server, listitem_props, item_title)
player = xbmc.Player()
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
playlist.add(playurl, list_item)
intro_items = []
if play_cinema_intros and seek_time == 0:
intro_items = get_playback_intros(item_id)
if len(intro_items) > 0:
playlist = play_all_files(intro_items, monitor, play_items=False)
playlist.add(playurl, list_item)
else:
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
playlist.add(playurl, list_item)
player.play(playlist)
if seek_time != 0:

View File

@ -20,6 +20,10 @@
</category>
<category label="30207">
<setting label="30437" type="lsep"/>
<setting type="sep" />
<setting id="play_cinema_intros" type="bool" label="30438" default="false" visible="true" enable="true" />
<!--<setting id="playback_type" type="select" label="30206" lvalues="30209|30210|30211" default="1" />-->
<setting label="30238" type="lsep"/>