Skip to content
Browse files

Merge pull request #92 from MartinWallgren/907fb4b4a8c9f000400e5fedbd…

…007e5e735d530a

Show an icon for subtitles that have close captions for the hearing impaired.
  • Loading branch information...
2 parents 7029d98 + 907fb4b commit 02eddf90bf7e7ca4b09f1e99a474601e41229d26 @amet committed Apr 15, 2012
View
5 script.xbmc.subtitles/resources/lib/gui.py
@@ -277,6 +277,11 @@ def Search_Subtitles( self, gui = True ):
listitem.setProperty( "sync", "true" )
else:
listitem.setProperty( "sync", "false" )
+
+ if item.get("hearing_imp", False):
+ listitem.setProperty( "hearing_imp", "true" )
+ else:
+ listitem.setProperty( "hearing_imp", "false" )
self.list.append(subscounter)
subscounter = subscounter + 1
self.getControl( SUBTITLES_LIST ).addItem( listitem )
View
4 script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
@@ -66,7 +66,9 @@ def searchsubtitles( self, srch_string , lang1,lang2,lang3,hash_search, _hash =
else:
sync = False
- self.subtitles_hash_list.append({'lang_index':lang_index,'filename':item["SubFileName"],'link':item["ZipDownloadLink"],"language_name":item["LanguageName"],"language_flag":flag_image,"language_id":item["SubLanguageID"],"ID":item["IDSubtitle"],"rating":str( int( item["SubRating"][0] ) ),"format":item["SubFormat"],"sync":sync})
+ hearing_imp = int(item["SubHearingImpaired"]) != 0
+
+ self.subtitles_hash_list.append({'lang_index':lang_index,'filename':item["SubFileName"],'link':item["ZipDownloadLink"],"language_name":item["LanguageName"],"language_flag":flag_image,"language_id":item["SubLanguageID"],"ID":item["IDSubtitle"],"rating":str( int( item["SubRating"][0] ) ),"format":item["SubFormat"],"sync":sync, "hearing_imp":hearing_imp})
except:
msg = "Error Searching For Subs"
View
6 script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
@@ -95,7 +95,7 @@ def searchsubtitles_pod( self, movie_hash, lang1,lang2,lang3, stack):
sync1 = False
else:
sync1 = True
- self.subtitles_hash_list.append({'filename':name,'link':link,"language_name":languageTranslate((item["lang"]),2,0),"language_flag":flag_image,"language_id":item["lang"],"ID":item["id"],"sync":sync1, "format":"srt", "rating": str(int(item['rating'])*2) })
+ self.subtitles_hash_list.append({'filename':name,'link':link,"language_name":languageTranslate((item["lang"]),2,0),"language_flag":flag_image,"language_id":item["lang"],"ID":item["id"],"sync":sync1, "format":"srt", "rating": str(int(item['rating'])*2)})
self.mergesubtitles(stack)
return self.subtitles_list,pod_session
except :
@@ -157,11 +157,13 @@ def searchsubtitlesbyname_pod( self, name, tvshow, season, episode, lang1, lang2
lang_name = languageTranslate(subtitle.getElementsByTagName("languageId")[0].firstChild.data, 1,2)
if subtitle.getElementsByTagName("id")[0].firstChild:
subtitle_id = subtitle.getElementsByTagName("id")[0].firstChild.data
+ if subtitle.getElementsByTagName("flags")[0].firstChild:
+ hearing_imp = "n" in subtitle.getElementsByTagName("flags")[0].firstChild.data
flag_image = "flags/%s.gif" % ( lang_name, )
link = str(subtitle_id)
if subtitle.getElementsByTagName("cds")[0].firstChild:
no_files = int(subtitle.getElementsByTagName("cds")[0].firstChild.data)
- self.subtitles_name_list.append({'filename':filename,'link':link,'language_name':languageTranslate((lang_name),2,0),'language_id':lang_id,'language_flag':flag_image,'movie':movie,"ID":subtitle_id,"rating":str(rating),"format":format,"sync":False, "no_files":no_files})
+ self.subtitles_name_list.append({'filename':filename,'link':link,'language_name':languageTranslate((lang_name),2,0),'language_id':lang_id,'language_flag':flag_image,'movie':movie,"ID":subtitle_id,"rating":str(rating),"format":format,"sync":False, "no_files":no_files, "hearing_imp":hearing_imp})
self.mergesubtitles(stack)
return self.subtitles_list
except :
View
24 script.xbmc.subtitles/resources/skins/Default/720p/script-XBMC-Subtitles-main.xml
@@ -156,15 +156,23 @@
<control type="image">
<posx>135</posx>
<posy>13</posy>
+ <width>20</width>
+ <height>12</height>
+ <texture>icon_close_caption.png</texture>
+ <visible>ListItem.property(hearing_imp)</visible>
+ </control>
+ <control type="image">
+ <posx>160</posx>
+ <posy>13</posy>
<width>40</width>
<height>12</height>
<texture>icon_sync.png</texture>
<visible>ListItem.property(sync)</visible>
</control>
<control type="label">
- <posx>180</posx>
+ <posx>205</posx>
<posy>0</posy>
- <width>520</width>
+ <width>495</width>
<height>38</height>
<font>font18</font>
<aligny>center</aligny>
@@ -219,15 +227,23 @@
<control type="image">
<posx>135</posx>
<posy>13</posy>
+ <width>20</width>
+ <height>12</height>
+ <texture>icon_close_caption.png</texture>
+ <visible>ListItem.property(hearing_imp)</visible>
+ </control>
+ <control type="image">
+ <posx>160</posx>
+ <posy>13</posy>
<width>40</width>
<height>12</height>
<texture>icon_sync.png</texture>
<visible>ListItem.property(sync)</visible>
</control>
<control type="label">
- <posx>180</posx>
+ <posx>205</posx>
<posy>0</posy>
- <width>520</width>
+ <width>495</width>
<height>38</height>
<font>font18</font>
<aligny>center</aligny>
View
BIN script.xbmc.subtitles/resources/skins/Default/media/icon_close_caption.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 02eddf9

Please sign in to comment.
Something went wrong with that request. Please try again.