The branch, eden-pre has been updated
via d1bf1a36d3dd6c8f5ffb2e37c2cde19901e20267 (commit)
from f3c111b804eb079a5b4e021f435f88537f151b25 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=d1bf1a36d3dd6c8f5ffb2e37c2cde19901e20267
commit d1bf1a36d3dd6c8f5ffb2e37c2cde19901e20267
Author: amet <[email protected]>
Date: Thu Jul 14 19:24:30 2011 +0200
[script.xbmc.subtitles] -v 2.9.15
- fix: titulky.com service
- fix: issues with auto search
diff --git a/script.xbmc.subtitles/addon.xml b/script.xbmc.subtitles/addon.xml
index 88f99c4..5478026 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="2.9.14"
+ version="2.9.15"
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 ff28426..a8ea0a9 100644
--- a/script.xbmc.subtitles/changelog.txt
+++ b/script.xbmc.subtitles/changelog.txt
@@ -1,3 +1,7 @@
+2.9.15
+- fix: titulky.com service
+- fix: issues with auto search
+
2.9.14
- fix: Service Legendas-Zone.org version 0.1.7
- fix: Use xbmc.log()
diff --git a/script.xbmc.subtitles/default.py b/script.xbmc.subtitles/default.py
index 1157170..1066001 100644
--- a/script.xbmc.subtitles/default.py
+++ b/script.xbmc.subtitles/default.py
@@ -1,44 +1,46 @@
# -*- coding: utf-8 -*-
-import sys
import os
+import sys
import xbmc
import xbmcaddon
-__settings__ = xbmcaddon.Addon(id='script.xbmc.subtitles')
-__language__ = __settings__.getLocalizedString
-__version__ = __settings__.getAddonInfo('version')
-__cwd__ = __settings__.getAddonInfo('path')
-__profile__ = xbmc.translatePath( __settings__.getAddonInfo('profile') )
-__scriptname__ = "XBMC Subtitles"
+__author__ = "amet,mr_blobby"
__scriptid__ = "script.xbmc.subtitles"
-__author__ = "Amet,mr_blobby"
+__scriptname__ = "XBMC Subtitles"
+
+__addon__ = xbmcaddon.Addon(id='script.xbmc.subtitles')
+
+__cwd__ = __addon__.getAddonInfo('path')
+__version__ = __addon__.getAddonInfo('version')
+__language__ = __addon__.getLocalizedString
+
+__profile__ = xbmc.translatePath( __addon__.getAddonInfo('profile') )
+__resource__ = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib'
) )
-BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( __cwd__, 'resources',
'lib' ) )
-sys.path.append (BASE_RESOURCE_PATH)
+sys.path.append (__resource__)
-from utilities import *
+import gui
+from utilities import log, pause, unpause, UserNotificationNotifier
-xbmc.log("### [%s] - Version: %s" %
(__scriptname__,__version__,),level=xbmc.LOGDEBUG )
+log( __name__ ,"Version: %s" % __version__)
if ( __name__ == "__main__" ):
-
- import gui
ui = gui.GUI( "script-XBMC-Subtitles-main.xml" , __cwd__ , "Default")
movieFullPath = ui.set_allparam()
- if (__settings__.getSetting( "auto_download" ) == "true") and
(__settings__.getSetting( "auto_download_file" ) != os.path.basename(
movieFullPath )):
+ if (__addon__.getSetting( "auto_download" ) == "true") and
(__addon__.getSetting( "auto_download_file" ) != os.path.basename(
movieFullPath )):
notification = UserNotificationNotifier(__scriptname__, __language__(764),
2000)
if not ui.Search_Subtitles(False):
- if not xbmc.getCondVisibility('Player.Paused') : xbmc.Player().pause()
#Pause if not paused
+ pause()
ui.doModal()
else:
notification.close(__language__(765), 1000)
else:
- if not xbmc.getCondVisibility('Player.Paused') : xbmc.Player().pause()
#Pause if not paused
+ pause()
ui.doModal()
del ui
- if xbmc.getCondVisibility('Player.Paused'): xbmc.Player().pause() # if
Paused, un-pause
+ unpause()
sys.modules.clear()
diff --git a/script.xbmc.subtitles/resources/language/Czech/strings.xml
b/script.xbmc.subtitles/resources/language/Czech/strings.xml
index 594397d..0dbb85f 100644
--- a/script.xbmc.subtitles/resources/language/Czech/strings.xml
+++ b/script.xbmc.subtitles/resources/language/Czech/strings.xml
@@ -8,16 +8,16 @@
<string id="642">Vyhledávám titulky %s</string>
<string id="646">PÅipojuji...</string>
<string id="649">Stahuji titulky...</string>
- <string id="652">Soubor s titulky je stažen a rozbalen</string>
+ <string id="652">Soubor s titulky byl stažen a rozbalen</string>
<string id="653">PÅipojenà selhalo</string>
<string id="654">Chyba pÅi rozbalovánà titulků</string>
<string id="655">Titulky k dispozici lokálnÄ</string>
<string id="656">Služba neodpovÄdÄla do Äasového limitu</string>
- <string id="657">No Subtitles Found!</string>
+ <string id="657">Titulky nenalezeny!</string>
<string id="744">titulků pro</string>
<string id="747">Hledat pomocà názvu složky</string>
<string id="748">Titulky nelze uložit do vybrané složky</string>
- <string id="750">Chcete tyto titulky aktivovat doÄasnÄ_</string>
+ <string id="750">Chcete tyto titulky aktivovat doÄasnÄ?</string>
<string id="751">Vložte název filmu (rok)</string>
<string id="755">Server je pÅetÞen, zkuste to prosÃm pozdÄji</string>
<string id="756">PÅihlášenà selhalo. Zkontroluje nastavenÃ.</string>
@@ -26,7 +26,8 @@
<string id="759">Vložte kontrolnà kód</string>
<string id="760">Dostupné služby</string>
<string id="761">Pro staženà tÄchto titulků je tÅeba
pÅihlášenÃ,[CR]nastavte prosÃm pÅihlaÅ¡ovacà údaje</string>
-
+ <string id="762">NastavenÃ</string>
+ <string id="763">Automaticky stáhnout prvnà 'sync' titulky</string>
<!-- Script Settings -->
<string id="30100">Jakyky</string>
@@ -53,7 +54,16 @@
<string id="30127">- Itasa heslo</string>
<string id="30128">- Titulky jméno</string>
<string id="30129">- Titulky heslo</string>
-
+ <string id="30130">Pokud nejsou titulky nalezeny, použÃt jinou
službu</string>
+ <string id="30131">Automaticky stáhnout prvnà "sync" titulky</string>
+ <string id="30132">- LegendasDivx jméno</string>
+ <string id="30133">- LegendasDivx heslo</string>
+ <string id="30134">- PTSubs jméno</string>
+ <string id="30135">- PTSubs heslo</string>
+ <string id="30136">- OmniSubs jméno</string>
+ <string id="30137">- OmniSubs heslo</string>
+ <string id="30138">- LegendasZone jméno</string>
+ <string id="30139">- LegendasZone heslo</string>
<!-- Languages -->
<string id="30201">Albanian</string>
diff --git a/script.xbmc.subtitles/resources/lib/gui.py
b/script.xbmc.subtitles/resources/lib/gui.py
index 4c88d6a..67c054e 100644
--- a/script.xbmc.subtitles/resources/lib/gui.py
+++ b/script.xbmc.subtitles/resources/lib/gui.py
@@ -6,11 +6,11 @@ import sys
import xbmc
import urllib
import socket
-import shutil
+import xbmcvfs
import xbmcgui
import unicodedata
+
from utilities import *
-import xbmcvfs
STATUS_LABEL = 100
LOADING_IMAGE = 110
@@ -20,7 +20,7 @@ CANCEL_DIALOG = ( 9, 10, 216, 247, 257, 275, 61467, 61448, )
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
__cwd__ = sys.modules[ "__main__" ].__cwd__
__profile__ = sys.modules[ "__main__" ].__profile__
@@ -32,11 +32,10 @@ class GUI( xbmcgui.WindowXMLDialog ):
pass
def onInit( self ):
-# self.set_allparam()
self.on_run()
def on_run( self ):
- if not self.checkSubs():
+ if not checkExistingSubs( self.sub_folder, self.file_original_path ):
self.getControl( 111 ).setVisible( False )
try:
self.list_services()
@@ -48,9 +47,8 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.Search_Subtitles()
except:
errno, errstr = sys.exc_info()[:2]
-# self.getControl( STATUS_LABEL ).setLabel( "Error:" + " " +
str(errstr) )
xbmc.sleep(2000)
- self.exit_script()
+ self.close()
def set_allparam(self):
self.list = []
@@ -62,39 +60,36 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.rar = False
self.stack = False
self.autoDownload = False
- movieFullPath = urllib.unquote(xbmc.Player().getPlayingFile())
# Full path of a playing file
- path = __settings__.getSetting( "subfolder" ) == "true"
# True for movie folder
- self.sub_folder = xbmc.translatePath(__settings__.getSetting(
"subfolderpath" )) # User specified subtitle folder
- self.year = xbmc.getInfoLabel("VideoPlayer.Year")
# Year
- self.season = str(xbmc.getInfoLabel("VideoPlayer.Season"))
# Season
- self.episode = str(xbmc.getInfoLabel("VideoPlayer.Episode"))
# Episode
- self.mansearch = __settings__.getSetting( "searchstr" ) == "true"
# Manual search string??
- self.parsearch = __settings__.getSetting( "par_folder" ) == "true"
# Parent folder as search string
- self.language_1 = languageTranslate(__settings__.getSetting( "Lang01"
), 4, 0) # Full language 1
- self.language_2 = languageTranslate(__settings__.getSetting( "Lang02"
), 4, 0) # Full language 2
- self.language_3 = languageTranslate(__settings__.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
- def_movie_service = __settings__.getSetting( "defmovieservice")
# Default Movie service
- def_tv_service = __settings__.getSetting( "deftvservice")
# Default TV Show service
-
-
- if (movieFullPath.find("http://") > -1 ):
+ movieFullPath = urllib.unquote(xbmc.Player().getPlayingFile())
# Full path of a playing file
+ path = __addon__.getSetting( "subfolder" ) == "true"
# True for movie folder
+ self.sub_folder = xbmc.translatePath(__addon__.getSetting(
"subfolderpath" )) # User specified subtitle folder
+ self.year = xbmc.getInfoLabel("VideoPlayer.Year")
# Year
+ self.season = str(xbmc.getInfoLabel("VideoPlayer.Season"))
# Season
+ self.episode = str(xbmc.getInfoLabel("VideoPlayer.Episode"))
# Episode
+ 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_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
+
+ if ( movieFullPath.find("http://") > -1 ):
if not xbmcvfs.exists(self.stream_sub_dir):
os.makedirs(self.stream_sub_dir)
else:
- self.rem_files(self.stream_sub_dir)
+ rem_files(self.stream_sub_dir)
self.sub_folder = self.stream_sub_dir
self.temp = True
- elif (movieFullPath.find("rar://") > -1 ):
+ elif ( movieFullPath.find("rar://") > -1 ):
self.rar = True
self.temp = True
- movieFullPath = movieFullPath.replace("rar://","")
+ movieFullPath = movieFullPath[6:]
if path:
self.sub_folder = os.path.dirname(os.path.dirname( movieFullPath ))
- elif (movieFullPath.find("stack://") > -1 ):
+ elif ( movieFullPath.find("stack://") > -1 ):
movieFullPath, stackSecond = movieFullPath.split(" , ")
movieFullPath = movieFullPath[8:]
self.stackSecond = os.path.basename(stackSecond)
@@ -144,10 +139,10 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.file_original_path = urllib.unquote ( movieFullPath ) #
Movie Path
- if __settings__.getSetting( "disable_hash_search" ) == "true":
+ if __addon__.getSetting( "disable_hash_search" ) == "true":
self.temp = True
- if (__settings__.getSetting( "fil_name" ) == "true"): #
Display Movie name or search string
+ if (__addon__.getSetting( "fil_name" ) == "true"): #
Display Movie name or search string
self.file_name = os.path.basename( movieFullPath )
else:
if (len(str(self.year)) < 1 ) :
@@ -160,25 +155,24 @@ class GUI( xbmcgui.WindowXMLDialog ):
if not xbmcvfs.exists(self.tmp_sub_dir):
os.makedirs(self.tmp_sub_dir)
else:
- self.rem_files(self.tmp_sub_dir)
-
+ rem_files(self.tmp_sub_dir)
-
- if (__settings__.getSetting( "auto_download" ) == "true") and
(__settings__.getSetting( "auto_download_file" ) != os.path.basename(
movieFullPath )):
+ if (__addon__.getSetting( "auto_download" ) == "true") and
(__addon__.getSetting( "auto_download_file" ) != os.path.basename(
movieFullPath )):
self.autoDownload = True
- __settings__.setSetting("auto_download_file", "")
+ __addon__.setSetting("auto_download_file", "")
for name in os.listdir(SERVICE_DIR):
- if os.path.isdir(os.path.join(SERVICE_DIR,name)) and
__settings__.getSetting( name ) == "true":
+ if os.path.isdir(os.path.join(SERVICE_DIR,name)) and
__addon__.getSetting( name ) == "true":
service_list.append( name )
service = name
if len(self.tvshow) > 0:
- if service_list.count(def_tv_service) > 0:
- service = def_tv_service
+ def_service = __addon__.getSetting( "deftvservice")
else:
- if service_list.count(def_movie_service) > 0:
- service = def_movie_service
+ def_service = __addon__.getSetting( "defmovieservice")
+
+ if service_list.count(def_service) > 0:
+ service = def_service
if len(service_list) > 0:
if len(service) < 1:
@@ -208,8 +202,6 @@ class GUI( xbmcgui.WindowXMLDialog ):
log( __name__ ,"Stacked(CD1/CD2)?: [%s]" % self.stack)
return movieFullPath
-
-###-------------------------- Search Subtitles -------------################
def Search_Subtitles( self, gui = True ):
self.subtitles_list = []
@@ -222,7 +214,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
if gui:
self.getControl( STATUS_LABEL ).setLabel( _( 646 ) )
msg = ""
- socket.setdefaulttimeout(float(__settings__.getSetting( "timeout" )))
+ socket.setdefaulttimeout(float(__addon__.getSetting( "timeout" )))
try:
self.subtitles_list, self.session_id, msg =
self.Service.search_subtitles( self.file_original_path, self.title,
self.tvshow, self.year, self.season, self.episode, self.temp, self.rar,
self.language_1, self.language_2, self.language_3, self.stack )
except socket.error:
@@ -239,12 +231,12 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( STATUS_LABEL ).setLabel( _( 642 ) % ( "...", ) )
if not self.subtitles_list:
- if ((__settings__.getSetting( "search_next" )== "true") and
(len(self.next) > 1)):
+ if ((__addon__.getSetting( "search_next" )== "true") and (len(self.next)
> 1)):
xbmc.sleep(1500)
self.next.remove(self.service)
self.service = self.next[0]
log( __name__ ,"Auto Searching '%s' Service" % (self.service,) )
- self.Search_Subtitles()
+ self.Search_Subtitles(gui)
else:
self.next = list(self.service_list)
if gui:
@@ -267,7 +259,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
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)):
self.Download_Subtitles(itemCount, True, gui)
- __settings__.setSetting("auto_download_file", os.path.basename(
self.file_original_path ))
+ __addon__.setSetting("auto_download_file", os.path.basename(
self.file_original_path ))
return True
break
else:
@@ -287,7 +279,6 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.setFocusId( SUBTITLES_LIST )
self.getControl( SUBTITLES_LIST ).selectItem( 0 )
return False
-###-------------------------- Download Subtitles -------------################
def Download_Subtitles( self, pos, auto = False, gui = True ):
if gui:
@@ -304,7 +295,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
else:
sub_ext = os.path.splitext( file )[1]
sub_name = os.path.splitext( os.path.basename( self.file_original_path )
)[0]
- if (__settings__.getSetting( "lang_to_end" ) == "true"):
+ if (__addon__.getSetting( "lang_to_end" ) == "true"):
file_name = "%s.%s%s" % ( sub_name, sub_lang, sub_ext )
else:
file_name = "%s%s" % ( sub_name, sub_ext )
@@ -319,12 +310,12 @@ class GUI( xbmcgui.WindowXMLDialog ):
log( __name__ ,"found .sub+.idx pair %s + %s" %
(file_from,file_from[:-3]+"idx"))
files_list.append((file_from[:-3]+"idx",file_to[:-3]+"idx"))
for cur_file_from, cur_file_to in files_list:
- subtitle_set,file_path = self.copy_files( cur_file_from, cur_file_to
)
+ subtitle_set,file_path = copy_files( cur_file_from, cur_file_to )
# Choose the last pair in the list, second item (destination file)
if subtitle_set:
xbmc.Player().setSubtitles(files_list[-1][1])
- self.rem_files(self.tmp_sub_dir)
- self.exit_script()
+ rem_files(self.tmp_sub_dir)
+ self.close()
else:
if gui:
self.getControl( STATUS_LABEL ).setLabel( _( 654 ) )
@@ -336,8 +327,6 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.setFocusId( window_list )
self.getControl( window_list ).selectItem( 0 )
-###-------------------------- Extract, Rename & Activate Subtitles
-------------################
-
def Extract_Subtitles( self, zip_subs, subtitle_lang, gui = True ):
xbmc.executebuiltin('XBMC.Extract("%s","%s")' %
(zip_subs,self.tmp_sub_dir,))
xbmc.sleep(1000)
@@ -374,23 +363,23 @@ class GUI( xbmcgui.WindowXMLDialog ):
subtitle_file, file_path =
self.create_name(zip_entry,sub_filename,subtitle_lang)
elif (re.split("(?x)(?i)\CD(\d)", zip_entry)[1]) ==
(re.split("(?x)(?i)\CD(\d)", self.stackSecond)[1]):
subtitle_file, file_path =
self.create_name(zip_entry,self.stackSecond,subtitle_lang)
- subtitle_set,file_path = self.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
else:
- subtitle_set,subToActivate = self.copy_files( subtitle_file,
file_path )
+ subtitle_set,subToActivate = copy_files( subtitle_file,
file_path )
if not subtitle_set:
for zip_entry in files:
if os.path.splitext( zip_entry )[1] in exts:
subtitle_file, file_path =
self.create_name(zip_entry,sub_filename,subtitle_lang)
- subtitle_set,subToActivate = self.copy_files( subtitle_file,
file_path )
+ subtitle_set,subToActivate = copy_files( subtitle_file, file_path
)
if subtitle_set :
xbmc.Player().setSubtitles(subToActivate)
- self.exit_script()
+ self.close()
else:
if gui:
self.getControl( STATUS_LABEL ).setLabel( _( 654 ) )
@@ -401,35 +390,14 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.list_services()
self.setFocusId( window_list )
self.getControl( window_list ).selectItem( 0 )
-
-###-------------------------- Create name -------------################
def create_name(self,zip_entry,sub_filename,subtitle_lang):
- if (__settings__.getSetting( "lang_to_end" ) == "true"):
+ if (__addon__.getSetting( "lang_to_end" ) == "true"):
file_name = "%s.%s%s" % ( os.path.splitext( sub_filename )[0],
subtitle_lang, os.path.splitext( zip_entry )[1] )
else:
file_name = "%s%s" % ( os.path.splitext( sub_filename )[0],
os.path.splitext( zip_entry )[1] )
return os.path.join(self.tmp_sub_dir, zip_entry),
os.path.join(self.sub_folder, file_name)
-###-------------------------- Copy files -------------################
-
- def copy_files( self, subtitle_file, file_path ):
- subtitle_set = False
- try:
- xbmcvfs.copy(subtitle_file, file_path)
- log( __name__ ,"vfs module copy %s -> %s" % (subtitle_file, file_path))
- subtitle_set = True
- except :
- dialog = xbmcgui.Dialog()
- selected = dialog.yesno( __scriptname__ , _( 748 ), _( 750 ),"" )
- if selected == 1:
- file_path = subtitle_file
- subtitle_set = True
-
- return subtitle_set, file_path
-
-###-------------------------- List Available Services
-------------################
-
def list_services( self ):
self.list = []
if self.newWindow:
@@ -463,8 +431,6 @@ class GUI( xbmcgui.WindowXMLDialog ):
listitem.setProperty( "man", "true" )
self.list.append("Set")
self.getControl( window_list ).addItem( listitem )
-
-###-------------------------- Manual search Keyboard
-------------################
def keyboard(self, parent):
dir, self.year =
xbmc.getCleanMovieTitle(os.path.split(os.path.split(self.file_original_path)[0])[1])
@@ -486,71 +452,33 @@ class GUI( xbmcgui.WindowXMLDialog ):
else:
self.file_name = self.title
self.tvshow = ""
- self.Search_Subtitles()
-
-###-------------------------- Click -------------################
+ self.Search_Subtitles()
def onClick( self, controlId ):
- downloaded = False
- if controlId == 120 or controlId == 150:
- if controlId == 120:
- if self.newWindow:
- self.Download_Subtitles( self.getControl( SUBTITLES_LIST
).getSelectedPosition() )
- downloaded = True
- else:
- selection = str(self.list[self.getControl( SUBTITLES_LIST
).getSelectedPosition()])
- if selection.isdigit():
- log( __name__ , "Selected : [%s]" % (selection, ) )
- self.Download_Subtitles( int(selection) )
- downloaded = True
+ if controlId == SUBTITLES_LIST:
+ if self.newWindow:
+ self.Download_Subtitles( self.getControl( SUBTITLES_LIST
).getSelectedPosition() )
else:
- selection = str(self.list[self.getControl( SERVICES_LIST
).getSelectedPosition()])
- self.setFocusId( 120 )
-
- if not downloaded:
- if selection == "Man":
- self.keyboard(False)
- elif selection == "Par":
- self.keyboard(True)
- elif selection == "Set":
- __settings__.openSettings()
- self.set_allparam()
- self.on_run()
- else:
- self.service = selection
- self.Search_Subtitles()
-
-###-------------------------- Remove temp files -------------################
-
- def rem_files( self, directory):
- try:
- for root, dirs, files in os.walk(directory, topdown=False):
- for items in dirs:
- shutil.rmtree(os.path.join(root, items), ignore_errors=True,
onerror=None)
- for name in files:
- os.remove(os.path.join(root, name))
- except:
- try:
- for root, dirs, files in os.walk(directory, topdown=False):
- for items in dirs:
- shutil.rmtree(os.path.join(root, items).decode("utf-8"),
ignore_errors=True, onerror=None)
- for name in files:
- os.remove(os.path.join(root, name).decode("utf-8"))
- except:
- pass
-
-###-------------------------- Check existing subs
-------------################
-
- def checkSubs(self):
- sub_exts = ["srt", "sub", "txt", "smi", "ssa", "ass" ]
- for i in range(3):
- for sub_ext in sub_exts:
- exec("lang = languageTranslate(self.language_%s, 0, 2)" % (str(i+1)) )
- if xbmcvfs.exists("%s.%s.%s" %
(os.path.join(self.sub_folder,os.path.splitext( os.path.basename(
self.file_original_path ) )[0]),lang ,sub_ext,)):
- return True
- return False
-
-###-------------------------- On Focus -------------################
+ selection = str(self.list[self.getControl( SUBTITLES_LIST
).getSelectedPosition()])
+ if selection.isdigit():
+ log( __name__ , "Selected : [%s]" % (selection, ) )
+ self.Download_Subtitles( int(selection) )
+
+ elif controlId == SERVICES_LIST:
+ selection = str(self.list[self.getControl( SERVICES_LIST
).getSelectedPosition()])
+ self.setFocusId( 120 )
+
+ if selection == "Man":
+ self.keyboard(False)
+ elif selection == "Par":
+ self.keyboard(True)
+ elif selection == "Set":
+ __addon__.openSettings()
+ self.set_allparam()
+ self.on_run()
+ else:
+ self.service = selection
+ self.Search_Subtitles()
def onFocus( self, controlId ):
self.controlId = controlId
@@ -560,13 +488,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
except:
pass
-###-------------------------- "Esc" , "Back" button
-------------################
-
def onAction( self, action ):
if ( action.getId() in CANCEL_DIALOG):
- self.exit_script()
-
-###-------------------------- Exit script -------------################
+ self.close()
- def exit_script( self, restart=False ):
- self.close()
diff --git a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
index c80ea6e..6732337 100644
--- a/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Bierdopje/service.py
@@ -4,7 +4,6 @@ import os, sys, re, xbmc, xbmcgui, string, urllib,
xml.etree.ElementTree as XMLT
from utilities import log
_ = sys.modules[ "__main__" ].__language__
-__settings__ = sys.modules[ "__main__" ].__settings__
__profile__ = sys.modules[ "__main__" ].__profile__
apiurl = "http://api.bierdopje.com/"
diff --git a/script.xbmc.subtitles/resources/lib/services/Itasa/service.py
b/script.xbmc.subtitles/resources/lib/services/Itasa/service.py
index 5df9130..f02d1f7 100644
--- a/script.xbmc.subtitles/resources/lib/services/Itasa/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Itasa/service.py
@@ -4,7 +4,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib,
urllib2, cookielib
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
main_url = "http://www.italiansubs.net/"
@@ -75,8 +75,8 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
if len(tvshow) > 0:
italian = 0
if (string.lower(lang1) == "italian") or (string.lower(lang2) ==
"italian") or (string.lower(lang3) == "italian"):
- username = __settings__.getSetting( "ITuser" )
- password = __settings__.getSetting( "ITpass" )
+ username = __addon__.getSetting( "ITuser" )
+ password = __addon__.getSetting( "ITpass" )
if login(username, password):
log( __name__ , " Login successful")
content= geturl(main_url +
'index.php?option=com_remository&Itemid=6')
@@ -126,8 +126,8 @@ def search_subtitles( file_original_path, title, tvshow,
year, season, episode,
def download_subtitles (subtitles_list, pos, zip_subs, tmp_sub_dir,
sub_folder, session_id): #standard input
- username = __settings__.getSetting( "ITuser" )
- password = __settings__.getSetting( "ITpass" )
+ username = __addon__.getSetting( "ITuser" )
+ password = __addon__.getSetting( "ITpass" )
if login(username, password):
log( __name__ , " Login successful")
id = subtitles_list[pos][ "id" ]
diff --git
a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
index 16631ca..32eeb08 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasDivx/service.py
@@ -53,7 +53,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib,
urllib2, cookielib, shu
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
__cwd__ = sys.modules[ "__main__" ].__cwd__
main_url = "http://www.legendasdivx.com/"
@@ -287,8 +287,8 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
sync = subtitles_list[pos][ "sync" ]
log( __name__ ,"%s Fetching id using url %s" % (debug_pretext, id))
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "LDivxuser" )
- password = __settings__.getSetting( "LDivxpass" )
+ username = __addon__.getSetting( "LDivxuser" )
+ password = __addon__.getSetting( "LDivxpass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
diff --git a/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
b/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
index 5351c54..b75569e 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasTV/service.py
@@ -18,7 +18,7 @@ YEAR_MAX_ERROR = 1
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
def search_subtitles( file_original_path, title, tvshow, year, season,
episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
cookie = LegendasLogin()
@@ -141,8 +141,8 @@ def LegendasLogin(cj=0):
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
- username = __settings__.getSetting( "LTVuser" )
- password = __settings__.getSetting( "LTVpass" )
+ username = __addon__.getSetting( "LTVuser" )
+ password = __addon__.getSetting( "LTVpass" )
login_data =
urllib.urlencode({'txtLogin':username,'txtSenha':password})
request =
urllib2.Request(base_url+'/login_verificar.php',login_data)
response = urllib2.urlopen(request).read()
diff --git
a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
index a4153bd..fac28b0 100644
--- a/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/LegendasZone/service.py
@@ -25,7 +25,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib,
urllib2, cookielib, shu
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
__cwd__ = sys.modules[ "__main__" ].__cwd__
main_url = "http://www.legendas-zone.org/"
@@ -57,8 +57,8 @@ def msg(text, timeout):
def getallsubs(searchstring, languageshort, languagelong, file_original_path,
subtitles_list, searchstring_notclean):
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "LZuser" )
- password = __settings__.getSetting( "LZpass" )
+ username = __addon__.getSetting( "LZuser" )
+ password = __addon__.getSetting( "LZpass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
@@ -407,8 +407,8 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
sync = subtitles_list[pos][ "sync" ]
log( __name__ ,"%s Fetching id using url %s" % (debug_pretext, id))
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "LZuser" )
- password = __settings__.getSetting( "LZpass" )
+ username = __addon__.getSetting( "LZuser" )
+ password = __addon__.getSetting( "LZpass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
diff --git a/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
b/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
index fbff5b3..3c7e22e 100644
--- a/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/OmniSubs/service.py
@@ -17,7 +17,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib,
urllib2, cookielib, shu
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
main_url = "http://www.omnisubs.net/"
debug_pretext = "OmniSubs"
@@ -40,8 +40,8 @@ subtitle_pattern =
"<tr><td><a\shref=\"(.+?)\">(.+?)</a></td><td>(.+?)</td><td>(
def getallsubs(searchstring, languageshort, languagelong, file_original_path,
subtitles_list, searchstring_notclean):
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "Omniuser" )
- password = __settings__.getSetting( "Omnipass" )
+ username = __addon__.getSetting( "Omniuser" )
+ password = __addon__.getSetting( "Omnipass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
@@ -231,8 +231,8 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
sync = subtitles_list[pos][ "sync" ]
log( __name__ ,"%s Fetching id using url %s" % (debug_pretext, id))
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "Omniuser" )
- password = __settings__.getSetting( "Omnipass" )
+ username = __addon__.getSetting( "Omniuser" )
+ password = __addon__.getSetting( "Omnipass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
diff --git a/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
b/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
index 4e33ec7..81171bd 100644
--- a/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/PTSubs/service.py
@@ -17,7 +17,7 @@ import os, sys, re, xbmc, xbmcgui, string, time, urllib,
urllib2, cookielib, shu
from utilities import log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
main_url = "http://www.pt-subs.net/site/"
debug_pretext = "PT-SUBS"
@@ -40,8 +40,8 @@ subtitle_pattern =
"<tr><td><a\shref=\"(.+?)\">(.+?)</a></td><td>(.+?)</td><td>(
def getallsubs(searchstring, languageshort, languagelong, file_original_path,
subtitles_list, searchstring_notclean):
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "PTSuser" )
- password = __settings__.getSetting( "PTSpass" )
+ username = __addon__.getSetting( "PTSuser" )
+ password = __addon__.getSetting( "PTSpass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
@@ -225,8 +225,8 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
sync = subtitles_list[pos][ "sync" ]
log( __name__ ,"%s Fetching id using url %s" % (debug_pretext, id))
#Grabbing login and pass from xbmc settings
- username = __settings__.getSetting( "PTSuser" )
- password = __settings__.getSetting( "PTSpass" )
+ username = __addon__.getSetting( "PTSuser" )
+ password = __addon__.getSetting( "PTSpass" )
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
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 8515020..e9078db 100644
--- a/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
+++ b/script.xbmc.subtitles/resources/lib/services/Podnapisi/pn_utilities.py
@@ -17,8 +17,8 @@ except ImportError:
from md5 import md5
from sha256 import sha256
-_ = sys.modules[ "__main__" ].__language__
-__settings__ = sys.modules[ "__main__" ].__settings__
+_ = sys.modules[ "__main__" ].__language__
+__addon__ = sys.modules[ "__main__" ].__addon__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__version__ = sys.modules[ "__main__" ].__version__
@@ -73,11 +73,11 @@ class OSDBServer:
try:
init = podserver.initiate(USER_AGENT)
hash = md5()
- hash.update(__settings__.getSetting( "PNpass" ))
+ hash.update(__addon__.getSetting( "PNpass" ))
password256 = sha256(str(hash.hexdigest()) +
str(init['nonce'])).hexdigest()
if str(init['status']) == "200":
pod_session = init['session']
- podserver.authenticate(pod_session, __settings__.getSetting( "PNuser"
), password256)
+ podserver.authenticate(pod_session, __addon__.getSetting( "PNuser" ),
password256)
podserver.setFilters(pod_session, True, lang , False)
search = podserver.search(pod_session , hash_pod)
if str(search['status']) == "200" and len(search['results']) > 0 :
diff --git a/script.xbmc.subtitles/resources/lib/services/Titulky/logo.png
b/script.xbmc.subtitles/resources/lib/services/Titulky/logo.png
index 6109692..91e7432 100644
Binary files a/script.xbmc.subtitles/resources/lib/services/Titulky/logo.png
and b/script.xbmc.subtitles/resources/lib/services/Titulky/logo.png differ
diff --git a/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
b/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
index 4099689..aa18b6e 100644
--- a/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
+++ b/script.xbmc.subtitles/resources/lib/services/Titulky/service.py
@@ -14,26 +14,28 @@ from utilities import languageTranslate, log
_ = sys.modules[ "__main__" ].__language__
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__cwd__ = sys.modules[ "__main__" ].__cwd__
-__settings__ = sys.modules[ "__main__" ].__settings__
+__addon__ = sys.modules[ "__main__" ].__addon__
+
"""
- <tr class="row2">
- <td><a href="Pulp-Fiction-118518.htm" >Pulp
Fiction</a></td>
- <td align="center"><a class="fixedTip"
title="Pulp.Fiction.1994.720p.BluRay.x264-SiNNERS"><img src="img/ico/rel.gif"
atl="release"/></a></td>
- <td> </td>
- <td>1994</td>
- <td>18.11.2008</td>
- <td align="right">681</td>
- <td>CZ</td>
- <td>1</td>
- <td align="right">8138.46MB</td>
- <td>
- <a href="" onclick="UD('119203');return false;" >
aAaX</a>
- </td>
+<tr class="r1">
+ <td><a href="Animal-Farm-96061.htm" >Animal Farm</a></td>
+ <td align="center"><a class="fixedTip"
title="Animal.Farm.1954.DVDRip.XViD.iNT-JoLLyRoGeR"><img
src="css/new/verze-release.png" atl="release"/></a></td>
+ <td> </td>
+ <td>1954</td>
+ <td>15.2.2008</td>
+ <td align="right">2415</td>
+ <td><img alt="CZ" src="css/new/flag-CZ-small.gif" /></td>
+ <td>1</td>
+ <td align="right">699.16MB</td>
+ <td>
+ <a href="javascript:void(0)"
onclick="UD('126284');return false;" > DaftXK</a>
+ </td>
</tr>
+
"""
-subtitle_pattern='..<tr class=\"row[12]\">\s+?<td?[= \w\"]+><a
href=\"[\w-]+-(?P<id>\d+).htm\"[ ]?>(?P<title>[\w\- ]*)</a></td>\s+?<td?[=
\w\"]+>(<a?[= \w\"]+title=\"(?P<sync>[,\{\}\w.\d \(\)\]\[-]+)\"><img?[=
\w\\./"]+></a>)?</td>\s+?<td?[= \w\"]+>(?P<tvshow>[\w\;\&]+)</td>\s+<td?[=
\w\"]+>(?P<year>\d+)</td>\s+<td?[= \w\"]+>[\w\;\&\.\d]+</td>\s+<td?[=
\w\"]+>(?P<downloads>\d+)</td>\s+<td?[= \w\"]+>(?P<lang>\w{2})</td>\s+<td?[=
\w\"]+>(?P<cds>\w+)</td>\s+<td?[= \w\"]+>(?P<size>[\w\.]+)MB</td>'
+subtitle_pattern='<tr class=\"r[12]*\">\s+<td[^>]*><a
href=\"[\w-]+-(?P<id>\d+).htm\"[
]?>(?P<title>[^<]+)</a></td>\s+?<td[^>]*>(<a?[=
\w\"]+title=\"(?P<sync>[^\"]+)\"><img[^>]+></a>)?</td>\s+?<td[^>]*>(?P<tvshow>[^<]+)</td>\s+<td[^>]*>(?P<year>\d+)</td>\s+<td[^<]+</td>\s+<td[^>]*>(?P<downloads>\d+)</td>\s+<td?[^>]*><img
alt=\"(?P<lang>\w{2})\"[^\>]+></td>\s+<td>(?P<cds>\w+)</td>\s+<td[^>]+>(?P<size>[\w\.]+)MB</td>\s+<td>\s+(<a[^<]+</a>)?(<i[^<]+</i>)?\s+</td>\s+</tr>'
control_image_pattern='(secode.php\?[\w\d=]+)'
session_id_pattern='secode.php\?PHPSESSID=([\w\d]+)'
@@ -43,7 +45,7 @@ countdown_pattern='CountDown\((\d+)\)'
<a rel="nofollow" id="downlink"
href="/idown.php?id=48504441">www.titulky.com/idown.php?id=48504441</a>
"""
-sublink_pattern='<a?[= \w\"]+href="([\w\.\?\d=/]+)\"'
+sublink_pattern='<a?[= \w\"]+href="([^\"]+)\"'
def search_subtitles( file_original_path, title, tvshow, year, season,
episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
# need to filter titles like <Localized movie name> (<Movie name>)
br_index = title.find('(')
@@ -61,8 +63,8 @@ def download_subtitles (subtitles_list, pos, zip_subs,
tmp_sub_dir, sub_folder,
subtitle_id = subtitles_list[pos][ 'ID' ]
client = TitulkyClient()
- username = __settings__.getSetting( "Titulkyuser" )
- password = __settings__.getSetting( "Titulkypass" )
+ username = __addon__.getSetting( "Titulkyuser" )
+ password = __addon__.getSetting( "Titulkypass" )
if password == '' or username == '':
log(__name__,'Credentials to Titulky.com not provided')
else:
@@ -179,7 +181,7 @@ class TitulkyClient(object):
subtitles_list = []
max_downloads=1
for matches in re.finditer(subtitle_pattern, content,
re.IGNORECASE | re.DOTALL):
- # print matches.group('id') +' '
+matches.group('title')+' '+ str(matches.group('sync'))+' '+
matches.group('tvshow')+' '+ matches.group('year')+' '+
matches.group('downloads')+' '+ matches.group('lang')+' '+
matches.group('cds')+' '+matches.group('size')
+ # print matches.group('id') +' '
+matches.group('title')+' '+ str(matches.group('sync'))+' '+
matches.group('tvshow')+' '+ matches.group('year')+' '+
matches.group('downloads')+' '+ matches.group('lang')+' '+
matches.group('cds')+' '+matches.group('size')
file_name = matches.group('sync')
if file_name == None: # if no sync info is found, just
use title instead of None
file_name = matches.group('title')
diff --git a/script.xbmc.subtitles/resources/lib/utilities.py
b/script.xbmc.subtitles/resources/lib/utilities.py
index d475ac5..7271de1 100644
--- a/script.xbmc.subtitles/resources/lib/utilities.py
+++ b/script.xbmc.subtitles/resources/lib/utilities.py
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
-import sys
import os
-import xbmc
import re
+import sys
+import xbmc
import struct
+import xbmcvfs
+import shutil
+import xbmcgui
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
-###------------------------- Languages ------------------###############
-
LANGUAGES = (
# Full Language name[0] podnapisi[1] ISO 639-1[2] ISO 639-1 Code[3]
Script Setting Language[4]
@@ -76,15 +77,7 @@ LANGUAGES = (
("Chinese (Simplified)" , "17", "zh", "chi",
"100") )
-###------------------------- Log ------------------###############
-
-def log(module,msg):
- xbmc.log("### [%s-%s] - %s" %
(__scriptname__,module,msg,),level=xbmc.LOGDEBUG )
-
-###-------------------------- match sub to file -------------################
-
-def regex_tvshow(compare, file, sub = ""):
- regex_expressions = [ '[Ss]([0-9]+)[][._-]*[Ee]([0-9]+)([^\\\\/]*)$',
+REGEX_EXPRESSIONS = [ '[Ss]([0-9]+)[][._-]*[Ee]([0-9]+)([^\\\\/]*)$',
'[\._ \-]([0-9]+)x([0-9]+)([^\\/]*)',
# foo.1x09
'[\._ \-]([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)',
# foo.109
'([0-9]+)([0-9][0-9])([\._ \-][^\\/]*)',
@@ -96,11 +89,30 @@ def regex_tvshow(compare, file, sub = ""):
's([0-9]+)ep([0-9]+)[^\\/]*',
#foo - s01ep03, foo - s1ep03
'[Ss]([0-9]+)[][ ._-]*[Ee]([0-9]+)([^\\\\/]*)$',
'[\\\\/\\._ \\[\\(-]([0-9]+)x([0-9]+)([^\\\\/]*)$'
- ]
+ ]
+
+
+
+class UserNotificationNotifier:
+ def __init__(self, title, initialMessage, time = -1):
+ self.__title = title
+ xbmc.executebuiltin("Notification(%s,%s,%i)" % (title, initialMessage,
time))
+
+ def update(self, message, time = -1):
+ xbmc.executebuiltin("Notification(%s,%s,-1)" % (self.__title, message,
time))
+
+ def close(self, message, time = -1):
+ xbmc.executebuiltin("Notification(%s,%s,%i)" % (self.__title, message,
time))
+
+
+def log(module,msg):
+ xbmc.log("### [%s-%s] - %s" %
(__scriptname__,module,msg,),level=xbmc.LOGDEBUG )
+
+def regex_tvshow(compare, file, sub = ""):
sub_info = ""
tvshow = 0
- for regex in regex_expressions:
+ for regex in REGEX_EXPRESSIONS:
response_file = re.findall(regex, file)
if len(response_file) > 0 :
print "Regex File Se: %s, Ep: %s," %
(str(response_file[0][0]),str(response_file[0][1]),)
@@ -129,21 +141,59 @@ def regex_tvshow(compare, file, sub = ""):
else:
return "","",""
-
-
def languageTranslate(lang, lang_from, lang_to):
for x in LANGUAGES:
if lang == x[lang_from] :
return x[lang_to]
-
-class UserNotificationNotifier:
- def __init__(self, title, initialMessage, time = -1):
- self.__title = title
- xbmc.executebuiltin("Notification(%s,%s,%i)" % (title, initialMessage,
time))
+def pause():
+ if not xbmc.getCondVisibility('Player.Paused'):
+ xbmc.Player().pause()
- def update(self, message, time = -1):
- xbmc.executebuiltin("Notification(%s,%s,-1)" % (self.__title, message,
time))
+def unpause():
+ if xbmc.getCondVisibility('Player.Paused'):
+ xbmc.Player().pause()
- def close(self, message, time = -1):
- xbmc.executebuiltin("Notification(%s,%s,%i)" % (self.__title, message,
time))
+def rem_files(directory):
+ try:
+ for root, dirs, files in os.walk(directory, topdown=False):
+ for items in dirs:
+ print os.path.join(root, items)
+ shutil.rmtree(os.path.join(root, items), ignore_errors=True,
onerror=None)
+ print files
+ for name in files:
+ os.remove(os.path.join(root, name))
+ except:
+ try:
+ for root, dirs, files in os.walk(directory, topdown=False):
+ for items in dirs:
+ shutil.rmtree(os.path.join(root, items).decode("utf-8"),
ignore_errors=True, onerror=None)
+ for name in files:
+ os.remove(os.path.join(root, name).decode("utf-8"))
+ except:
+ pass
+
+def copy_files( subtitle_file, file_path ):
+ subtitle_set = False
+ try:
+ xbmcvfs.copy(subtitle_file, file_path)
+ log( __name__ ,"vfs module copy %s -> %s" % (subtitle_file, file_path))
+ subtitle_set = True
+ except :
+ dialog = xbmcgui.Dialog()
+ selected = dialog.yesno( __scriptname__ , _( 748 ), _( 750 ),"" )
+ if selected == 1:
+ file_path = subtitle_file
+ subtitle_set = True
+
+ return subtitle_set, file_path
+
+def checkExistingSubs( subFolder, videoFile ):
+ sub_exts = [".srt", ".sub", ".txt", ".smi", ".ssa", ".ass" ]
+ list_files = os.listdir(subFolder)
+ file_name = os.path.splitext( os.path.basename( videoFile ) )[0]
+ for file in list_files:
+ if (os.path.splitext( file )[1] in sub_exts) and
(file.startswith(file_name)):
+ return True
+
+ return False
-----------------------------------------------------------------------
Summary of changes:
script.xbmc.subtitles/addon.xml | 2 +-
script.xbmc.subtitles/changelog.txt | 4 +
script.xbmc.subtitles/default.py | 38 ++--
.../resources/language/Czech/strings.xml | 20 ++-
script.xbmc.subtitles/resources/lib/gui.py | 224 +++++++-------------
.../resources/lib/services/Bierdopje/service.py | 1 -
.../resources/lib/services/Itasa/service.py | 10 +-
.../resources/lib/services/LegendasDivx/service.py | 6 +-
.../resources/lib/services/LegendasTV/service.py | 6 +-
.../resources/lib/services/LegendasZone/service.py | 10 +-
.../resources/lib/services/OmniSubs/service.py | 10 +-
.../resources/lib/services/PTSubs/service.py | 10 +-
.../lib/services/Podnapisi/pn_utilities.py | 8 +-
.../resources/lib/services/Titulky/logo.png | Bin 32992 -> 5302 bytes
.../resources/lib/services/Titulky/service.py | 40 ++--
script.xbmc.subtitles/resources/lib/utilities.py | 102 +++++++---
.../Default/media/DialogCloseButton-focus.png | Bin 5216 -> 5216 bytes
.../skins/Default/media/DialogCloseButton.png | Bin 4522 -> 4522 bytes
.../resources/skins/Default/media/HomeBladeSub.png | Bin 54149 -> 0 bytes
.../skins/Default/media/MediaBladeSub.png | Bin 0 -> 16353 bytes
20 files changed, 240 insertions(+), 251 deletions(-)
copy
script.games.rom.collection.browser/resources/skins/Default/media/rcb-DialogCloseButton-focus.png
=>
script.xbmc.subtitles/resources/skins/Default/media/DialogCloseButton-focus.png
(100%)
copy
script.games.rom.collection.browser/resources/skins/Default/media/rcb-DialogCloseButton.png
=> script.xbmc.subtitles/resources/skins/Default/media/DialogCloseButton.png
(100%)
delete mode 100644
script.xbmc.subtitles/resources/skins/Default/media/HomeBladeSub.png
create mode 100644
script.xbmc.subtitles/resources/skins/Default/media/MediaBladeSub.png
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons