add cc to name is subtitle is available

This commit is contained in:
sfaulds
2017-06-27 11:51:01 +10:00
parent ad1d7acf7f
commit 0e72bb23b2
4 changed files with 17 additions and 5 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.3.9"
version="1.3.10"
provider-name="Team B">
<requires>
<import addon="xbmc.python" version="2.1.0"/>

View File

@@ -226,6 +226,10 @@ msgctxt "#30162"
msgid "Add Season Number"
msgstr ""
msgctxt "#30163"
msgid "Add (cc) if subtitle is available"
msgstr ""
msgctxt "#30166"
msgid "Select Server"
msgstr ""

View File

@@ -319,6 +319,10 @@ def addGUIItem(url, details, extraData, folder=True):
if (countsAdded == False and addResumePercent and details.get('title') != None and cappedPercentage != None):
listItemName = listItemName + " (" + str(cappedPercentage) + "%)"
subtitle_available = settings.getSetting('addSubtitleAvailable') == 'true'
if subtitle_available and extraData.get("SubtitleAvailable", False):
listItemName += " (cc)"
# update title with new name, this sets the new name in the deailts that are later passed to video info
details['title'] = listItemName
@@ -713,9 +717,9 @@ def processDirectory(results, progress, params):
audiocodec = ''
height = ''
width = ''
aspectratio = '1:1'
aspectfloat = 0.0
subtitle_lang = ''
subtitle_available = False
mediaStreams = item.get("MediaStreams")
if (mediaStreams != None):
for mediaStream in mediaStreams:
@@ -724,7 +728,7 @@ def processDirectory(results, progress, params):
height = str(mediaStream.get("Height"))
width = str(mediaStream.get("Width"))
aspectratio = mediaStream.get("AspectRatio")
if aspectratio != None and len(aspectratio) >= 3:
if aspectratio is not None and len(aspectratio) >= 3:
try:
aspectwidth, aspectheight = aspectratio.split(':')
aspectfloat = float(aspectwidth) / float(aspectheight)
@@ -734,7 +738,9 @@ def processDirectory(results, progress, params):
audiocodec = mediaStream.get("Codec")
channels = mediaStream.get("Channels")
if mediaStream.get("Type") == "Subtitle":
subtitle_lang = mediaStream.get("Language")
subtitle_available = True
if mediaStream.get("Language") is not None:
subtitle_lang = mediaStream.get("Language")
# Process People
director = ''
@@ -883,7 +889,8 @@ def processDirectory(results, progress, params):
'UnWatchedEpisodes': str(UnWatchedEpisodes),
'NumEpisodes': str(NumEpisodes),
'itemtype': item_type,
'SubtitleLang': subtitle_lang}
'SubtitleLang': subtitle_lang,
'SubtitleAvailable': subtitle_available}
extraData["Path"] = item.get("Path")

View File

@@ -40,6 +40,7 @@
<setting id="addSeasonNumber" type="bool" label="30162" default="false" visible="true" enable="true" />
<setting id="addEpisodeNumber" type="bool" label="30119" default="true" visible="true" enable="true" />
<setting id="addResumePercent" type="bool" label="30118" default="true" visible="true" enable="true" />
<setting id="addSubtitleAvailable" type="bool" label="30163" default="false" visible="true" enable="true" />
<setting id="include_overview" type="bool" label="30181" default="true" visible="true" enable="true" />
<setting id="include_media" type="bool" label="30182" default="true" visible="true" enable="true" />
<setting id="include_people" type="bool" label="30183" default="false" visible="true" enable="true" />