Skip to content

Commit

Permalink
Merge pull request #92 from MartinWallgren/907fb4b4a8c9f000400e5fedbd…
Browse files Browse the repository at this point in the history
…007e5e735d530a

Show an icon for subtitles that have close captions for the hearing impaired.
  • Loading branch information
Zeljko Ametovic committed Apr 15, 2012
2 parents 7029d98 + 907fb4b commit 02eddf9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
5 changes: 5 additions & 0 deletions script.xbmc.subtitles/resources/lib/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down Expand Up @@ -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 :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Loading
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.