The branch, frodo has been updated
       via  01500e119598a82beef2244fe80b5e6fabc08010 (commit)
      from  253b3cffe367ac7770ffb8c67a59e153a430c06f (commit)

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

commit 01500e119598a82beef2244fe80b5e6fabc08010
Author: Martijn Kaijser <[email protected]>
Date:   Sat Oct 19 19:26:14 2013 +0200

    [script.myepisodes] 1.0.7

diff --git a/script.myepisodes/addon.xml b/script.myepisodes/addon.xml
index 08deb9c..6f5a944 100644
--- a/script.myepisodes/addon.xml
+++ b/script.myepisodes/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.myepisodes"
        name="MyEpisodes"
-       version="1.0.6"
+       version="1.0.7"
        provider-name="Maxime Hadjinlian">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
diff --git a/script.myepisodes/changelog.txt b/script.myepisodes/changelog.txt
index 0b398a2..35e136c 100644
--- a/script.myepisodes/changelog.txt
+++ b/script.myepisodes/changelog.txt
@@ -1,3 +1,8 @@
+1.0.7
++ Improve the way to find a TVShow title, thanks to trogdorsmith and
+greek on the MyEpisodes forum for reporting the issue and testing "beta"
+version.
++ Add a fallback to find a TVShow ID on MyEpisodes
 1.0.6
 + Fix International issue. The plugin will now work when XBMC is set to
 other lanuages than English.
diff --git a/script.myepisodes/default.py b/script.myepisodes/default.py
index 04a8956..a3c0b71 100644
--- a/script.myepisodes/default.py
+++ b/script.myepisodes/default.py
@@ -105,13 +105,28 @@ class Player(xbmc.Player):
 
     def onPlayBackStarted(self):
         self._setUp()
-        self.title = self.getPlayingFile().decode('utf-8')
-        self.title = os.path.basename(self.title)
-        log('Player - Title : %s' % self.title)
         self._totalTime = self.getTotalTime()
         self._tracker.start()
 
-        self.title, self.season, self.episode = self.mye.get_info(self.title)
+        # Try to find the title with the help of XBMC (Theses came from
+        # XBMC.Subtitles add-ons)
+        self.season = str(xbmc.getInfoLabel("VideoPlayer.Season"))
+        log('Player - Season: %s' % self.season)
+        if self.season != "":
+            self.season = int(self.season)
+        self.episode = str(xbmc.getInfoLabel("VideoPlayer.Episode"))
+        log('Player - Episode: %s' % self.episode)
+        if self.episode != "":
+            self.episode = int(self.episode)
+        self.title = xbmc.getInfoLabel("VideoPlayer.TVshowtitle")
+        log('Player - TVShow: %s' % self.title)
+        if self.title == "":
+            filename = self.getPlayingFile().decode('utf-8')
+            filename = os.path.basename(filename)
+            log('Player - Filename: %s' % filename)
+            self.title, self.season, self.episode = self.mye.get_info(filename)
+            log('Player - TVShow: %s' % self.title)
+
         log("Title: %s - Season: %02d - Ep: %02d" % (self.title, self.season, 
self.episode))
         if (self.season is None) and (self.episode is None):
             # It's not a show. If it should be recognised as one. Send a bug.
@@ -123,7 +138,7 @@ class Player(xbmc.Player):
             notif("%s %s" % (self.title, __language__(30923)), time=3000)
             self._tearDown()
             return
-            log('Player - Found : %s - %d (S%02d E%02d)' % (self.title,
+        log('Player - Found : %s - %d (S%02d E%02d)' % (self.title,
                 self.showid, self.season, self.episode))
         self._addShow()
 
diff --git a/script.myepisodes/resources/lib/myepisodes.py 
b/script.myepisodes/resources/lib/myepisodes.py
index 6a306a6..edfbb6c 100644
--- a/script.myepisodes/resources/lib/myepisodes.py
+++ b/script.myepisodes/resources/lib/myepisodes.py
@@ -94,12 +94,25 @@ class MyEpisodes(object):
         for link in soup.findAll("a", href=True):
             if link.string is None:
                 continue
-            link_str = link.string.lower()
-            if link_str == show_name:
+            if link.string.lower().startswith(show_name):
                 show_href = link.get('href')
                 break
 
         if show_href is None:
+            # Try to lookup the list of all the shows to find the exact title
+            list_url = "%s/%s?list=%s" % (MYEPISODE_URL, "shows.php",
+                    show_name[0].upper())
+            data = self.send_req(list_url)
+            soup = BeautifulSoup(data)
+            show_href = None
+            for link in soup.findAll("a", href=True):
+                if link.string is None:
+                    continue
+                if link.string.lower() == show_name:
+                    show_href = link.get('href')
+
+        # Really did not find anything :'(
+        if show_href is None:
             return None
 
         show_url = urlparse.urlparse(show_href)

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

Summary of changes:
 script.myepisodes/addon.xml                   |    2 +-
 script.myepisodes/changelog.txt               |    5 +++++
 script.myepisodes/default.py                  |   25 ++++++++++++++++++++-----
 script.myepisodes/resources/lib/myepisodes.py |   17 +++++++++++++++--
 4 files changed, 41 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to