The branch, frodo has been updated
via e7d6304ad7a594e7214deca75472d020f7c9a60f (commit)
from fcc03a5c26dc97bc9017fe2d9168e9e614578da9 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=e7d6304ad7a594e7214deca75472d020f7c9a60f
commit e7d6304ad7a594e7214deca75472d020f7c9a60f
Author: amet <[email protected]>
Date: Mon Aug 19 17:21:24 2013 +0400
[script.xbmc.subtitles] - v 3.9.13
3.9.13
- [fix] Fixed Sratim A.K.A Subtitle.co.il service, BBLN
3.9.12
- [fix] Fix for auto-download of subtitles not working when the language
name is not the first synonym in the LANGUAGES list, diego nunes
- [fix] Fixed search on SubtitlesGR service, lambda81
- [fix] Napiproject, paradix
- [fix] updated SubScene service for current site version, Marcel Anacker
- [cleanup] Linting/cleanup, diego nunes
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 3d71a1d..2de80b0 100644
--- 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.9.11"
+ version="3.9.13"
provider-name="amet, mr_blobby">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
diff --git a/script.xbmc.subtitles/changelog.txt
b/script.xbmc.subtitles/changelog.txt
index 78668a5..4c294cf 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,13 @@
+3.9.13
+- [fix] Fixed Sratim A.K.A Subtitle.co.il service, BBLN
+
+3.9.12
+- [fix] Fix for auto-download of subtitles not working when the language name
is not the first synonym in the LANGUAGES list, diego nunes
+- [fix] Fixed search on SubtitlesGR service, lambda81
+- [fix] Napiproject, paradix
+- [fix] updated SubScene service for current site version, Marcel Anacker
+- [cleanup] Linting/cleanup, diego nunes
+
3.9.11
- [fix] Subs4Free and SubtitlesGR, lambda81
- [fix] SubtitlesGR, jded76
diff --git a/script.xbmc.subtitles/resources/language/English/strings.po
b/script.xbmc.subtitles/resources/language/English/strings.po
index 4655f90..788255a 100644
--- a/script.xbmc.subtitles/resources/language/English/strings.po
+++ b/script.xbmc.subtitles/resources/language/English/strings.po
@@ -155,9 +155,17 @@ msgctxt "#767"
msgid "No 'sync' subtitle found"
msgstr ""
-#empty strings from id 768 to 30099
+#empty strings from id 768 to 30097
#Script Settings
+msgctxt "#30098"
+msgid "- Subtitle.co.il Email"
+msgstr ""
+
+msgctxt "#30099"
+msgid "- Subtitle.co.il Password"
+msgstr ""
+
msgctxt "#30100"
msgid "Languages"
msgstr ""
diff --git a/script.xbmc.subtitles/resources/language/Hebrew/strings.po
b/script.xbmc.subtitles/resources/language/Hebrew/strings.po
index 1068fe3..8b6b11f 100644
--- a/script.xbmc.subtitles/resources/language/Hebrew/strings.po
+++ b/script.xbmc.subtitles/resources/language/Hebrew/strings.po
@@ -137,6 +137,14 @@ msgctxt "#767"
msgid "No 'sync' subtitle found"
msgstr "×× × ×צ×× ×ת××××ת ×ס×× ××¨× ×ת"
+msgctxt "#30098"
+msgid "- Subtitle.co.il Email"
+msgstr "- ×ת××ת ×××××× ×סר×××"
+
+msgctxt "#30099"
+msgid "- Subtitle.co.il Password"
+msgstr "- ס×ס×× ×-סר×××"
+
msgctxt "#30100"
msgid "Languages"
msgstr "שפ×ת"
diff --git a/script.xbmc.subtitles/resources/lib/gui.py
b/script.xbmc.subtitles/resources/lib/gui.py
index cad7fd7..94bc615 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -13,12 +13,12 @@ from utilities import *
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__addon__ = sys.modules[ "__main__" ].__addon__
-__profile__ = sys.modules[ "__main__" ].__profile__
+__profile__ = sys.modules[ "__main__" ].__profile__
__version__ = sys.modules[ "__main__" ].__version__
class GUI( xbmcgui.WindowXMLDialog ):
-
- def __init__( self, *args, **kwargs ):
+
+ def __init__( self, *args, **kwargs ):
pass
def onInit( self ):
@@ -33,14 +33,14 @@ class GUI( xbmcgui.WindowXMLDialog ):
except:
errno, errstr = sys.exc_info()[:2]
xbmc.sleep(2000)
- self.close()
+ self.close()
- def set_allparam(self):
+ def set_allparam(self):
self.list = []
service_list = []
self.stackPath = []
service = ""
- self.man_search_str = ""
+ self.man_search_str = ""
self.temp = False
self.rar = False
self.stack = False
@@ -56,13 +56,13 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.mansearch = __addon__.getSetting( "searchstr" ) == "true"
# Manual search string??
self.parsearch = __addon__.getSetting( "par_folder" ) == "true"
# Parent folder as search string
self.language_1 = languageTranslate(__addon__.getSetting( "Lang01" ),
4, 0) # Full language 1
- self.language_2 = languageTranslate(__addon__.getSetting( "Lang02" ),
4, 0) # Full language 2
+ self.language_2 = languageTranslate(__addon__.getSetting( "Lang02" ),
4, 0) # Full language 2
self.language_3 = languageTranslate(__addon__.getSetting( "Lang03" ),
4, 0) # Full language 3
- self.tmp_sub_dir = os.path.join( __profile__ ,"sub_tmp" )
# Temporary subtitle extraction directory
- self.stream_sub_dir = os.path.join( __profile__ ,"sub_stream" )
# Stream subtitle directory
-
+ self.tmp_sub_dir = os.path.join( __profile__ ,"sub_tmp" )
# Temporary subtitle extraction directory
+ self.stream_sub_dir = os.path.join( __profile__ ,"sub_stream" )
# Stream subtitle directory
+
self.clean_temp()
# clean temp dirs
-
+
if ( movieFullPath.find("http") > -1 ):
self.sub_folder = self.stream_sub_dir
self.temp = True
@@ -70,7 +70,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
elif ( movieFullPath.find("rar://") > -1 ):
self.rar = True
movieFullPath = os.path.dirname(movieFullPath[6:])
-
+
elif ( movieFullPath.find("stack://") > -1 ):
self.stackPath = movieFullPath.split(" , ")
movieFullPath = self.stackPath[0][8:]
@@ -82,11 +82,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
xbmcvfs.mkdirs(self.sub_folder)
else:
self.sub_folder = os.path.dirname( movieFullPath )
-
+
if not xbmcvfs.exists(self.sub_folder):
xbmcvfs.mkdir(self.sub_folder)
-
- if self.episode.lower().find("s") > -1:
# Check if season is "Special"
+
+ if self.episode.lower().find("s") > -1:
# Check if season is "Special"
self.season = "0"
#
self.episode = self.episode[-1:]
#
@@ -121,9 +121,9 @@ class GUI( xbmcgui.WindowXMLDialog ):
int(self.episode)
)
else:
- self.file_name = "%s (%s)" % (self.title.encode('utf-8'),
str(self.year),)
+ self.file_name = "%s (%s)" % (self.title.encode('utf-8'),
str(self.year))
- if ((__addon__.getSetting( "auto_download" ) == "true") and
+ if ((__addon__.getSetting( "auto_download" ) == "true") and
(__addon__.getSetting( "auto_download_file" ) != os.path.basename(
movieFullPath ))):
self.autoDownload = True
__addon__.setSetting("auto_download_file", "")
@@ -138,15 +138,15 @@ class GUI( xbmcgui.WindowXMLDialog ):
def_service = __addon__.getSetting( "deftvservice")
else:
def_service = __addon__.getSetting( "defmovieservice")
-
+
if service_list.count(def_service) > 0:
service = def_service
- if len(service_list) > 0:
+ if len(service_list) > 0:
if len(service) < 1:
self.service = service_list[0]
else:
- self.service = service
+ self.service = service
self.service_list = service_list
self.next = list(service_list)
@@ -164,10 +164,10 @@ class GUI( xbmcgui.WindowXMLDialog ):
log( __name__ ,"Tv Show Episode: [%s]" % self.episode)
log( __name__ ,"Movie/Episode Title: [%s]" % self.title)
log( __name__ ,"Subtitle Folder: [%s]" % self.sub_folder)
- log( __name__ ,"Languages: [%s] [%s] [%s]" % (self.language_1,
self.language_2, self.language_3,))
+ log( __name__ ,"Languages: [%s] [%s] [%s]" % (self.language_1,
self.language_2, self.language_3))
log( __name__ ,"Parent Folder Search: [%s]" % self.parsearch)
log( __name__ ,"Stacked(CD1/CD2)?: [%s]" % self.stack)
-
+
return self.autoDownload
def Search_Subtitles( self, gui = True ):
@@ -185,11 +185,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
exec ( "from services.%s import service as Service" % (self.service))
self.Service = Service
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 646 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 646 ))
msg = ""
socket.setdefaulttimeout(float(__addon__.getSetting( "timeout" )))
- try:
- self.subtitles_list, self.session_id, msg =
self.Service.search_subtitles(
+ try:
+ self.subtitles_list, self.session_id, msg =
self.Service.search_subtitles(
self.file_original_path,
self.title,
self.tvshow,
@@ -214,7 +214,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
msg = "Error: %s" % ( str(errstr), )
socket.setdefaulttimeout(None)
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 642 ) % ( "...", ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 642 ) % ( "...", ))
if not self.subtitles_list:
if __addon__.getSetting( "search_next" )== "true" and len(self.next) > 1:
@@ -222,7 +222,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.next.remove(self.service)
self.service = self.next[0]
self.show_service_list(gui)
- log( __name__ ,"Auto Searching '%s' Service" % (self.service,) )
+ log( __name__ ,"Auto Searching '%s' Service" % (self.service))
self.Search_Subtitles(gui)
else:
self.next = list(self.service_list)
@@ -231,20 +231,19 @@ class GUI( xbmcgui.WindowXMLDialog ):
if msg != "":
self.getControl( STATUS_LABEL ).setLabel( msg )
else:
- self.getControl( STATUS_LABEL ).setLabel( _( 657 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 657 ))
self.show_service_list(gui)
- if self.autoDownload:
- xbmc.executebuiltin((u"Notification(%s,%s,%i)" % (__scriptname__,
_(767), 1000)).encode("utf-8"))
+ if self.autoDownload:
+ xbmc.executebuiltin((u"Notification(%s,%s,%i)" % (__scriptname__,
_(767), 1000)).encode("utf-8"))
else:
subscounter = 0
itemCount = 0
list_subs = []
+ mainLangISO = languageTranslate(self.language_1, 0, 3)
for item in self.subtitles_list:
- if (self.autoDownload and
- item["sync"] and
- (item["language_name"] == languageTranslate(
- languageTranslate(self.language_1,0,2),2,0)
- )):
+ if (self.autoDownload and item["sync"] and
+ languageTranslate(item["language_name"], 0, 3) == mainLangISO
+ ):
self.Download_Subtitles(itemCount, True, gui)
__addon__.setSetting("auto_download_file",
os.path.basename( self.file_original_path ))
@@ -253,7 +252,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
return True
else:
if gui:
- listitem = xbmcgui.ListItem(label=_(
languageTranslate(item["language_name"],0,5) ),
+ listitem = xbmcgui.ListItem(label=_(
languageTranslate(item["language_name"],0,5)),
label2=item["filename"],
iconImage=item["rating"],
thumbnailImage=item["language_flag"]
@@ -267,28 +266,28 @@ class GUI( xbmcgui.WindowXMLDialog ):
listitem.setProperty( "hearing_imp", "true" )
else:
listitem.setProperty( "hearing_imp", "false" )
-
+
self.list.append(subscounter)
subscounter = subscounter + 1
- list_subs.append(listitem)
+ list_subs.append(listitem)
itemCount += 1
-
+
if gui:
- label = '%i %s '"' %s '"'' % (len ( self.subtitles_list ),_( 744
),self.file_name,)
- self.getControl( STATUS_LABEL ).setLabel( label )
+ label = '%i %s '"' %s '"'' % (len ( self.subtitles_list ),_( 744
),self.file_name)
+ self.getControl( STATUS_LABEL ).setLabel( label )
self.getControl( SUBTITLES_LIST ).addItems( list_subs )
self.setFocusId( SUBTITLES_LIST )
self.getControl( SUBTITLES_LIST ).selectItem( 0 )
- if self.autoDownload:
+ if self.autoDownload:
xbmc.executebuiltin((u"Notification(%s,%s,%i)" % (__scriptname__,
_(767), 1000)).encode("utf-8"))
return False
def Download_Subtitles( self, pos, auto = False, gui = True ):
if gui:
if auto:
- self.getControl( STATUS_LABEL ).setLabel( _( 763 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 763 ))
else:
- self.getControl( STATUS_LABEL ).setLabel( _( 649 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 649 ))
compressed_subs = os.path.join( self.tmp_sub_dir, "compressed_subs.ext")
compressed, language, file =
self.Service.download_subtitles(self.subtitles_list,
pos,
@@ -311,8 +310,8 @@ class GUI( xbmcgui.WindowXMLDialog ):
sub_ext = os.path.splitext( file )[1]
if self.temp:
sub_name = "temp_sub"
- else:
- sub_name = os.path.splitext( os.path.basename( self.file_original_path
) )[0]
+ else:
+ sub_name = os.path.splitext( os.path.basename( self.file_original_path
))[0]
if (__addon__.getSetting( "lang_to_end" ) == "true"):
file_name = u"%s.%s%s" % ( sub_name, sub_lang, sub_ext )
else:
@@ -336,11 +335,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.close()
else:
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 654 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 654 ))
self.show_service_list(gui)
def Extract_Subtitles( self, zip_subs, subtitle_lang, gui = True ):
- xbmc.executebuiltin(('XBMC.Extract("%s","%s")' %
(zip_subs,self.tmp_sub_dir,)).encode('utf-8'))
+ xbmc.executebuiltin(('XBMC.Extract("%s","%s")' %
(zip_subs,self.tmp_sub_dir)).encode('utf-8'))
xbmc.sleep(1000)
files = os.listdir(self.tmp_sub_dir)
sub_filename = os.path.basename( self.file_original_path )
@@ -348,11 +347,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
subtitle_set = False
if len(files) < 1 :
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 654 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 654 ))
self.show_service_list(gui)
else :
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 652 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 652 ))
subtitle_set = False
movie_sub = False
episode = 0
@@ -365,7 +364,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
else:
if os.path.splitext( zip_entry )[1] in exts:
movie_sub = True
- if ( movie_sub or int(episode) == int(self.episode) ):
+ if ( movie_sub or int(episode) == int(self.episode)):
if self.stack:
try:
for subName in self.stackPath:
@@ -378,11 +377,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
urllib.unquote(os.path.basename(subName[8:])),
subtitle_lang
)
- subtitle_set,file_path = copy_files( subtitle_file,
file_path )
+ subtitle_set,file_path = copy_files( subtitle_file,
file_path )
if re.split("(?x)(?i)\CD(\d)", zip_entry)[1] == "1":
subToActivate = file_path
except:
- subtitle_set = False
+ subtitle_set = False
else:
subtitle_set,subToActivate = copy_files( subtitle_file,
file_path )
@@ -397,14 +396,14 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.close()
else:
if gui:
- self.getControl( STATUS_LABEL ).setLabel( _( 654 ) )
+ self.getControl( STATUS_LABEL ).setLabel( _( 654 ))
self.show_service_list(gui)
def clean_temp( self ):
for temp_dir in [self.stream_sub_dir,self.tmp_sub_dir]:
- rem_files(temp_dir)
-
-
+ rem_files(temp_dir)
+
+
def show_service_list(self,gui):
try:
select_index = self.service_list.index(self.service)
@@ -414,19 +413,19 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.setFocusId( SERVICES_LIST )
self.getControl( SERVICES_LIST ).selectItem( select_index )
- def create_name(self,zip_entry,sub_filename,subtitle_lang):
+ def create_name(self,zip_entry,sub_filename,subtitle_lang):
if self.temp:
name = "temp_sub"
else:
name = os.path.splitext( sub_filename )[0]
if (__addon__.getSetting( "lang_to_end" ) == "true"):
- file_name = u"%s.%s%s" % ( name,
+ file_name = u"%s.%s%s" % ( name,
subtitle_lang,
os.path.splitext( zip_entry )[1] )
else:
file_name = u"%s%s" % ( name, os.path.splitext( zip_entry )[1] )
log( __name__ ,"Sub in Archive [%s], File Name [%s]" % (zip_entry,
- file_name,))
+ file_name))
ret_zip_entry =
xbmc.validatePath(os.path.join(self.tmp_sub_dir,zip_entry)).decode("utf-8")
ret_file_name =
xbmc.validatePath(os.path.join(self.sub_folder,file_name)).decode("utf-8")
return ret_zip_entry,ret_file_name
@@ -434,7 +433,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
def list_services( self ):
self.list = []
all_items = []
- self.getControl( SERVICES_LIST ).reset()
+ self.getControl( SERVICES_LIST ).reset()
for serv in self.service_list:
listitem = xbmcgui.ListItem( serv )
self.list.append(serv)
@@ -442,22 +441,22 @@ class GUI( xbmcgui.WindowXMLDialog ):
all_items.append(listitem)
if self.mansearch :
- listitem = xbmcgui.ListItem( _( 612 ) )
+ listitem = xbmcgui.ListItem( _( 612 ))
listitem.setProperty( "man", "true" )
self.list.append("Man")
all_items.append(listitem)
if self.parsearch :
- listitem = xbmcgui.ListItem( _( 747 ) )
+ listitem = xbmcgui.ListItem( _( 747 ))
listitem.setProperty( "man", "true" )
self.list.append("Par")
all_items.append(listitem)
-
- listitem = xbmcgui.ListItem( _( 762 ) )
+
+ listitem = xbmcgui.ListItem( _( 762 ))
listitem.setProperty( "man", "true" )
self.list.append("Set")
all_items.append(listitem)
- self.getControl( SERVICES_LIST ).addItems( all_items )
+ self.getControl( SERVICES_LIST ).addItems( all_items )
def keyboard(self, parent):
dir, self.year = xbmc.getCleanMovieTitle(self.file_original_path,
self.parsearch)
@@ -465,7 +464,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
if self.man_search_str != "":
srchstr = self.man_search_str
else:
- srchstr = "%s (%s)" % (dir,self.year,)
+ srchstr = "%s (%s)" % (dir,self.year)
kb = xbmc.Keyboard(srchstr, _( 751 ), False)
text = self.file_name
kb.doModal()
@@ -473,26 +472,26 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.title = text
self.man_search_str = text
else:
- self.title = dir
+ self.title = dir
- log( __name__ ,"Manual/Keyboard Entry: Title:[%s], Year: [%s]" %
(self.title, self.year,))
+ log( __name__ ,"Manual/Keyboard Entry: Title:[%s], Year: [%s]" %
(self.title, self.year))
if self.year != "" :
- self.file_name = "%s (%s)" % (self.file_name, str(self.year),)
+ self.file_name = "%s (%s)" % (self.file_name, str(self.year))
else:
- self.file_name = self.title
+ self.file_name = self.title
self.tvshow = ""
self.next = list(self.service_list)
- self.Search_Subtitles()
+ self.Search_Subtitles()
def onClick( self, controlId ):
if controlId == SUBTITLES_LIST:
- self.Download_Subtitles( self.getControl( SUBTITLES_LIST
).getSelectedPosition() )
-
+ self.Download_Subtitles( self.getControl( SUBTITLES_LIST
).getSelectedPosition())
+
elif controlId == SERVICES_LIST:
xbmc.executebuiltin("Skin.Reset(SubtitleSourceChooserVisible)")
- selection = str(self.list[self.getControl( SERVICES_LIST
).getSelectedPosition()])
+ selection = str(self.list[self.getControl( SERVICES_LIST
).getSelectedPosition()])
self.setFocusId( 120 )
-
+
if selection == "Man":
self.keyboard(False)
elif selection == "Par":
@@ -500,11 +499,11 @@ class GUI( xbmcgui.WindowXMLDialog ):
elif selection == "Set":
__addon__.openSettings()
self.set_allparam()
- self.on_run()
+ self.on_run()
else:
self.service = selection
self.next = list(self.service_list)
- self.Search_Subtitles()
+ self.Search_Subtitles()
def onFocus( self, controlId ):
if controlId == 150:
diff --git
a/script.xbmc.subtitles/resources/lib/services/Napiprojekt/service.py
b/script.xbmc.subtitles/resources/lib/services/Napiprojekt/service.py
index 6580a3f..177ee32 100644
--- a/script.xbmc.subtitles/resources/lib/services/Napiprojekt/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Napiprojekt/service.py
@@ -4,6 +4,7 @@ import sys
import os
from utilities import languageTranslate
import xbmc
+import xbmcvfs
import urllib
try:
@@ -43,8 +44,8 @@ def set_filehash(path,rar):
d = md5();
qpath=urllib.quote(path)
if rar:
- path="""rar://"""+qpath
- d.update(open(path,"rb").read(10485760))
+ path="""rar://"""+qpath
+ d.update(xbmcvfs.File(path,"rb").read(10485760))
return d
def f(z):
@@ -94,4 +95,4 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
language = subtitles_list[pos][ "language_name" ]
return False, language, local_tmp_file #standard output
-
\ No newline at end of file
+
diff --git a/script.xbmc.subtitles/resources/lib/services/Sratim/service.py
b/script.xbmc.subtitles/resources/lib/services/Sratim/service.py
index b8a308e..ebb250d 100644
--- a/script.xbmc.subtitles/resources/lib/services/Sratim/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Sratim/service.py
@@ -1,8 +1,8 @@
# -*- coding: UTF-8 -*-
#===============================================================================
-# Sratim.co.il subtitles service.
-# Version: 2.2
+# Subtitle.co.il subtitles service.
+# Version: 3.0.3
#
# Change log:
# 1.1 - Fixed bug with movie search: forgot to replace spaces with + signs.
@@ -13,16 +13,30 @@
# 2.2 - Changed url to subtitle.co.il
# 2.3 - Added User Agent to getURL, fixed string related bugs and patterns
# 2.3.1 - stripped (year) from tvshow
+# 2.4 - Added support for idx+sub download from sendspace.com
+# 3.0 - Added rating algorithem that will try to match correct subtitle
release to filename
+# Sorted results list by rating
+# subtitle with rating>8 will have SYNC icon and ability to auto download
+# 3.0.1 - Bug fix
+# 3.0.2 - Added free user & password.
+# 3.0.3 - Added email & password settings.
#
# Created by: Ori Varon
-# Changed by MeatHook (2.3)
+# Changed by: MeatHook (2.3)
+# Changed By: Maor Tal (2.4) 20/02/2013
+# Changed By: Maor Tal (3.0) 17/03/2013
+# Changed By: thisisbbln (3.0.2) 12/08/2013
+# Changed By: thisisbbln (3.0.3) 12/08/2013
#===============================================================================
-import os, re, xbmc, xbmcgui, string, time, urllib2
+import sys, os, re, xbmc, xbmcgui, string, time, urllib, urllib2, cookielib
+
from utilities import languageTranslate, log
BASE_URL = "http://www.subtitle.co.il/"
debug_pretext = ""
+__addon__ = sys.modules[ "__main__" ].__addon__
+
#===============================================================================
# Regular expression patterns
#===============================================================================
@@ -30,14 +44,41 @@ debug_pretext = ""
TV_SEARCH_RESULTS_PATTERN = "<a
href=\"viewseries.php\?id=(\d+)[^>]*?title=.*?>"
SEARCH_RESULTS_PATTERN = "<a href=\"view.php\?id=(\d+)[^>]*?title=.*?>"
SUBTITLE_LIST_PATTERN =
"downloadsubtitle\.php\?id=(?P<fid>\d*).*?subt_lang.*?title=\"(?P<language>.*?)\".*?subtitle_title.*?title=\"(?P<title>.*?)\""
+SSUBTITLE_LIST_PATTERN =
"l\.php\?surl=(?P<fid2>\d*).*?subt_lang.*?title=\"(?P<language2>.*?)\".*?subtitle_title.*?title=\"(?P<title2>.*?)\""
+COMBINED = SUBTITLE_LIST_PATTERN + "|" + SSUBTITLE_LIST_PATTERN
TV_SEASON_PATTERN = "seasonlink_(?P<slink>\d+).*?>(?P<snum>\d+)</a>"
TV_EPISODE_PATTERN = "episodelink_(?P<elink>\d+).*?>(?P<enum>\d+)</a>"
USER_AGENT =
"Mozilla%2F4.0%20(compatible%3B%20MSIE%207.0%3B%20Windows%20NT%206.0)"
+releases_types = ['2011','2009','2012','2010','2013','2014','web-dl',
'webrip', '480p', '720p', '1080p', 'h264', 'x264', 'xvid', 'ac3', 'aac',
'hdtv', 'dvdscr' ,'dvdrip', 'ac3', 'brrip', 'bluray', 'dd51', 'divx', 'proper',
'repack', 'pdtv', 'rerip', 'dts']
+
+#===============================================================================
+# User data
+#===============================================================================
+user_email = __addon__.getSetting( "SRAemail" )
+user_pass = __addon__.getSetting( "SRApass" )
+
+cookies = cookielib.CookieJar()
#===============================================================================
# Private utility functions
#===============================================================================
+def login():
+ # Reading cookies into cookiejar, will be used in getUrl()
+ log( __name__ ,"Login to Subtitle.co.il")
+ try:
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
+ log( __name__ ,"Login to Subtitle.co.il 1")
+ opener.addheaders = [('User-Agent', USER_AGENT)]
+ log( __name__ ,"Login to Subtitle.co.il 2")
+ data = urllib.urlencode({'email': user_email, 'password': user_pass,
'Login': '×ת××ר' })
+ log( __name__ ,"Login to Subtitle.co.il 3")
+ # data returned from this pages contains redirection
+ response = opener.open(BASE_URL + "login.php", data)
+ except:
+ log( __name__ ,"Subtitle.co.il - Login failed")
+ log( __name__ ,sys.exc_info())
+
# Returns the corresponding script language name for the Hebrew unicode
language
def sratimToScript(language):
languages = {
@@ -51,7 +92,28 @@ def sratimToScript(language):
"ספר××ת" : "Spanish"
}
return languages[language]
-
+def getrating(subsfile, videofile):
+ x=0
+ rating = 0
+ log(__name__ ,"# Comparing Releases:\n %s [subtitle-rls] \n %s
[filename-rls]" % (subsfile,videofile))
+ videofile = "".join(videofile.split('.')[:-1]).lower()
+ subsfile = subsfile.lower().replace('.', '')
+ videofile = videofile.replace('.', '')
+ for release_type in releases_types:
+ if (release_type in videofile):
+ x+=1
+ if (release_type in subsfile): rating += 1
+ if(x): rating=(rating/float(x))*4
+ # Compare group name
+ if videofile.split('-')[-1] == subsfile.split('-')[-1] : rating += 1
+ # Group name didnt match
+ # try to see if group name is in the beginning (less info on file less
weight)
+ elif videofile.split('-')[0] == subsfile.split('-')[-1] : rating += 0.5
+ if rating > 0:
+ rating = rating * 2
+ log(__name__ ,"# Result is: %f" % rating)
+ return round(rating)
+
# Returns the content of the given URL. Used for both html and subtitle files.
# Based on Titlovi's service.py
def getURL(url):
@@ -59,9 +121,9 @@ def getURL(url):
content = None
log( __name__ ,"Getting url: %s" % (url))
try:
- req = urllib2.Request(url)
- req.add_unredirected_header('User-Agent', USER_AGENT)
- response = urllib2.urlopen(req)
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
+ opener.addheaders = [('User-Agent', USER_AGENT)]
+ response = opener.open(url)
content = response.read()
except:
log( __name__ ,"Failed to get url:%s" % (url))
@@ -70,25 +132,35 @@ def getURL(url):
# The function receives a subtitles page id number, a list of user selected
# languages and the current subtitles list and adds all found subtitles
matching
# the language selection to the subtitles list.
-def getAllSubtitles(subtitlePageID,languageList,subtitlesList):
+def getAllSubtitles(fname,subtitlePageID,languageList):
# Retrieve the subtitles page (html)
+ subs= []
subtitlePage = getURL(BASE_URL + "view.php?id=" + subtitlePageID +
"&m=subtitles#")
-
# Create a list of all subtitles found on page
- foundSubtitles = re.findall(SUBTITLE_LIST_PATTERN, subtitlePage)
- for (fid,language,title) in foundSubtitles:
+ foundSubtitles = re.findall(COMBINED, subtitlePage)
+ for (fid,language,title,fid2,language2,title2) in foundSubtitles:
+ log( __name__ ,"%s Is sendspace?: %s" % (debug_pretext, bool(fid2 and
len(fid2)>0)))
+ #Create Dictionery for XBMC Gui
+ if(fid2 and len(fid2)>0):
+ fid=fid2
+ language=language2
+ title=title2
# Check if the subtitles found match one of our languages was selected
# by the user
if (sratimToScript(language) in languageList):
- subtitlesList.append({'rating': '0', 'sync': False,
+ rating=getrating(title,fname)
+ subs.append({'rating': str(rating), 'sync': rating>=8,
'filename': title, 'subtitle_id': fid,
'language_flag': 'flags/' + \
languageTranslate(sratimToScript(language),0,2) + \
- '.gif', 'language_name':
sratimToScript(language)})
+ '.gif', 'language_name':
sratimToScript(language), 'sendspace': (fid2 and len(fid2)>0)})
+ return sorted(subs,key=lambda x: int(float(x['rating'])),reverse=True)
+
# Same as getAllSubtitles() but receives season and episode numbers and find
them.
-def
getAllTVSubtitles(subtitlePageID,languageList,subtitlesList,season,episode):
+def getAllTVSubtitles(fname,subtitlePageID,languageList,season,episode):
# Retrieve the subtitles page (html)
+ subs= []
subtitlePage = getURL(BASE_URL + "viewseries.php?id=" + subtitlePageID +
"&m=subtitles#")
# Retrieve the requested season
foundSeasons = re.findall(TV_SEASON_PATTERN, subtitlePage)
@@ -101,21 +173,30 @@ def
getAllTVSubtitles(subtitlePageID,languageList,subtitlesList,season,episode):
if (episode_num == episode):
subtitlePage = getURL(BASE_URL + "viewseries.php?id=" +
subtitlePageID + "&m=subtitles&s="+str(season_link)+"&e="+str(episode_link))
# Create a list of all subtitles found on page
- foundSubtitles = re.findall(SUBTITLE_LIST_PATTERN,
subtitlePage)
- for (fid,language,title) in foundSubtitles:
+ foundSubtitles = re.findall(COMBINED, subtitlePage)
+ for (fid,language,title,fid2,language2,title2) in
foundSubtitles:
+ log( __name__ ,"%s Is sendspace?: %s" %
(debug_pretext, bool(fid2 and len(fid2)>0)))
+ # Create Dictionery for XBMC Gui
+ if(fid2 and len(fid2)>0):
+ fid=fid2
+ language=language2
+ title=title2
# Check if the subtitles found match one of our
languages was selected
# by the user
if (sratimToScript(language) in languageList):
- subtitlesList.append({'rating': '0', 'sync': False,
+ rating=getrating(title,fname)
+ subs.append({'rating': str(rating), 'sync':
rating>=8,
'filename': title,
'subtitle_id': fid,
'language_flag': 'flags/' + \
languageTranslate(sratimToScript(language),0,2) + \
- '.gif', 'language_name':
sratimToScript(language)})
+ '.gif', 'language_name':
sratimToScript(language), 'sendspace': (fid2 and len(fid2)>0)})
+ # sort, to put syncs on top
+ return sorted(subs,key=lambda x: int(float(x['rating'])),reverse=True)
+
+
# Extracts the downloaded file and find a new sub/srt file to return.
-# Note that Sratim.co.il currently isn't hosting subtitles in .txt format but
-# is adding txt info files in their zips, hence not looking for txt.
# Based on Titlovi's service.py
def extractAndFindSub(tempSubDir,tempZipFile):
# Remember the files currently in the folder and their number
@@ -180,6 +261,7 @@ def extractAndFindSub(tempSubDir,tempZipFile):
# rar -> True iff video is inside a rar archive
# lang1, lang2, lang3 -> Languages selected by the user
def search_subtitles( file_original_path, title, tvshow, year, season,
episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
+ login()
subtitlesList = []
# List of user languages - easier to manipulate
@@ -188,12 +270,12 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
# Check if searching for tv show or movie and build the search string
if tvshow:
- searchString = re.split(r'\s\(\d+\)$',tvshow)[0].replace(" ","+")
+ searchString = re.split(r'\s\(\w+\)$',tvshow)[0].replace(" ","+")
else:
searchString = title.replace(" ","+")
-
+
log( __name__ ,"%s Search string = *%s*" % (debug_pretext, title))
-
+
# Retrieve the search results (html)
searchResults = getURL(BASE_URL + "browse.php?q=" + searchString)
@@ -201,23 +283,23 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
if (not searchResults):
return subtitlesList, "", "Search timed out, please try again later."
- # When searching for episode 1 Sratim.co.il returns episode 1,10,11,12 etc'
+ # When searching for episode 1 subtitle.co.il returns episode 1,10,11,12
etc'
# so we need to catch with out pattern the episode and season numbers and
- # only retrieve subtitles from the right result pages.
+ # only retrieve subtitles from the right result pages.s
if tvshow:
- # Find sratim's subtitle page IDs
+ # Find TvShow's subtitle page IDs
subtitleIDs = re.findall(TV_SEARCH_RESULTS_PATTERN,
unicode(searchResults,"utf-8"))
# Go over all the subtitle pages and add results to our list if season
# and episode match
for sid in subtitleIDs:
- getAllTVSubtitles(sid,languageList,subtitlesList,season,episode)
+ subtitlesList =subtitlesList +
getAllTVSubtitles(os.path.basename(file_original_path),sid,languageList,season,episode)
else:
- # Find sratim's subtitle page IDs
+ # Find Movie's subtitle page IDs
subtitleIDs = re.findall(SEARCH_RESULTS_PATTERN, searchResults)
# Go over all the subtitle pages and add results to our list
for sid in subtitleIDs:
- getAllSubtitles(sid,languageList,subtitlesList)
+ subtitlesList =subtitlesList +
getAllSubtitles(os.path.basename(file_original_path),sid,languageList)
@@ -238,14 +320,28 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
# session_id -> Same session_id returned in search function
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
subtitle_id = subtitles_list[pos][ "subtitle_id" ]
- language = subtitles_list[pos][ "language_name" ]
- url = BASE_URL + "downloadsubtitle.php?id=" + subtitle_id
- log( __name__ ,"%s Fetching subtitles using url %s" % (debug_pretext, url))
+ language = subtitles_list[pos][ "language_name" ]
+ log( __name__ ,"%s Is subtitle related to sendspace? %s" % (debug_pretext,
subtitles_list[pos][ "sendspace" ]))
+ if (not subtitles_list[pos][ "sendspace" ]):
+ url = BASE_URL + "downloadsubtitle.php?id=" + subtitle_id
+ content = getURL(url)
+ log( __name__ ,"%s Fetching subtitles using url %s" % (debug_pretext,
url))
+ filename = "zipsubs.zip"
+ else:
+ url = BASE_URL + "l.php?surl=" + subtitle_id
+ content = getURL(url)
+ url = re.search(r'<a id="download_button"
href?="(.+sendspace.+\.\w\w\w)" ', content)
+ content = None
+ if (url):
+ url = url.group(1)
+ log( __name__ ,"%s Fetching subtitles from sendspace.com using url
%s" % (debug_pretext, url))
+ content = getURL(url)
+ filename = "rarsubs" + re.search(r'\.\w\w\w$',url).group(0)
# Get the file content using geturl()
- content = getURL(url)
+
if content:
- # Going to write them to standrad zip file (always zips in sratim)
- local_tmp_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
+ # Going to write them to file
+ local_tmp_file = os.path.join(tmp_sub_dir, filename)
log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext,
local_tmp_file))
try:
local_file_handle = open(local_tmp_file, "wb")
diff --git a/script.xbmc.subtitles/resources/lib/services/Subscene/logo.png
b/script.xbmc.subtitles/resources/lib/services/Subscene/logo.png
index ead2716..da7e67b 100644
Binary files a/script.xbmc.subtitles/resources/lib/services/Subscene/logo.png
and b/script.xbmc.subtitles/resources/lib/services/Subscene/logo.png differ
diff --git a/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
b/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
index e302735..07826bc 100644
--- a/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Subscene/service.py
@@ -4,7 +4,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2
import difflib
from utilities import languageTranslate, log
-main_url = "http://v2.subscene.com/"
+main_url = "http://subscene.com/"
debug_pretext = ""
# Seasons as strings for searching
@@ -16,48 +16,62 @@ seasons = seasons + ["Twenty-first", "Twenty-second",
"Twenty-third", "Twenty-fo
# Regular expression patterns
#====================================================================================================================
-# subtitle pattern example:
"""
- <tr>
- <td>
- <a class="a1"
href="/arabic/Magnolia/subtitle-311056.aspx" title="Subtitle - Magnolia -
Arabic">
- <span class="r0" >
-
- Arabic
- </span>
- <span
id="r311056">Magnolia.1999.720p.BluRay.x264-LEVERAGE</span>
- </a>
-
-
-
- </td>
- <td class="a3">1
- </td>
- <td><div id=imgEar title='Hearing Impaired'> </div>
- </td>
-
+ <td class="a1">
+ <a href="/subtitles/iron-man-3/english/772801">
+ <div class="visited">
+ <span class="l r neutral-icon">
+ English
+ </span>
+ <span>
+ Iron.Man.3.2013.720p.WEB-DL.H264-WEBiOS [PublicHD]
+ </span>
+ </div>
+ </a>
+ </td>
+ <td class="a3">
+ 1
+ </td>
+ <td class="a41">
+
+ </td>
+ <td class="a5">
+
+ <a href="/u/781496">
+ Aakiful Islam
+ </a>
+ </td>
+ <td class="a6">
+ <div>
+ Hearing Impaired. Suits all the WEB-DL Releases.
+ </div>
+ </td>
"""
-subtitle_pattern = "..<tr>.{5}<td>.{6}<a class=\"a1\"
href=\"/([^\n\r]{10,200}?-\d{3,10}.aspx)\" title=\"[^\n\r]{10,200}\">\
-[\r\n\t ]+?<span class=\"r(0|100)\" >[\r\n\t\ ]+([^\r\n\t]+?)
[\r\n\t]+</span>[\r\n\t ]+?<span id=\"r\d+\">([^\r\n\t]{5,500})</span>\
-[\r\n\t]+?</a>[\r\n\t ]+?</td>[\r\n\t ]+?<td class=\"a3\">1[\r\n\t\
]+?</td>[\r\n\t\ ]+?<td>(|.{52})\r\n\t\t\t</td>"
-# group(1) = downloadlink, group(2) = qualitycode, group(3) = language,
group(4) = filename, group(5) = hearing impaired
+subtitle_pattern = "<a href=\"(/subtitles/[^\"]+)\">\s+<div
class=\"visited\">\s+<span class=\"[^\"]+
(\w+-icon)\">\s+([^\r\n\t]+)\s+</span>\s+\
+<span>\s+([^\r\n\t]+)\s+</span>\s+</div>\s+</a>\s+</td>\s+<td
class=\"[^\"]+\">\s+[^\r\n\t]+\s+</td>\s+<td class=\"([^\"]+)\">"
+# group(1) = downloadlink, group(2) = qualitycode, group(3) = language,
group(4) = filename, group(5) = hearing impaired
# movie/seasonfound pattern example:
"""
- <a href="/inception/subtitles-80839.aspx" class=popular>
- Inception (2010)
- <dfn>(327)</dfn>
+ <div class="title">
+ <a href="/subtitles/the-big-bang-theory-fifth-season-2011">The Big
Bang Theory - Fifth Season (2011)</a>
+ </div>
+ <div class="subtle">
+
+ 547 subtitles
+ </div>
+
"""
-movie_season_pattern = "...<a
href=\"([^\n\r\t]*?/subtitles-\d{1,10}.aspx)\".{1,14}>\r\n{0,3}.{4}([^\n\r\t\&#]*?)
\((\d\d\d\d)\) \r\n{0,3}.{1,4}<dfn>\((.{1,5})\)</dfn>"
-# group(1) = link, group(2) = movie_season_title, group(3) = year
+movie_season_pattern = "<a
href=\"(/subtitles/[^\"]*)\">([^<]+)\((\d{4})\)</a>\s+</div>\s+<div
class=\"subtle\">\s+(\d+)"
+# group(1) = link, group(2) = movie_season_title, group(3) = year, group(4) =
num subtitles
# download link pattern example:
"""
- <a
href="/subtitle/download?mac=LxawhQiaMYm9O2AsoNMHXbXDYN2b4yBreI8TJIBfpdw7UIo1JP5566Sbb2ei_zUC0"
rel="nofollow" onclick="DownloadSubtitle(this)" id="downloadButton"
class="button Positive">
+ <a
href="/subtitle/download?mac=LxawhQiaMYm9O2AsoNMHXbXDYN2b4yBreI8TJIBfpdw7UIo1JP5566Sbb2ei_zUC0"
rel="nofollow" onclick="DownloadSubtitle(this)" id="downloadButton"
class="button Positive">
"""
downloadlink_pattern = "...<a href=\"(.+?)\" rel=\"nofollow\"
onclick=\"DownloadSubtitle"
# group(1) = link
@@ -138,16 +152,21 @@ def getallsubs(response_url, content, language, title,
subtitles_list, search_st
link = main_url + matches.group(1)
languageshort = languageTranslate(language,0,2)
filename = matches.group(4)
- hearing_imp = len(matches.group(5)) > 0
+ hearing_imp = (matches.group(5) == "a41")
+ rating = '0'
+ if matches.group(2) == "bad-icon":
+ continue
+ if matches.group(2) == "positive-icon":
+ rating = '5'
if search_string != "":
log( __name__ , "string.lower(filename) = >" +
string.lower(filename) + "<" )
log( __name__ , "string.lower(search_string) = >" +
string.lower(search_string) + "<" )
if
string.find(string.lower(filename),string.lower(search_string)) > -1:
log( __name__ ,"%s Subtitles found: %s, %s" %
(debug_pretext, languagefound, filename))
- subtitles_list.append({'rating': '0', 'movie': title,
'filename': filename, 'sync': False, 'link': link, 'language_flag': 'flags/' +
languageshort + '.gif', 'language_name': language, 'hearing_imp': hearing_imp})
+ subtitles_list.append({'rating': rating, 'movie': title,
'filename': filename, 'sync': False, 'link': link, 'language_flag': 'flags/' +
languageshort + '.gif', 'language_name': language, 'hearing_imp': hearing_imp})
else:
log( __name__ ,"%s Subtitles found: %s, %s" % (debug_pretext,
languagefound, filename))
- subtitles_list.append({'rating': '0', 'movie': title,
'filename': filename, 'sync': False, 'link': link, 'language_flag': 'flags/' +
languageshort + '.gif', 'language_name': language, 'hearing_imp': hearing_imp})
+ subtitles_list.append({'rating': rating, 'movie': title,
'filename': filename, 'sync': False, 'link': link, 'language_flag': 'flags/' +
languageshort + '.gif', 'language_name': language, 'hearing_imp': hearing_imp})
def geturl(url):
@@ -176,7 +195,7 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
if len(tvshow) > 0:
search_string = tvshow + " - " + seasons[int(season)] + " Season"
log( __name__ ,"%s Search string = %s" % (debug_pretext, search_string))
- url = main_url + "filmsearch.aspx?q=" + urllib.quote_plus(search_string)
+ url = main_url + "/subtitles/title.aspx?q=" +
urllib.quote_plus(search_string)
content, response_url = geturl(url)
if content is not None:
if re.search("subtitles-\d{2,10}\.aspx", response_url, re.IGNORECASE):
diff --git
a/script.xbmc.subtitles/resources/lib/services/SubtitlesGR/service.py
b/script.xbmc.subtitles/resources/lib/services/SubtitlesGR/service.py
index 8e5787e..91a7302 100644
--- a/script.xbmc.subtitles/resources/lib/services/SubtitlesGR/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/SubtitlesGR/service.py
@@ -190,16 +190,20 @@ def get_subtitles_list(searchstring, languageshort,
languagelong, subtitles_list
return
for subtitle in subtitles:
try:
- filename = re.compile('">(.+?)</a>').findall(subtitle)[0]
+ filename = re.compile('title = "(.+?)"').findall(subtitle)[0]
+ filename = filename.split("subtitles for")[-1]
+ filename = filename.strip()
id = re.compile('href="(.+?)"').findall(subtitle)[0]
try:
uploader =
re.compile('class="link_from">(.+?)</a>').findall(subtitle)[0]
+ uploader = uploader.strip()
if uploader == 'movieplace': uploader = 'GreekSubtitles'
filename = '[%s] %s' % (uploader, filename)
except:
pass
try:
downloads =
re.compile('class="latest_downloads">(.+?)</td>').findall(subtitle)[0]
+ downloads = re.sub("\D", "", downloads)
filename += ' [%s DLs]' % (downloads)
except:
pass
diff --git a/script.xbmc.subtitles/resources/lib/utilities.py
b/script.xbmc.subtitles/resources/lib/utilities.py
index f491a60..bcd385b 100644
--- a/script.xbmc.subtitles/resources/lib/utilities.py
+++ b/script.xbmc.subtitles/resources/lib/utilities.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import os
import re
@@ -29,9 +29,9 @@ CANCEL_DIALOG = ( 9, 10, 13, 92, 216, 247, 257, 275, 61467,
61448, )
SERVICE_DIR = os.path.join(__cwd__, "resources", "lib", "services")
LANGUAGES = (
-
+
# Full Language name[0] podnapisi[1] ISO 639-1[2] ISO 639-1 Code[3]
Script Setting Language[4] localized name id number[5]
-
+
("Albanian" , "29", "sq", "alb",
"0", 30201 ),
("Arabic" , "12", "ar", "ara",
"1", 30202 ),
("Belarusian" , "0" , "hy", "arm",
"2", 30203 ),
@@ -95,7 +95,7 @@ LANGUAGES = (
REGEX_EXPRESSIONS = [ '[Ss]([0-9]+)[][._-]*[Ee]([0-9]+)([^\\\\/]*)$',
- '[\._ \-]([0-9]+)x([0-9]+)([^\\/]*)',
# foo.1x09
+ '[\._ \-]([0-9]+)x([0-9]+)([^\\/]*)',
# foo.1x09
'[\._ \-]([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)',
# foo.109
'([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)',
'[\\\\/\\._ -]([0-9]+)([0-9][0-9])[^\\/]*',
@@ -115,46 +115,46 @@ class Pause:
def restore(self):
if self.player_state != xbmc.getCondVisibility('Player.Paused'):
xbmc.Player().pause()
-
+
def pause(self):
if not xbmc.getCondVisibility('Player.Paused'):
xbmc.Player().pause()
-
+
def log(module,msg):
- xbmc.log((u"### [%s-%s] - %s" %
(__scriptname__,module,msg,)).encode('utf-8'),level=xbmc.LOGDEBUG )
+ xbmc.log((u"### [%s-%s] - %s" %
(__scriptname__,module,msg,)).encode('utf-8'),level=xbmc.LOGDEBUG )
def regex_tvshow(compare, file, sub = ""):
sub_info = ""
tvshow = 0
-
+
for regex in REGEX_EXPRESSIONS:
- response_file = re.findall(regex, file)
- if len(response_file) > 0 :
+ response_file = re.findall(regex, file)
+ if len(response_file) > 0 :
log( __name__ , "Regex File Se: %s, Ep: %s," %
(str(response_file[0][0]),str(response_file[0][1]),) )
tvshow = 1
if not compare :
title = re.split(regex, file)[0]
- for char in ['[', ']', '_', '(', ')','.','-']:
+ for char in ['[', ']', '_', '(', ')','.','-']:
title = title.replace(char, ' ')
if title.endswith(" "): title = title[:-1]
return title,response_file[0][0], response_file[0][1]
else:
break
-
+
if (tvshow == 1):
- for regex in regex_expressions:
+ for regex in regex_expressions:
response_sub = re.findall(regex, sub)
if len(response_sub) > 0 :
try :
sub_info = "Regex Subtitle Ep: %s," % (str(response_sub[0][1]),)
if (int(response_sub[0][1]) == int(response_file[0][1])):
return True
- except: pass
+ except: pass
return False
if compare :
return True
else:
- return "","",""
+ return "","",""
def languageTranslate(lang, lang_from, lang_to):
for x in LANGUAGES:
@@ -166,11 +166,11 @@ def pause():
xbmc.Player().pause()
return True
else:
- return False
-
+ return False
+
def unpause():
if xbmc.getCondVisibility('Player.Paused'):
- xbmc.Player().pause()
+ xbmc.Player().pause()
def rem_files(directory):
try:
@@ -178,10 +178,10 @@ def rem_files(directory):
shutil.rmtree(directory)
except:
pass
-
+
if not xbmcvfs.exists(directory):
os.makedirs(directory)
-
+
def copy_files( subtitle_file, file_path ):
subtitle_set = False
try:
@@ -205,18 +205,18 @@ def normalizeString(str):
def hashFile(file_path, rar):
if rar:
return OpensubtitlesHashRar(file_path)
-
- log( __name__,"Hash Standard file")
+
+ log( __name__,"Hash Standard file")
longlongformat = 'q' # long long
bytesize = struct.calcsize(longlongformat)
f = xbmcvfs.File(file_path)
-
+
filesize = f.size()
hash = filesize
-
+
if filesize < 65536 * 2:
return "SizeError"
-
+
buffer = f.read(65536)
f.seek(max(0,filesize-65536),0)
buffer += f.read(65536)
@@ -226,7 +226,7 @@ def hashFile(file_path, rar):
(l_value,)= struct.unpack(longlongformat, buffer[size:size+bytesize])
hash += l_value
hash = hash & 0xFFFFFFFFFFFFFFFF
-
+
returnHash = "%016x" % hash
return filesize,returnHash
@@ -240,11 +240,11 @@ def OpensubtitlesHashRar(firsrarfile):
seek=0
for i in range(4):
f.seek(max(0,seek),0)
- a=f.read(100)
- type,flag,size=struct.unpack( '<BHH', a[2:2+5])
+ a=f.read(100)
+ type,flag,size=struct.unpack( '<BHH', a[2:2+5])
if 0x74==type:
if 0x30!=struct.unpack( '<B', a[25:25+1])[0]:
- raise Exception('Bad compression method! Work only for
"store".')
+ raise Exception('Bad compression method! Work only for
"store".')
s_partiizebodystart=seek+size
s_partiizebody,s_unpacksize=struct.unpack( '<II', a[7:7+2*4])
if (flag & 0x0100):
@@ -273,7 +273,7 @@ def addfilehash(name,hash,seek):
for i in range(8192):
hash+=struct.unpack('<q', f.read(8))[0]
hash =hash & 0xffffffffffffffff
- f.close()
+ f.close()
return hash
def hashFileMD5(file_path, buff_size=1048576):
@@ -298,7 +298,4 @@ def getShowId():
tvdbid_query = '{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShowDetails", "params": {"tvshowid": ' + str(tvshowid) + ',
"properties": ["imdbnumber"]}, "id": 1}'
return json.loads(xbmc.executeJSONRPC
(tvdbid_query))['result']['tvshowdetails']['imdbnumber']
except:
- log( __name__ ," Failed to find TVDBid in database")
-
-
-
+ log( __name__ ," Failed to find TVDBid in database")
diff --git a/script.xbmc.subtitles/resources/settings.xml
b/script.xbmc.subtitles/resources/settings.xml
index ba31727..9e80197 100644
--- a/script.xbmc.subtitles/resources/settings.xml
+++ b/script.xbmc.subtitles/resources/settings.xml
@@ -61,7 +61,11 @@
<setting id="SerialZone" type="bool" label="SerialZone.cz (Czech and
Slovak subs only)" default="false"/>
<setting id="Shooter" type="bool" label="Shooter.cn (Chinese and English
subs only)" default="false"/>
+
<setting id="Sratim" type="bool" label="Sratim.co.il" default="false"/>
+ <setting id="SRAemail" type="text" visible= "eq(-1,true)"
enable="eq(-1,true)" label="30098" default=""/>
+ <setting id="SRApass" type="text" option = "hidden" visible=
"eq(-2,true)" enable="eq(-2,true)" label="30099" default=""/>
+
<setting id="SubClub" type="bool" label="SubClub.eu" default="false"/>
<setting id="SubDB" type="bool" label="theSubDB.com" default="false"/>
<setting id="Subdivx" type="bool" label="Subdivx.com (Spanish subs
only)" default="false"/>
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 10 ++
.../resources/language/English/strings.po | 10 +-
.../resources/language/Hebrew/strings.po | 8 +
script.xbmc.subtitles/resources/lib/gui.py | 155 +++++++++---------
.../resources/lib/services/Napiprojekt/service.py | 7 +-
.../resources/lib/services/Sratim/service.py | 168 +++++++++++++++----
.../resources/lib/services/Subscene/logo.png | Bin 19169 -> 9161 bytes
.../resources/lib/services/Subscene/service.py | 87 ++++++----
.../resources/lib/services/SubtitlesGR/service.py | 6 +-
script.xbmc.subtitles/resources/lib/utilities.py | 65 ++++----
script.xbmc.subtitles/resources/settings.xml | 4 +
12 files changed, 334 insertions(+), 188 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons