The branch, dharma has been updated
       via  2dbfebcf6f1392ab14922f489fce01f4a8a61be0 (commit)
       via  6c6c99fcd85d2e9db833a60d449c7dff4b011c7e (commit)
      from  3fe7b87f267a86e60114ab43bf7c05455ab3300c (commit)

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

commit 2dbfebcf6f1392ab14922f489fce01f4a8a61be0
Author: spiff <[email protected]>
Date:   Mon Sep 5 12:27:49 2011 +0200

    [plugin.video.mlbmc] updated to version 0.0.4

diff --git a/plugin.video.mlbmc/addon.xml b/plugin.video.mlbmc/addon.xml
index 43eb4e6..310d9d7 100644
--- a/plugin.video.mlbmc/addon.xml
+++ b/plugin.video.mlbmc/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

 <addon id="plugin.video.mlbmc"

        name="MLBMC"

-       version="0.0.3"

+       version="0.0.4"

        provider-name="divingmule">

   <requires>

     <import addon="xbmc.python" version="1.0"/>

diff --git a/plugin.video.mlbmc/changelog.txt b/plugin.video.mlbmc/changelog.txt
index d6bea42..5738d63 100644
--- a/plugin.video.mlbmc/changelog.txt
+++ b/plugin.video.mlbmc/changelog.txt
@@ -1,3 +1,8 @@
+Version 0.0.4

+added many new categories

+added search

+fixed an issue with request headers

+

 Version 0.0.3

 added enter a date option for condensed games

 other minor fixes
\ No newline at end of file
diff --git a/plugin.video.mlbmc/default.py b/plugin.video.mlbmc/default.py
index 0d0342c..82e6f48 100644
--- a/plugin.video.mlbmc/default.py
+++ b/plugin.video.mlbmc/default.py
@@ -45,7 +45,7 @@ debug = __settings__.getSetting('debug')
 
 
 if debug == "true":
-    print '(((((((((( Version dharma - 0.0.3, eden - 1.0.0 ))))))))))'
+    print '(((((((((( Version dharma - 0.0.4, eden - 1.0.1 ))))))))))'
 
 SOAPCODES = {
     "1"    : "OK",
@@ -90,18 +90,24 @@ TeamCodes = {
     '120': ('Washington Nationals', 'was')
     }
 
+
 def categories():
         
addDir(__language__(30000),'',3,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlb.tv.png')
         
addDir(__language__(30029),'',14,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
         
addPlaylist(__language__(30001),'http://mlb.mlb.com/video/play.jsp?tcid=mm_mlb_vid',12,'http://mlbmc-xbmc.googlecode.com/svn/icons/latestvid.png')
         
addDir(__language__(30002),'',4,'http://mlbmc-xbmc.googlecode.com/svn/icons/tvideo.png')
-        
addDir(__language__(30003),'http://mlb.mlb.com/ws/search/MediaSearchService?mlbtax_key=fastcast&sort=desc&sort_type=date&hitsPerPage=200&src=vpp',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/fc.png')
-        
addDir(__language__(30004),'http://mlb.mlb.com/ws/search/MediaSearchService?mlbtax_key=must_c&sort=desc&sort_type=date&hitsPerPage=200&src=vpp',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mc.png')
-        
addDir(__language__(30005),'http://mlb.mlb.com/ws/search/MediaSearchService?&sort=desc&sort_type=date&subject=MLBCOM_GAME_RECAP&hitsPerPage=60&src=vpp',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/gamere.png')
-        
addDir(__language__(30006),'http://mlb.mlb.com/ws/search/MediaSearchService?mlbtax_key=mlb_network&sort=desc&sort_type=date&hitsPerPage=360&src=vpp',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
-        
addDir(__language__(30007),'http://mlb.mlb.com/ws/search/MediaSearchService?&sort=desc&sort_type=date&subject=MLBCOM_TOP_PLAY&hitsPerPage=60&src=vpp',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/tp.png')
+        
addDir(__language__(30003),'9674738',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/fc.png')
+        
addDir(__language__(30004),'11493214',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mc.png')
+        
addDir(__language__(30031),'17392054',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/dailydash.png')
+        
addDir(__language__(30005),'8879974',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/gamere.png')
+        
addDir(__language__(30032),'',17,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addDir(__language__(30006),'',18,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30007),'16820808',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/pranking.png')
+        
addDir(__language__(30033),'4709980',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/fantasy.png')
+        
addDir(__language__(30009),'7759164',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/bball.png')
         
addDir(__language__(30008),'http://gdx.mlb.com/components/game/mlb/'+dateStr.day[0]+'/media/highlights.xml',8,'http://mlbmc-xbmc.googlecode.com/svn/icons/realtime.png')
-        
addDir(__language__(30009),'http://mlb.mlb.com/video/play.jsp?topic_id=7759164',10,'http://mlbmc-xbmc.googlecode.com/svn/icons/bball.png')
+        
addDir(__language__(30034),'',16,'http://mlbmc-xbmc.googlecode.com/svn/icons/search.png')
+        
addDir(__language__(30035),'',20,'http://mlbmc-xbmc.googlecode.com/svn/icons/more.png')
 
 
 def mlbTV():
@@ -117,11 +123,67 @@ def mlbTV():
 
 
 def condensedGames():
-            
addGameDir(__language__(30011),'http://www.mlb.com/mediacenter/index.jsp?ymd='+dateStr.day[1].replace('year_','').replace('/month_','').replace('/day_',''),13,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
-            
addGameDir(__language__(30012),'http://www.mlb.com/mediacenter/index.jsp?ymd='+dateStr.day[3].replace('year_','').replace('/month_','').replace('/day_',''),13,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
-            
addGameDir(__language__(30014),'',15,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
-            
-            
+        
addGameDir(__language__(30011),'http://www.mlb.com/mediacenter/index.jsp?ymd='+dateStr.day[1].replace('year_','').replace('/month_','').replace('/day_',''),13,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
+        
addGameDir(__language__(30012),'http://www.mlb.com/mediacenter/index.jsp?ymd='+dateStr.day[3].replace('year_','').replace('/month_','').replace('/day_',''),13,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
+        
addGameDir(__language__(30014),'',15,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
+
+
+def gameHighlights():
+        
addGameDir(__language__(30036),'8879838',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30037),'9781914',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30038),'10025018',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30039),'10023406',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30040),'10025790',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30041),'10025796',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30042),'9782246',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30043),'10023906',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+        
addGameDir(__language__(30044),'9780550',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/highlights.png')
+
+
+def mlbNetwork():
+        
addDir(__language__(30006),'7417714',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30045),'8187248',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30046),'12429102',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30047),'9991168',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30048),'20209194',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30049),'4488754',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+        
addDir(__language__(30050),'18847480',1,'http://mlbmc-xbmc.googlecode.com/svn/icons/mlbnet.png')
+
+
+def allStarGame():
+        addDir(__language__(30051),'16609400',1,icon)
+        addDir(__language__(30052),'20159458',1,icon)
+        addDir(__language__(30053),'20159600',1,icon)
+        addDir(__language__(30054),'20159604',1,icon)
+        addDir(__language__(30055),'20158982',1,icon)
+        addDir(__language__(30056),'20523060',1,icon)
+        addDir(__language__(30057),'20156278',1,icon)
+
+
+def exploreMore():
+        addDir(__language__(30058),'17071012',1,icon)
+        addDir(__language__(30059),'17074640',1,icon)
+        addDir(__language__(30060),'17807232',1,icon)
+        addDir(__language__(30061),'18985532',1,icon)
+        addDir(__language__(30051),'',19,icon)
+        addDir(__language__(30062),'20812682',1,icon)
+        addDir(__language__(30063),'18236054',1,icon)
+        addDir(__language__(30064),'18674140',1,icon)
+        addDir(__language__(30065),'6003532',1,icon)
+        addDir(__language__(30066),'22055984',1,icon)
+        addDir(__language__(30067),'18881664',1,icon)
+        addDir(__language__(30068),'4737232',1,icon)
+        addDir(__language__(30069),'10122332',1,icon)
+        addDir(__language__(30070),'11837016',1,icon)
+        addDir(__language__(30071),'12678984',1,icon)
+        addDir(__language__(30072),'5247106',1,icon)
+        addDir(__language__(30073),'7271062',1,icon)
+        addDir(__language__(30074),'6609548',1,icon)
+        addDir(__language__(30075),'7961660',1,icon)
+        addDir(__language__(30076),'9612588',1,icon)
+        addDir(__language__(30077),'9583020',1,icon)
+
+
 def getTeams():
         teams = TeamCodes.values()
         for team in teams:
@@ -132,13 +194,13 @@ def getTeams():
 
 def getRealtimeVideo(url):
         try:
-            req = urllib2.Request(url)
-            req.addheaders = [('Referer', 'http://mlb.mlb.com/index.jsp'),
-                  ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 
Firefox/4.0')]
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 'http://mlb.mlb.com'}
+            req = urllib2.Request(url,None,txheaders)
             response = urllib2.urlopen(req)
             link=response.read()
             response.close()
-            soup = BeautifulStoneSoup(link)
+            soup = BeautifulStoneSoup(link, 
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
 
             videos = soup.findAll('media')
             for video in videos:
@@ -154,10 +216,11 @@ def getRealtimeVideo(url):
 
 
 def getTeamVideo(url):
+        
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30079)+",5000,"+icon+")")
         
url='http://mlb.mlb.com/gen/'+url+'/components/multimedia/topvideos.xml'
-        req = urllib2.Request(url)
-        req.addheaders = [('Referer', 'http://mlb.mlb.com'),
-                ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 
Firefox/4.0')]
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com'}
+        req = urllib2.Request(url,None,txheaders)
         response = urllib2.urlopen(req)
         link=response.read()
         response.close()
@@ -182,10 +245,10 @@ def getTeamVideo(url):
 
 
 def scrapeWebsite(url):
-        req = urllib2.Request(url)
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com'}
+        req = urllib2.Request(url,None,txheaders)
         response = urllib2.urlopen(req)
-        req.addheaders = [('Referer', 'http://mlb.mlb.com'),
-                ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 
Firefox/4.0')]
         link=response.read()
         response.close()
         soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
@@ -203,10 +266,11 @@ def scrapeWebsite(url):
 
 
 def playLatest(url):
-        req = urllib2.Request(url)
+        
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30079)+",5000,"+icon+")")
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com/video/play.jsp?cid=mlb'}
+        req = urllib2.Request(url,None,txheaders)
         response = urllib2.urlopen(req)
-        req.addheaders = [('Referer', 'http://mlb.mlb.com'),
-                ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 
Firefox/4.0')]
         link=response.read()
         response.close()
         soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
@@ -228,10 +292,11 @@ def playLatest(url):
 
 
 def getVideos(url):
+        url = 'http://mlb.mlb.com/gen/multimedia/topic/'+url+'.xml'
         try:
-            req = urllib2.Request(url)
-            req.addheaders = [('Referer', 'http://www.mlb.com/video/'),
-                    ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) 
Gecko/20100101 Firefox/4.0')]
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 
'http://mlb.mlb.com/video/play.jsp?cid=mlb'}
+            req = urllib2.Request(url,None,txheaders)
             response = urllib2.urlopen(req)
             link=response.read()
             response.close()
@@ -247,42 +312,72 @@ def getVideos(url):
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+",10000,"+icon+")")
             else:
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+",10000,"+icon+")")
+        soup = BeautifulStoneSoup(link, 
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
+        part = soup.search_query.string
+        if part == None:
+            try:
+                vidList = soup.video_index['src']
+                getVideoListXml(vidList)
+            except:
+                pass
+            return
+        maxitems = soup.topic['maxitems']
+        if eval(maxitems) > 60:
+            items = '60'
+        else:
+            items = maxitems
+        url = 
'http://mlb.mlb.com/ws/search/MediaSearchService?&;'+part+'&hitsPerPage='+items+'&src=vpp'
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com/'}
+        req = urllib2.Request(url,None,txheaders)
+        response = urllib2.urlopen(req)
+        link=response.read()
+        response.close()
         data = json.loads(link)
         videos = data['mediaContent']
         for video in videos:
             name = video['blurb']
-            desc = video['bigBlurb']
+            duration = video['duration']
             url = video['url']
-            thumb = video['thumbnails'][2]['src']
-            addLink(name,url,'',2,thumb)
+            try:
+                thumb = video['thumbnails'][2]['src']
+            except:
+                thumb = video['thumbnails'][1]['src']
+            addLink(name,url,duration,2,thumb)
 
 
-def setVideoURL(url):
-        url = getVideoURL(url)
+def setVideoURL(link):
+        url = getVideoURL(link)
         item = xbmcgui.ListItem(path=url)
         xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
 
 
 def getVideoURL(url):
-        req = urllib2.Request(url)
-        req.addheaders = [('Referer', 
'http://mlb.mlb.com/video/play.jsp?cid=mlb'),
-                ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 
Firefox/4.0')]
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com/video/play.jsp?cid=mlb'}
+        req = urllib2.Request(url,None,txheaders)
         response = urllib2.urlopen(req)
         link=response.read()
         response.close()
-        soup = BeautifulStoneSoup(link)
+        soup = BeautifulStoneSoup(link, 
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
         if soup.find('url', attrs={'playback_scenario' : 
"FLASH_1200K_640X360"}):
             url = soup.find('url', attrs={'playback_scenario' : 
"FLASH_1200K_640X360"}).string
         elif soup.find('url', attrs={'playback_scenario' : 
"FLASH_1000K_640X360"}):
             url = soup.find('url', attrs={'playback_scenario' : 
"FLASH_1000K_640X360"}).string
         elif soup.find('url', attrs={'playback_scenario' : 
"FLASH_600K_400X224"}):
             url = soup.find('url', attrs={'playback_scenario' : 
"FLASH_600K_400X224"}).string
+        elif soup.find('url', attrs={'playback_scenario' : 
"MLB_FLASH_1000K_PROGDNLD"}):
+            url = soup.find('url', attrs={'playback_scenario' : 
"MLB_FLASH_1000K_PROGDNLD"}).string
+        elif soup.find('url', attrs={'playback_scenario' : 
"MLB_FLASH_800K_PROGDNLD"}):
+            url = soup.find('url', attrs={'playback_scenario' : 
"MLB_FLASH_800K_PROGDNLD"}).string
         return url
 
 
 def getCondensedGames(url):
         try:
-            req = urllib2.Request(url)
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 'http://mlb.mlb.com'}
+            req = urllib2.Request(url,None,txheaders)
             response = urllib2.urlopen(req)
             link=response.read()
             response.close()
@@ -297,7 +392,7 @@ def getCondensedGames(url):
                     print 'We failed with error code - %s.' % e.code
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+"',10000,"+icon+")")
             else:
-                
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+"',10000,"+icon+")")
        
+                
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+"',10000,"+icon+")")
         soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
         videos = soup.findAll('tbody')[0]('tr')
         for video in videos:
@@ -309,13 +404,80 @@ def getCondensedGames(url):
                 
addLink(name,url,'',2,'http://mlbmc-xbmc.googlecode.com/svn/icons/condensed.png')
             except:
                 pass
-        
+
+
+def getVideoListXml(url):
+        url = 'http://mlb.mlb.com'+url
+        txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                     'Referer' : 'http://mlb.mlb.com/'}
+        req = urllib2.Request(url,None,txheaders)
+        response = urllib2.urlopen(req)
+        link=response.read()
+        print response.geturl()
+        print response.info()
+        response.close()
+        soup = BeautifulStoneSoup(link, 
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
+        items = soup('item')
+        for item in items:
+            name = item.blurb.string
+            vidId = item['content_id']
+            url = vidId[-3]+'/'+vidId[-2]+'/'+vidId[-1]+'/'+vidId
+            try:
+                thumb = item('image', attrs={'type' : "13"})[0].string
+            except:
+                thumb = item.image.string
+            duration = item.duration.string
+            
addLink(name,'http://mlb.mlb.com/gen/multimedia/detail/'+url+'.xml',duration,2,thumb)
+
+
+def Search(url):
+        if url == '':
+            searchStr = ''
+            keyboard = xbmc.Keyboard(searchStr, 'MLB.com Video Search')
+            keyboard.doModal()
+            if (keyboard.isConfirmed() == False):
+                return
+            newStr = keyboard.getText()
+            if len(newStr) == 0:
+                return
+            searchStr = newStr.replace(' ','%20')
+            referStr = newStr.replace(' ','+')
+            url = 
'http://mlb.mlb.com/ws/search/MediaSearchService?start=0&site=mlb&hitsPerPage=12&hitsPerSite=10&type=json&c_id=&src=vpp&sort=desc&sort_type=custom&query='+searchStr
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 
'http://mlb.mlb.com/search/media.jsp?query='+referStr+'&c_id=mlb'}
+        else:
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 
'http://mlb.mlb.com/search/media.jsp?query='+url.split('=')[-1]+'&c_id=mlb'}
+
+        req = urllib2.Request(url,None,txheaders)
+        response = urllib2.urlopen(req)
+        link=response.read()
+        response.close()
+        data = json.loads(link)
+        if data['total'] == 0:
+            
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30078)+data['query']+"',5000,"+icon+")")
+            return
+        videos = data['mediaContent']
+        for video in videos:
+            name = video['blurb']
+            desc = video['bigBlurb']
+            link = video['url']
+            duration = video['duration']
+            try:
+                thumb = video['thumbnails'][1]['src']
+            except:
+                thumb = video['thumbnails'][0]['src']
+            addLink(name,link,duration,2,thumb)
+        if data['total'] > data['end']:
+            url = 
url.split('&',1)[0][:-1]+str(data['end']+1)+'&'+url.split('&',1)[1]
+            addDir('Next 
Page',url,16,'http://mlbmc-xbmc.googlecode.com/svn/icons/next.png')
+
 
 def getGames(url):
         try:
-            req = urllib2.Request(url)
-            req.addheaders = [('Referer', 'http://mlb.mlb.com/index.jsp'),
-                            ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) 
Gecko/20100101 Firefox/4.0')]
+            txheaders = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; 
rv:6.0) Gecko/20100101 Firefox/6.0',
+                         'Referer' : 'http://mlb.mlb.com/index.jsp'}
+            req = urllib2.Request(url,None,txheaders)
             response = urllib2.urlopen(req)
             link=response.read()
             response.close()
@@ -329,9 +491,11 @@ def getGames(url):
                 if hasattr(e, 'code'):
                     print 'We failed with error code - %s.' % e.code
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+"',10000,"+icon+")")
+                return
             else:
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30018)+errorStr+"',10000,"+icon+")")
-        
+                return
+
         data = json.loads(link)
         try:
             games = data['data']['games']['game']
@@ -454,8 +618,7 @@ def mlbGame(event_id,content_id):
 
         if debug == "true":
             print 'Here are the headers of the page :'
-            print response.info()                             # handle.read() 
returns the page, handle.geturl() returns the true url of the page fetched (in 
case urlopen has followed any redirects, which it sometimes does)
-
+            print response.info()
             if cj == None:
                 print "We don't have a cookie library available - sorry."
                 print "I can't show you any cookies."
@@ -699,8 +862,8 @@ def 
getGameURL(name,event,content,session,cookieIp,cookieFp):
                     print '-----------------> divingmule needs to work on the 
soup!'
                     print soup
                 
xbmc.executebuiltin("XBMC.Notification("+__language__(30015)+","+__language__(30027)+",5000,"+icon+")")
-                
-                
+
+
             if re.search('ondemand', game_url):
                 play_path_pat = re.compile(r'ondemand\/(.*)$')
                 play_path = re.search(play_path_pat,game_url).groups()[0]
@@ -953,11 +1116,11 @@ if mode==11:
 if mode==12:
         print""
         playLatest(url)
-        
+
 if mode==13:
         print""
         getCondensedGames(url)
-        
+
 if mode==14:
         print""
         condensedGames()
@@ -967,4 +1130,24 @@ if mode==15:
         url = 
'http://www.mlb.com/mediacenter/index.jsp?ymd='+getDate().split('/',7)[7].replace('/master_scoreboard.json','').replace('year_','').replace('/month_','').replace('/day_','')
         getCondensedGames(url)
 
+if mode==16:
+        print""
+        Search(url)
+
+if mode==17:
+        print""
+        gameHighlights()
+
+if mode==18:
+        print""
+        mlbNetwork()
+
+if mode==19:
+        print""
+        allStarGame()
+
+if mode==20:
+        print""
+        exploreMore()
+
 xbmcplugin.endOfDirectory(int(sys.argv[1]))
\ No newline at end of file
diff --git a/plugin.video.mlbmc/resources/language/English/strings.xml 
b/plugin.video.mlbmc/resources/language/English/strings.xml
index 3b96144..4789ee8 100644
--- a/plugin.video.mlbmc/resources/language/English/strings.xml
+++ b/plugin.video.mlbmc/resources/language/English/strings.xml
@@ -7,7 +7,7 @@
   <string id="30004">Must C</string>
   <string id="30005">Game Recaps</string>
   <string id="30006">MLB Network</string>
-  <string id="30007">Top Plays</string>
+  <string id="30007">Power Rankings</string>
   <string id="30008">MLB.com Realtime Highlights</string>
   <string id="30009">Baseball's Best Moments</string>
   <string id="30010">Today's Games</string>
@@ -21,7 +21,7 @@
   <string id='30018'>HTTP Error : </string>
   <string id='30019'>This usually means the server doesn't exist, is down, or 
we don't have an internet connection.</string>
   <string id='30020'>Log in Failed</string>
-  <string id='30021'>Sorry - We didn't recive the required cookies</string>
+  <string id='30021'>Sorry - We didn't receive the required cookies</string>
   <string id='30022'>Status : </string>
   <string id='30023'>Status : Media Off - Playing Preview</string>
   <string id='30024'> - Playing Preview</string>
@@ -31,4 +31,54 @@
   <string id='30028'>Invalid Date</string>
   <string id='30029'>Condensed Games</string>
   <string id='30030'>No games for this date.</string>
+  <string id='30031'>The Daily Dash</string>
+  <string id='30032'>Game Highlights</string>
+  <string id='30033'>MLB.com Fantasy 411</string>
+  <string id='30034'>Search</string>
+  <string id='30035'>Explore More</string>
+  <string id='30036'>All Top Plays</string>
+  <string id='30037'>Walk-Offs</string>
+  <string id='30038'>Home Runs</string>
+  <string id='30039'>Top Hitting Performances</string>
+  <string id='30040'>Top Pitching Performances</string>
+  <string id='30041'>No-Hitters &amp; Perfect Games</string>
+  <string id='30042'>Top Defensive Plays</string>
+  <string id='30043'>Errors</string>
+  <string id='30044'>Baseball Oddities</string>
+  <string id='30045'>30 Clubs in 30 Days</string>
+  <string id='30046'>MLB Network  Diamond Demos</string>
+  <string id='30047'>MLB Productions</string>
+  <string id='30048'>Prime 9</string>
+  <string id='30049'>This Week in Baseball</string>
+  <string id='30050'>RBI: Reviving Baseball In Inner Cities</string>
+  <string id='30051'>2011 All-Star Game</string>
+  <string id='30052'>2011 Home Run Derby</string>
+  <string id='30053'>2011 Futures Game</string>
+  <string id='30054'>2011 All-Star Softball Game</string>
+  <string id='30055'>2011 All-Star Fanfest</string>
+  <string id='30056'>2011 All-Star Final Vote</string>
+  <string id='30057'>Midsummer Classic Moments</string>
+  <string id='30058'>Good Decisions of the Game</string>
+  <string id='30059'>Grass Clippings | presented by Scotts</string>
+  <string id='30060'>Moment of Glory | presented by Klondike</string>
+  <string id='30061'>The Path to The Show | presented by U.S. Army</string>
+  <string id='30062'>Captain Morgan Toasts of the Week</string>
+  <string id='30063'>DJ3K</string>
+  <string id='30064'>2011 Draft Coverage</string>
+  <string id='30065'>Baseball Hall of Fame</string>
+  <string id='30066'>Baseball Hall of Fame Induction Speeches</string>
+  <string id='30067'>All Together Now | presented by Sprint</string>
+  <string id='30068'>MLB.com presents Base Ball Discovered</string>
+  <string id='30069'>Beisbol Dominicano: A Web Series</string>
+  <string id='30070'>Bloomberg Sports</string>
+  <string id='30071'>Heartbeat of the Ballpark  | presented by Cisco</string>
+  <string id='30072'>GetGreat.com</string>
+  <string id='30073'>MLB.com - Entertainment's Major League Artists</string>
+  <string id='30074'>National Youth Baseball Championships</string>
+  <string id='30075'>Rookie Career Development Program</string>
+  <string id='30076'>USA Baseball</string>
+  <string id='30077'>Weplay</string>
+  <string id='30078'>No Results for: </string>
+  <string id='30079'>Loading Playlist</string>
+  
 </strings>
\ No newline at end of file

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=6c6c99fcd85d2e9db833a60d449c7dff4b011c7e

commit 6c6c99fcd85d2e9db833a60d449c7dff4b011c7e
Author: spiff <[email protected]>
Date:   Mon Sep 5 12:23:16 2011 +0200

    [plugin.video.giantbomb] updated to version 2.2

diff --git a/plugin.video.giantbomb/addon.xml b/plugin.video.giantbomb/addon.xml
index 094e19c..b9e0f9a 100644
--- a/plugin.video.giantbomb/addon.xml
+++ b/plugin.video.giantbomb/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.video.giantbomb"
        name="Giant Bomb"
-       version="2.1"
+       version="2.2"
        provider-name="Whiskey Media">
   <requires>
     <import addon="xbmc.python" version="1.0"/>
diff --git a/plugin.video.giantbomb/default.py 
b/plugin.video.giantbomb/default.py
index ce55b57..b2a8cd1 100644
--- a/plugin.video.giantbomb/default.py
+++ b/plugin.video.giantbomb/default.py
@@ -1,6 +1,7 @@
 import urllib
 import urllib2
 import simplejson
+import xbmcaddon
 import xbmcplugin
 import xbmcgui
 import shelve
@@ -8,22 +9,21 @@ import os
 
 API_PATH = 'http://api.giantbomb.com'
 API_KEY = 'fa96542d69b4af7f31c2049ace5d89e84e225bef' # Default API key
+my_addon = xbmcaddon.Addon('plugin.video.giantbomb')
 
 def CATEGORIES():
     account_linked = False
-    filename = os.path.abspath('user_data.db')
-    d = shelve.open(filename)
-    if d.has_key('api_key'):
-        response = urllib2.urlopen(API_PATH + '/chats/?api_key=' + 
d['api_key'] + '&format=json')
+    user_api_key = my_addon.getSetting('api_key')
+    if user_api_key:
+        response = urllib2.urlopen(API_PATH + '/chats/?api_key=' + 
user_api_key + '&format=json')
         data = simplejson.loads(response.read())
         if data['status_code'] == 100:
             # Revert to the default key
-            del d['api_key']
+            my_addon.setSetting('api_key', '')
         else:
             global API_KEY
-            API_KEY = d['api_key']
+            API_KEY = user_api_key
             account_linked = True
-    d.close()
 
     response = urllib2.urlopen(API_PATH + '/video_types/?api_key=' + API_KEY + 
'&format=json')
     category_data = simplejson.loads(response.read())['results']
@@ -57,11 +57,8 @@ def GET_API_KEY(link_code):
         try:
             response = urllib2.urlopen(API_PATH + '/validate?link_code=' + 
link_code + '&format=json')
             data = simplejson.loads(response.read())
-            api_key = data['api_key']
-            filename = os.path.abspath('user_data.db')
-            d = shelve.open(filename)
-            d['api_key'] = api_key
-            d.close()
+            new_api_key = data['api_key']
+            my_addon.setSetting('api_key', new_api_key)
             return True
         except:
             return False
@@ -69,11 +66,8 @@ def GET_API_KEY(link_code):
         return False
 
 def INDEX(url):
-    filename = os.path.abspath('user_data.db')
-    d = shelve.open(filename)
-    if d.has_key('api_key'):
-        API_KEY = d['api_key']
-    d.close()
+    if my_addon.getSetting('api_key'):
+        API_KEY = my_addon.getSetting('api_key')
 
     if url == 'search':
         keyboard = xbmc.Keyboard("", 'Search', False)
@@ -102,11 +96,8 @@ def INDEX(url):
         addDir('The Matrix Online: Not Like This', url + '&MO', 2, '')
 
 def VIDEOLINKS(url, name):
-    filename = os.path.abspath('user_data.db')
-    d = shelve.open(filename)
-    if d.has_key('api_key'):
-        API_KEY = d['api_key']
-    d.close()
+    if my_addon.getSetting('api_key'):
+        API_KEY = my_addon.getSetting('api_key')
 
     if url.endswith('&DP'):
         response = urllib2.urlopen(API_PATH + '/videos/?api_key=' + API_KEY + 
'&video_type=5&offset=161&format=json')
diff --git a/plugin.video.giantbomb/resources/settings.xml 
b/plugin.video.giantbomb/resources/settings.xml
index cc6b79e..27768db 100644
--- a/plugin.video.giantbomb/resources/settings.xml
+++ b/plugin.video.giantbomb/resources/settings.xml
@@ -1,4 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <settings>
-   <setting id="vquality" type="bool" label="30000" default="true"/>
-   <setting id="ucat" type="bool" label="30001" default="true"/>
+    <setting id="api_key" type="text" default="" />
 </settings>
\ No newline at end of file

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

Summary of changes:
 plugin.video.giantbomb/addon.xml                   |    2 +-
 plugin.video.giantbomb/default.py                  |   35 +--
 plugin.video.giantbomb/resources/settings.xml      |    4 +-
 plugin.video.mlbmc/addon.xml                       |    2 +-
 plugin.video.mlbmc/changelog.txt                   |    5 +
 plugin.video.mlbmc/default.py                      |  283 ++++++++++++++++----
 .../resources/language/English/strings.xml         |   54 ++++-
 7 files changed, 307 insertions(+), 78 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to