The branch, frodo has been updated
       via  d66f9da9a35677dbe09343052b50b3cb861eb568 (commit)
      from  da11e6084d63d834a988810e4ec29674c865c2d2 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=d66f9da9a35677dbe09343052b50b3cb861eb568

commit d66f9da9a35677dbe09343052b50b3cb861eb568
Author: Martijn Kaijser <[email protected]>
Date:   Mon Jan 21 12:46:12 2013 +0100

    [plugin.video.the.trailers] -1.9.4

diff --git a/plugin.video.the.trailers/addon.xml 
b/plugin.video.the.trailers/addon.xml
index 3f1faf1..7b1015e 100644
--- a/plugin.video.the.trailers/addon.xml
+++ b/plugin.video.the.trailers/addon.xml
@@ -2,10 +2,10 @@
 <addon 
     id="plugin.video.the.trailers"
     name="The Trailers"
-    version="0.9.3"
+    version="1.9.4"
     provider-name="Martijn, Sphere">
     <requires>
-        <import addon="xbmc.python" version="2.0"/>
+        <import addon="xbmc.python" version="2.1.0"/>
         <import addon="script.module.xbmcswift" version="0.2.0"/>
         <import addon="script.module.beautifulsoup" version="3.0.8"/>
         <import addon="script.module.simple.downloader" version="0.9.2"/>
diff --git a/plugin.video.the.trailers/changelog.txt 
b/plugin.video.the.trailers/changelog.txt
index 45aa3d6..7df96b6 100644
--- a/plugin.video.the.trailers/changelog.txt
+++ b/plugin.video.the.trailers/changelog.txt
@@ -1,3 +1,9 @@
+[B]1.9.4[/B]
+- Frodo bump
+
+[B]0.9.4[/B]
+- Fix apple trailers thx to "el.kiwi"
+
 [B]0.9.3[/B]
 - Fix empty ListItem.Art(thumb)
 - Fix error when canncelling if asked for download path
diff --git a/plugin.video.the.trailers/resources/lib/apple_trailers.py 
b/plugin.video.the.trailers/resources/lib/apple_trailers.py
index cd533f9..ef0b720 100644
--- a/plugin.video.the.trailers/resources/lib/apple_trailers.py
+++ b/plugin.video.the.trailers/resources/lib/apple_trailers.py
@@ -30,6 +30,8 @@ class AppleTrailers(object):
 
     MAIN_URL = 'http://trailers.apple.com/trailers/home/xml/current.xml'
     MOVIE_URL = 'http://trailers.apple.com/moviesxml/s/%s/index.xml'
+    
BACKUP_MOVIE_URL='http://trailers.apple.com/trailers/%s/includes/playlists/web.inc'
+    BACKUP_MOVIE_BASE='http://trailers.apple.com/trailers/%s/'
     '''
     TRAILER_QUALITIES = [{'title': 'iPod',
                           'id': 'i320.m4v'},
@@ -106,15 +108,25 @@ class AppleTrailers(object):
                    % movie_title)
         movie = self.get_single_movie(movie_title)
         url = self.MOVIE_URL % movie['movie_string']
-        cache_filename = '%s.xml' % movie['movie_string'].split('/')[1]
-        tree = self.__get_tree(url, cache_filename=cache_filename)
-        r_type = re.compile('/moviesxml/s/.+?/.+?/(.+?).xml')
         trailer_types = []
-        for t in tree.findAll('gotourl', {'target': 'main'}):
-            if t.find('b'):
-                type_string = re.search(r_type, t['url']).group(1)
-                trailer_types.append({'title': t['draggingname'],
-                                      'id': type_string})
+        try:
+            cache_filename = '%s.xml' % movie['movie_string'].split('/')[1]
+            tree = self.__get_tree(url, cache_filename=cache_filename)
+            r_type = re.compile('/moviesxml/s/.+?/.+?/(.+?).xml')
+            for t in tree.findAll('gotourl', {'target': 'main'}):
+                if t.find('b'):
+                    type_string = re.search(r_type, t['url']).group(1)
+                    trailer_types.append({'title': t['draggingname'],
+                                    'id': type_string})
+        except:            
+            t_url=self.BACKUP_MOVIE_URL % movie['movie_string']
+            cache_filename='%swebinc.xml' % 
movie['movie_string'].split('/')[1] 
+            tree=self.__get_tree(t_url,cache_filename=cache_filename)
+            for t in tree.findAll('div',{'class':'column first'}):
+                if t.find('h3'):
+                    trailer_types.append({'title': 
t.find('h3').getText(),'id':t.find('h3').getText().lower().replace(" ","")})
+
+
         return trailer_types
 
     def get_trailer_qualities(self, movie_title):
@@ -128,21 +140,37 @@ class AppleTrailers(object):
                     % (movie_title, trailer_type, quality_id))
         movie = self.get_single_movie(movie_title)
         url = self.MOVIE_URL % movie['movie_string']
-        if trailer_type != 'trailer':
-            url = url.replace('index', trailer_type)
-        cache_filename = '%s-%s.xml' % (movie['movie_string'].split('/')[1],
-                                        trailer_type)
-        html = self.__get_url(url, cache_filename=cache_filename)
-        r_section = re.compile('<array>(.*?)</array>', re.DOTALL)
-        section = re.search(r_section, html).group(1)
-        tree = BS(section, convertEntities=BS.XML_ENTITIES)
-        trailers = []
-        for s in tree.findAll('dict'):
-            for k in s.findAll('key'):
-                if k.string == 'previewURL':
-                    url = k.nextSibling.string
-                    if quality_id in url:
-                        return ('%s?|User-Agent=%s' % (url, self.UA))
+        try:
+            if trailer_type != 'trailer':
+                url = url.replace('index', trailer_type)
+            cache_filename = '%s-%s.xml' % 
(movie['movie_string'].split('/')[1],
+                                            trailer_type)
+            html = self.__get_url(url, cache_filename=cache_filename)
+            r_section = re.compile('<array>(.*?)</array>', re.DOTALL)
+            section = re.search(r_section, html).group(1)
+            tree = BS(section, convertEntities=BS.XML_ENTITIES)
+            trailers = []
+            for s in tree.findAll('dict'):
+                for k in s.findAll('key'):
+                    if k.string == 'previewURL':
+                        url = k.nextSibling.string
+                        if quality_id in url:
+                            return ('%s?|User-Agent=%s' % (url, self.UA))
+        except:            
+            url=self.BACKUP_MOVIE_BASE % movie['movie_string']
+            tree = None
+            if quality_id=='h480p.mov':
+                tree=self.__get_tree(url + 'itsxml/25-'+trailer_type+'.xml')
+            if quality_id=='h720p.mov':
+                tree=self.__get_tree(url + 'itsxml/26-'+trailer_type+'.xml')
+            if quality_id=='h1080p.mov':
+                tree=self.__get_tree(url + 'itsxml/27-'+trailer_type+'.xml')
+            for s in tree.findAll('dict'):
+                for k in s.findAll('key'):                
+                    if k.string == 'URL':
+                        url = k.nextSibling.string
+                        if quality_id in url:
+                            return ('%s?|User-Agent=%s' % (url, self.UA))
 
     def __get_movies(self):
         self.__log('__get_movies started')
@@ -231,4 +259,4 @@ class AppleTrailers(object):
         return html
 
     def __log(self, msg):
-        print('Apple scraper: %s' % msg)
+        print('Apple scraper: %s' % msg)
\ No newline at end of file

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

Summary of changes:
 plugin.video.the.trailers/addon.xml                |    4 +-
 plugin.video.the.trailers/changelog.txt            |    6 ++
 .../resources/lib/apple_trailers.py                |   76 +++++++++++++------
 3 files changed, 60 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to