The branch, gotham has been updated
       via  6f3703e997fb04884afdc5d303050baaa21e804d (commit)
       via  c4f62587486b0e073b52148cc85a897003e8442b (commit)
      from  9757b7ca5c1aacbb54e77392ec32ed9fdb8c137c (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=6f3703e997fb04884afdc5d303050baaa21e804d

commit 6f3703e997fb04884afdc5d303050baaa21e804d
Author: Martijn Kaijser <[email protected]>
Date:   Tue May 13 11:39:49 2014 +0200

    [service.subtitles.subscenter] 3.1.9

diff --git a/service.subtitles.subscenter/addon.xml 
b/service.subtitles.subscenter/addon.xml
index d0b54b8..d1abfc8 100644
--- a/service.subtitles.subscenter/addon.xml
+++ b/service.subtitles.subscenter/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="service.subtitles.subscenter"
        name="Subscenter.org"
-       version="3.1.8"
+       version="3.1.9"
        provider-name="CaTz">
   <requires>
     <import addon="xbmc.python" version="2.14.0"/>
diff --git a/service.subtitles.subscenter/changelog.txt 
b/service.subtitles.subscenter/changelog.txt
index 72c6995..9ac03c8 100644
--- a/service.subtitles.subscenter/changelog.txt
+++ b/service.subtitles.subscenter/changelog.txt
@@ -1,3 +1,6 @@
+3.1.9 - by CaTz 11/05/2014
+- Advanced Movie Title / TV-show parsing (includes release)
+
 3.1.8 - by CaTz 09/05/2014
 - Support hebrew search
 
diff --git a/service.subtitles.subscenter/resources/lib/SUBUtilities.py 
b/service.subtitles.subscenter/resources/lib/SUBUtilities.py
index c8b7826..968bdad 100644
--- a/service.subtitles.subscenter/resources/lib/SUBUtilities.py
+++ b/service.subtitles.subscenter/resources/lib/SUBUtilities.py
@@ -41,22 +41,32 @@ def normalizeString(str):
     ).encode('utf-8', 'ignore')
 
 
-def parse_tv_rls(rls):
-    groups = 
re.findall(r"(.*)(?:s|season)(?:\d{2})(?:e|x|episode|\n)(?:\d{2})", rls, re.I)
-    if len(groups) > 0:
-        rls = groups[0].strip()
+def clean_title(item):
+    item["title"] = os.path.splitext(item["title"])[0]
+    item["tvshow"] = os.path.splitext(item["tvshow"])[0]
 
-    log(__scriptname__, "TV_RLS: %s" % (rls.decode("utf-8"),))
-    return rls
 
+def parse_rls_title(item):
+    groups = re.findall(r"(.*)(?:s|season)(\d{2})(?:e|x|episode|\n)(\d{2})", 
item["title"], re.I)
 
-def parse_movie_rls(rls):
-    groups = re.findall(r"(.*)(?:\d{4})?", rls, re.I)
-    if len(groups) > 0:
-        rls = groups[0].strip()
+    if len(groups) == 0:
+        groups = 
re.findall(r"(.*)(?:s|season)(\d{2})(?:e|x|episode|\n)(\d{2})", item["tvshow"], 
re.I)
 
-    log(__scriptname__, "MOVIE_RLS: %s" % (rls.decode("utf-8"),))
-    return rls
+    if len(groups) > 0 and len(groups[0]) == 3:
+        title, season, episode = groups[0]
+        item["tvshow"] = re.sub('\W+', ' ', title, 0, re.UNICODE).strip()
+        item["season"] = str(int(season))
+        item["episode"] = str(int(episode))
+        log(__scriptname__, "TV Parsed Item: %s" % (item,))
+
+    else:
+        groups = re.findall(r"(.*)(\d{4})", item["title"], re.I)
+        if len(groups) > 0 and len(groups[0]) >= 1:
+            title = groups[0][0]
+            item["title"] = re.sub('\W+', ' ', title, 0, re.UNICODE).strip()
+            item["year"] = groups[0][1] if len(groups[0]) == 2 else 
item["year"]
+
+            log(__scriptname__, "MOVIE Parsed Item: %s" % (item,))
 
 
 def clear_cache():
@@ -175,7 +185,7 @@ class SubscenterHelper:
                                          'language_flag': language,
                                          'id': current["id"],
                                          'rating': str(current["downloaded"]),
-                                         'sync': subtitle_rate >= 4,
+                                         'sync': subtitle_rate >= 3.8,
                                          'hearing_imp': 
current["hearing_impaired"] > 0
                                         })
         # Fix the rating
diff --git a/service.subtitles.subscenter/service.py 
b/service.subtitles.subscenter/service.py
index 5ce565f..1fdef75 100644
--- a/service.subtitles.subscenter/service.py
+++ b/service.subtitles.subscenter/service.py
@@ -24,7 +24,7 @@ __temp__ = xbmc.translatePath(os.path.join(__profile__, 
'temp')).decode("utf-8")
 
 sys.path.append(__resource__)
 
-from SUBUtilities import SubscenterHelper, log, normalizeString, clear_cache, 
parse_tv_rls, parse_movie_rls
+from SUBUtilities import SubscenterHelper, log, normalizeString, clear_cache, 
parse_rls_title, clean_title
 
 
 
@@ -123,17 +123,16 @@ if params['action'] in ['search', 'manualsearch']:
         item['title'] = params['searchstring'] if params['action'] == 
'manualsearch' \
             else normalizeString(xbmc.getInfoLabel("VideoPlayer.Title"))      
# no original title, get just Title
 
+    # clean title + tvshow params
+    clean_title(item)
+    parse_rls_title(item)
+
     if item['episode'].lower().find("s") > -1:                                
# Check if season is "Special"
         item['season'] = "0"
         item['episode'] = item['episode'][-1:]
 
     if item['file_original_path'].find("http") > -1:
         item['temp'] = True
-        # Parse release name
-        if item['tvshow']:
-            item['tvshow'] = parse_tv_rls(item['tvshow'])
-        else:
-            item['title'] = parse_movie_rls(item['title'])
 
 
     elif item['file_original_path'].find("rar://") > -1:

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=c4f62587486b0e073b52148cc85a897003e8442b

commit c4f62587486b0e073b52148cc85a897003e8442b
Author: Martijn Kaijser <[email protected]>
Date:   Tue May 13 11:38:54 2014 +0200

    [service.subtitles.subtitle] 4.1.9

diff --git a/service.subtitles.subtitle/addon.xml 
b/service.subtitles.subtitle/addon.xml
index 5476a8a..9f1d0f6 100644
--- a/service.subtitles.subtitle/addon.xml
+++ b/service.subtitles.subtitle/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="service.subtitles.subtitle"
        name="Subtitle.co.il"
-       version="4.1.8"
+       version="4.1.9"
        provider-name="CaTz">
     <requires>
         <import addon="xbmc.python" version="2.14.0"/>
diff --git a/service.subtitles.subtitle/changelog.txt 
b/service.subtitles.subtitle/changelog.txt
index fa9db50..b8a0886 100644
--- a/service.subtitles.subtitle/changelog.txt
+++ b/service.subtitles.subtitle/changelog.txt
@@ -1,3 +1,6 @@
+4.1.9 - by CaTz 11/05/2014
+- Advanced Movie Title / TV-show parsing (includes release)
+
 4.1.8 - by CaTz 09/05/2014
 - Support hebrew search
 
diff --git a/service.subtitles.subtitle/resources/lib/SUBUtilities.py 
b/service.subtitles.subtitle/resources/lib/SUBUtilities.py
index 30ab8be..8458d60 100644
--- a/service.subtitles.subtitle/resources/lib/SUBUtilities.py
+++ b/service.subtitles.subtitle/resources/lib/SUBUtilities.py
@@ -40,22 +40,34 @@ def normalizeString(str):
         'NFKD', unicode(unicode(str, 'utf-8'))
     ).encode('utf-8', 'ignore')
 
-def parse_tv_rls(rls):
-    groups = 
re.findall(r"(.*)(?:s|season)(?:\d{2})(?:e|x|episode|\n)(?:\d{2})", rls, re.I)
-    if len(groups) > 0:
-        rls = groups[0].strip()
 
-    log(__scriptname__, "TV_RLS: %s" % (rls.decode("utf-8"),))
-    return rls
+def clean_title(item):
+    item["title"] = os.path.splitext(item["title"])[0]
+    item["tvshow"] = os.path.splitext(item["tvshow"])[0]
 
 
-def parse_movie_rls(rls):
-    groups = re.findall(r"(.*)(?:\d{4})?", rls, re.I)
-    if len(groups) > 0:
-        rls = groups[0].strip()
+def parse_rls_title(item):
+    groups = re.findall(r"(.*)(?:s|season)(\d{2})(?:e|x|episode|\n)(\d{2})", 
item["title"], re.I)
+
+    if len(groups) == 0:
+        groups = 
re.findall(r"(.*)(?:s|season)(\d{2})(?:e|x|episode|\n)(\d{2})", item["tvshow"], 
re.I)
+
+    if len(groups) > 0 and len(groups[0]) == 3:
+        title, season, episode = groups[0]
+        item["tvshow"] = re.sub('\W+', ' ', title, 0, re.UNICODE).strip()
+        item["season"] = str(int(season))
+        item["episode"] = str(int(episode))
+        log(__scriptname__, "TV Parsed Item: %s" % (item,))
+
+    else:
+        groups = re.findall(r"(.*)(\d{4})", item["title"], re.I)
+        if len(groups) > 0 and len(groups[0]) >= 1:
+            title = groups[0][0]
+            item["title"] = re.sub('\W+', ' ', title, 0, re.UNICODE).strip()
+            item["year"] = groups[0][1] if len(groups[0]) == 2 else 
item["year"]
+
+            log(__scriptname__, "MOVIE Parsed Item: %s" % (item,))
 
-    log(__scriptname__, "MOVIE_RLS: %s" % (rls.decode("utf-8"),))
-    return rls
 
 def log(module, msg):
     xbmc.log((u"### [%s] - %s" % (module, msg,)).encode('utf-8'), 
level=xbmc.LOGDEBUG)
@@ -306,7 +318,7 @@ class SubtitleHelper:
                                                                xbmc.ISO_639_1),
                          'id': subtitle_id,
                          'rating': int(downloads.replace(",", "")),
-                         'sync': subtitle_rate >= 4,
+                         'sync': subtitle_rate >= 3.8,
                          'hearing_imp': 0
                         })
         return ret, total_downloads
diff --git a/service.subtitles.subtitle/service.py 
b/service.subtitles.subtitle/service.py
index 5a4abbc..e51e720 100644
--- a/service.subtitles.subtitle/service.py
+++ b/service.subtitles.subtitle/service.py
@@ -24,7 +24,7 @@ __temp__ = xbmc.translatePath(os.path.join(__profile__, 
'temp')).decode("utf-8")
 
 sys.path.append(__resource__)
 
-from SUBUtilities import SubtitleHelper, log, normalizeString, clear_cache, 
parse_tv_rls, parse_movie_rls
+from SUBUtilities import SubtitleHelper, log, normalizeString, clear_cache, 
parse_rls_title, clean_title
 
 
 def search(item):
@@ -120,6 +120,10 @@ if params['action'] in ['search', 'manualsearch']:
         item['title'] = params['searchstring'] if params['action'] == 
'manualsearch' \
             else normalizeString(xbmc.getInfoLabel("VideoPlayer.Title"))  # no 
original title, get just Title
 
+    # clean title + tvshow params
+    clean_title(item)
+    parse_rls_title(item)
+
     if item['episode'].lower().find("s") > -1:  # Check if season is "Special"
         item['season'] = "0"
         item['episode'] = item['episode'][-1:]
@@ -127,12 +131,6 @@ if params['action'] in ['search', 'manualsearch']:
     if item['file_original_path'].find("http") > -1:
         item['temp'] = True
 
-        # Parse release name
-        if item['tvshow']:
-            item['tvshow'] = parse_tv_rls(item['tvshow'])
-        else:
-            item['title'] = parse_movie_rls(item['title'])
-
     elif item['file_original_path'].find("rar://") > -1:
         item['rar'] = True
         item['file_original_path'] = 
os.path.dirname(item['file_original_path'][6:])

-----------------------------------------------------------------------

Summary of changes:
 service.subtitles.subscenter/addon.xml             |    2 +-
 service.subtitles.subscenter/changelog.txt         |    3 ++
 .../resources/lib/SUBUtilities.py                  |   36 ++++++++++++-------
 service.subtitles.subscenter/service.py            |   11 +++---
 service.subtitles.subtitle/addon.xml               |    2 +-
 service.subtitles.subtitle/changelog.txt           |    3 ++
 .../resources/lib/SUBUtilities.py                  |   38 +++++++++++++-------
 service.subtitles.subtitle/service.py              |   12 +++----
 8 files changed, 66 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to