The branch, eden has been updated
via c9e70560ebe81ed50eb739ceaf48f8aecdb4a9eb (commit)
from 6f886cdf7395d6b46811baa28d0da2133fcd760b (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=c9e70560ebe81ed50eb739ceaf48f8aecdb4a9eb
commit c9e70560ebe81ed50eb739ceaf48f8aecdb4a9eb
Author: amet <[email protected]>
Date: Sun Apr 15 14:14:41 2012 +0400
[script.xbmc.subtitles] -3.0.2
3.0.2
- Added custom useragent for Bierdopje, thx mr-blobby
- Added an alternative method for looking up Bierdopje show id, thx
mr-blobby
- Show icon for hearing impaired, thx Martin Wallgren
- Finnish localization update, thx Troopie
- cosmetics and safety checks
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index c3b084c..d886ef9 100755
--- a/script.xbmc.subtitles/addon.xml
+++ b/script.xbmc.subtitles/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmc.subtitles"
name="XBMC Subtitles"
- version="3.0.1"
+ version="3.0.2"
provider-name="Amet, mr_blobby">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/script.xbmc.subtitles/changelog.txt
b/script.xbmc.subtitles/changelog.txt
index eef68f2..10f8ad5 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,10 @@
+3.0.2
+- Added custom useragent for Bierdopje, thx mr-blobby
+- Added an alternative method for looking up Bierdopje show id, thx mr-blobby
+- Show icon for hearing impaired, thx Martin Wallgren
+- Finnish localization update, thx Troopie
+- cosmetics and safety checks
+
3.0.1
- Fixed argenteam subtitle search, thx Esteban Mendoza
- fix LegendasTV bugs, thx gfjardim
diff --git a/script.xbmc.subtitles/resources/language/Finnish/strings.xml
b/script.xbmc.subtitles/resources/language/Finnish/strings.xml
index 59198b1..7332f7d 100644
--- a/script.xbmc.subtitles/resources/language/Finnish/strings.xml
+++ b/script.xbmc.subtitles/resources/language/Finnish/strings.xml
@@ -11,20 +11,20 @@
<string id="652">Tekstitystiedosto ladattu ja purettu</string>
<string id="653">Yhteys epäonnistui</string>
<string id="654">Virhe tekstitysten purkamisessa</string>
- <string id="655">Local subtitle available</string>
- <string id="656">Service did not respond within the time out limit</string>
- <string id="657">No Subtitles Found!</string>
+ <string id="655">Paikalliset tekstitykset saatavilla</string>
+ <string id="656">Palvelu ei vastannut aikarajaan mennessä</string>
+ <string id="657">Tekstityksiä ei löytynyt!</string>
<string id="744">tekstitystä löydetty kohteelle</string>
- <string id="747">Search Using Parent Folder</string>
- <string id="748">You can't save subtitle to selected destination</string>
- <string id="750">Would you like to activate this subtitle
temporarily?</string>
- <string id="751">Enter Movie Name (year)</string>
- <string id="755">Server is overloaded, please try again later</string>
- <string id="756">Login failed. Please verify your settings at the addon
Configuration</string>
- <string id="757">Server requires you to rewrite code from image</string>
- <string id="758">Please take look at notification area</string>
- <string id="759">Enter code of image in notification area</string>
- <string id="760">Available Services</string>
+ <string id="747">Sisällytä yläkansiot hakuun</string>
+ <string id="748">Et voi tallentaa valittuun hakemistoon</string>
+ <string id="750">Haluatko käyttää tekstitystä tilapäisesti?</string>
+ <string id="751">Syötä elokuvan nimi (vuosi)</string>
+ <string id="755">Palvelimessa on ylikuormaa, yritä hetken päästä
uudelleen</string>
+ <string id="756">Kirjautuminen epäonnistui. Tarkasta asetuksesi lisäosa
asetuksista</string>
+ <string id="757">Palvelin vaatii, että syötät kuvassa olevat
merkit</string>
+ <string id="758">Katso ilmoitusalueelle</string>
+ <string id="759">Syötä ilmoitusalueella olevan kuvan merkit</string>
+ <string id="760">Saatavilla olevat palvelut</string>
<!-- Script Settings -->
@@ -34,22 +34,22 @@
<string id="30103">Valitse palvelut</string>
<string id="30104">- Podnapisi.net Käyttäjätunnus</string>
<string id="30105">- Podnapisi.net Salasana</string>
- <string id="30106">Advanced Options</string>
- <string id="30107">Subtitle Download Folder Same As Movie</string>
- <string id="30108">- Set Custom Subtitle Download Path</string>
+ <string id="30106">Lisäasetukset</string>
+ <string id="30107">Tekstitystiedostoston talletuskansio sama kuin
elokuvalla</string>
+ <string id="30108">- Aseta mukautettu tekstitystiedostojen
talletuskansio</string>
<string id="30110">Syötä hakuteksti manuaalisesti</string>
- <string id="30111">Third Language</string>
- <string id="30113">Select Default Movie Service</string>
- <string id="30114">Select Default TV Show Service</string>
- <string id="30118">Display file name in results page</string>
- <string id="30119">Search Using Parent Folder</string>
- <string id="30121">Add Language To Filename </string>
- <string id="30122">Set Default Timeout</string>
- <string id="30123">- Legendas.TV Username</string>
- <string id="30124">- Legendas.TV Password</string>
- <string id="30125">Disable hash search</string>
- <string id="30126">- Itasa Username</string>
- <string id="30127">- Itasa Password</string>
+ <string id="30111">Kolmas kieli</string>
+ <string id="30113">Valitse oletuspalvelu elokuville</string>
+ <string id="30114">Valitse oletuspalvelu tv-sarjoille</string>
+ <string id="30118">Näytä tiedostonimi hakutulos sivulla</string>
+ <string id="30119">Sisällytä yläkansiot hakuun </string>
+ <string id="30121">Lisää kielitieto tiedoston nimeen </string>
+ <string id="30122">Aseta oletusaikaraja</string>
+ <string id="30123">- Legendas.TV Käyttäjätunnus</string>
+ <string id="30124">- Legendas.TV Salasana</string>
+ <string id="30125">Poista hajautettu haku käytöstä</string>
+ <string id="30126">- Itasa Käyttäjätunnus</string>
+ <string id="30127">- Itasa Salasana</string>
<!-- Languages -->
diff --git a/script.xbmc.subtitles/resources/lib/gui.py
b/script.xbmc.subtitles/resources/lib/gui.py
index 580fba0..8565c88 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -277,6 +277,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
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 )
diff --git a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
index 6732337..4063547 100644
--- a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
@@ -1,11 +1,13 @@
# -*- coding: UTF-8 -*-
-import os, sys, re, xbmc, xbmcgui, string, urllib, xml.etree.ElementTree as
XMLTree
+import os, sys, re, xbmc, xbmcgui, xbmcaddon, string, urllib, urllib2,
xml.etree.ElementTree as XMLTree
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__profile__ = sys.modules[ "__main__" ].__profile__
+__version__ = sys.modules[ "__main__" ].__version__
+useragent = 'script.xbmc.subtitles/' + __version__
apiurl = "http://api.bierdopje.com/"
apikey = "369C2ED4261DE9C3"
showids_filename = os.path.join( __profile__ ,"bierdopje_show_ids.txt" )
@@ -20,7 +22,9 @@ def apicall(command, paramslist):
url = url + "/" + urllib.quote_plus(param)
log( __name__ ," getting url '%s'" % url )
try:
- response = urllib.urlopen(url)
+ request = urllib2.Request(url)
+ request.add_header("User-agent", useragent)
+ response = urllib2.urlopen(request)
except:
okdialog = xbmcgui.Dialog()
ok = okdialog.ok("Error", "Failed to contact Bierdopje site.")
@@ -34,9 +38,7 @@ def apicall(command, paramslist):
ok = okdialog.ok("Error", "Failed to contact Bierdopje site.")
log( __name__ ," failed to get proper response for url '%s'" % url
)
return None
- if status == "false":
- okdialog = xbmcgui.Dialog()
- ok = okdialog.ok("Error", "Failed to contact Bierdopje site.")
+ if status == ["false"]:
log( __name__ ," failed to get proper response (status = false)
for url '%s'" % url )
return None
else:
@@ -53,6 +55,7 @@ def gettextelements(xml, path):
return textelements
def getshowid(showname):
+ showid = None
showids = {}
if os.path.isfile(showids_filename):
showids_filedata = file(showids_filename,'r').read()
@@ -68,18 +71,37 @@ def getshowid(showname):
showids[showname] = str(showid[0])
file(showids_filename,'w').write(repr(showids))
return str(showid[0])
- elif ("'" in showname):
- response =
apicall("GetShowByName",[string.replace(showname,"'","''")])
+ if (showid is None) and ("'" in showname):
+ response = apicall("GetShowByName",[string.replace(showname,"'","''")])
+ if response is not None:
+ showid = gettextelements(response,"response/showid")
+ if len(showid) == 1:
+ log( __name__ ," show id for '%s' is '%s' (replaced ' with
'')" % (string.replace(showname,"'","''"), str(showid[0])) )
+ showids[showname] = str(showid[0])
+ file(showids_filename,'w').write(repr(showids))
+ return str(showid[0])
+ if showid is None:
+ try:
+ query = 'select c12 from tvshow where c00 = "' + unicode(showname)
+ '" limit 1'
+ result = xbmc.executehttpapi("queryvideodatabase(" + query + ")")
+ tvdbid = re.search('field>(.*?)<\/field',result)
+ tvdbid = tvdbid.group(1)
+ except:
+ log( __name__ ," Failed to find TVDBid in database")
+ else:
+ response = apicall("GetShowByTVDBID",[tvdbid])
if response is not None:
showid = gettextelements(response,"response/showid")
if len(showid) == 1:
- log( __name__ ," show id for '%s' is '%s' (replaced ' with
'')" % (string.replace(showname,"'","''"), str(showid[0])) )
+ log( __name__ ," show id for '%s' is '%s' (found by TVDBid
%s)" % (showname, str(showid[0]), tvdbid))
showids[showname] = str(showid[0])
file(showids_filename,'w').write(repr(showids))
return str(showid[0])
- okdialog = xbmcgui.Dialog()
- ok = okdialog.ok("Error", "Failed to get a show id from Bierdopje for
" + showname)
- log( __name__ ," failed to get a show id for '%s'" % showname )
+
+ okdialog = xbmcgui.Dialog()
+ ok = okdialog.ok("Error", "Failed to get a show id from Bierdopje for " +
showname)
+ log( __name__ ," failed to get a show id for '%s'" % showname )
+ return None
def isexactmatch(subsfile, moviefile):
@@ -124,32 +146,33 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
msg = ""
if len(tvshow) > 0:
tvshow_id= getshowid(tvshow)
- dutch = 0
- if string.lower(lang1) == "dutch": dutch = 1
- elif string.lower(lang2) == "dutch": dutch = 2
- elif string.lower(lang3) == "dutch": dutch = 3
+ if tvshow_id is not None:
+ dutch = 0
+ if string.lower(lang1) == "dutch": dutch = 1
+ elif string.lower(lang2) == "dutch": dutch = 2
+ elif string.lower(lang3) == "dutch": dutch = 3
- english = 0
- if string.lower(lang1) == "english": english = 1
- elif string.lower(lang2) == "english": english = 2
- elif string.lower(lang3) == "english": english = 3
+ english = 0
+ if string.lower(lang1) == "english": english = 1
+ elif string.lower(lang2) == "english": english = 2
+ elif string.lower(lang3) == "english": english = 3
- if ((dutch > 0) and (english == 0)):
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"nl", "Dutch", subtitles_list)
+ if ((dutch > 0) and (english == 0)):
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "nl", "Dutch", subtitles_list)
- if ((english > 0) and (dutch == 0)):
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"en", "English", subtitles_list)
+ if ((english > 0) and (dutch == 0)):
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "en", "English", subtitles_list)
- if ((dutch > 0) and (english > 0) and (dutch < english)):
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"nl", "Dutch", subtitles_list)
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"en", "English", subtitles_list)
+ if ((dutch > 0) and (english > 0) and (dutch < english)):
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "nl", "Dutch", subtitles_list)
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "en", "English", subtitles_list)
- if ((dutch > 0) and (english > 0) and (dutch > english)):
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"en", "English", subtitles_list)
- getallsubs(tvshow_id, file_original_path, tvshow, season, episode,
"nl", "Dutch", subtitles_list)
+ if ((dutch > 0) and (english > 0) and (dutch > english)):
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "en", "English", subtitles_list)
+ getallsubs(tvshow_id, file_original_path, tvshow, season,
episode, "nl", "Dutch", subtitles_list)
- if ((dutch == 0) and (english == 0)):
- msg = "Won't work, Bierdopje is only for Dutch and English
subtitles."
+ if ((dutch == 0) and (english == 0)):
+ msg = "Won't work, Bierdopje is only for Dutch and English
subtitles."
else:
msg = "Won't work, Bierdopje is only for tv shows."
return subtitles_list, "", msg #standard output
@@ -160,7 +183,9 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
log( __name__ ," downloading subtitles from url '%s'" %
subtitles_list[pos][ "link" ] )
try:
- response = urllib.urlopen(subtitles_list[pos][ "link" ])
+ request = urllib2.Request(subtitles_list[pos][ "link" ])
+ request.add_header("User-agent", useragent)
+ response = urllib2.urlopen(request)
except:
okdialog = xbmcgui.Dialog()
ok = okdialog.ok("Error", "Failed to contact Bierdopje site.")
diff --git
a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
index c44605d..4ea50ba 100644
--- a/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
+++ b/script.xbmc.subtitles/resources/lib/services/OpenSubtitles/os_utilities.py
@@ -66,7 +66,18 @@ class OSDBServer:
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})
+ 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
+ })
except:
msg = "Error Searching For Subs"
diff --git
a/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
b/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
index 5d4155e..48066d9 100644
--- a/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
+++ b/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
@@ -95,7 +95,18 @@ class OSDBServer:
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),
+ "hearing_imp" : "n" in
item['flags']
+ })
self.mergesubtitles(stack)
return self.subtitles_list,pod_session
except :
@@ -133,15 +144,16 @@ class OSDBServer:
if subtitles:
url_base = "http://www.podnapisi.net/ppodnapisi/download/i/"
for subtitle in subtitles:
- filename = ""
- movie = ""
- lang_name = ""
subtitle_id = 0
- lang_id = ""
- flag_image = ""
- link = ""
- format = "srt"
- no_files = ""
+ rating = 0
+ filename = ""
+ movie = ""
+ lang_name = ""
+ lang_id = ""
+ flag_image = ""
+ link = ""
+ format = "srt"
+ hearing_imp = False
if subtitle.getElementsByTagName("title")[0].firstChild:
movie = subtitle.getElementsByTagName("title")[0].firstChild.data
if subtitle.getElementsByTagName("release")[0].firstChild:
@@ -150,18 +162,28 @@ class OSDBServer:
filename = "%s (%s).srt" % (movie,year,)
else:
filename = "%s (%s).srt" % (movie,year,)
- rating = 0
if subtitle.getElementsByTagName("rating")[0].firstChild:
rating =
int(subtitle.getElementsByTagName("rating")[0].firstChild.data)*2
if subtitle.getElementsByTagName("languageId")[0].firstChild:
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,
+ "hearing_imp" : hearing_imp
+ })
self.mergesubtitles(stack)
return self.subtitles_list
except :
diff --git
a/script.xbmc.subtitles/resources/skins/Default/720p/script-XBMC-Subtitles-main.xml
b/script.xbmc.subtitles/resources/skins/Default/720p/script-XBMC-Subtitles-main.xml
index 1fdde46..b4742d0 100644
---
a/script.xbmc.subtitles/resources/skins/Default/720p/script-XBMC-Subtitles-main.xml
+++
b/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>
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 7 ++
.../resources/language/Finnish/strings.xml | 56 ++++++------
script.xbmc.subtitles/resources/lib/gui.py | 5 +
.../resources/lib/services/Bierdopje/service.py | 89 +++++++++++++-------
.../lib/services/OpenSubtitles/os_utilities.py | 13 +++-
.../lib/services/Podnapisi/pn_utilities.py | 48 ++++++++---
.../Default/720p/script-XBMC-Subtitles-main.xml | 24 +++++-
.../skins/Default/media/icon_close_caption.png | Bin 0 -> 11672 bytes
9 files changed, 165 insertions(+), 79 deletions(-)
create mode 100644
script.xbmc.subtitles/resources/skins/Default/media/icon_close_caption.png
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons