The branch, eden has been updated
       via  392b8867f3a5e5dd2f609560c25838494e7bfd22 (commit)
      from  3bc94da2556d445e0d7422d495d992c14e084b10 (commit)

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

commit 392b8867f3a5e5dd2f609560c25838494e7bfd22
Author: beenje <[email protected]>
Date:   Sun Jan 6 21:55:15 2013 +0100

    [plugin.video.cinemassacre] updated to version 0.1.0

diff --git a/plugin.video.cinemassacre/addon.xml 
b/plugin.video.cinemassacre/addon.xml
index dbad898..0c939eb 100644
--- a/plugin.video.cinemassacre/addon.xml
+++ b/plugin.video.cinemassacre/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.cinemassacre" name="cinemassacre" version="0.0.5" 
provider-name="dethfeet">
+<addon id="plugin.video.cinemassacre" name="cinemassacre" version="0.1.0" 
provider-name="dethfeet, Kr0nZ">
   <requires>
     <import addon="xbmc.python" version="2.0"/>
     <import addon="xbmc.gui" version="2.11"/>
@@ -10,9 +10,10 @@
     <provides>video</provides>
   </extension>
   <extension point="xbmc.addon.metadata">
-               <language>en</language>
-       <summary>cinemassacre.com</summary>
-       <description>Home of the Angry Video Game Nerd, Monster Madness, movie 
reviews, top 10's, and commentary, retro and classic video gaming and 
more.</description>
+    <summary lang="en">cinemassacre.com</summary>
+    <description lang="en">Home of the Angry Video Game Nerd, Monster Madness, 
movie reviews, top 10's, and commentary, retro and classic videos</description>
     <platform>all</platform>
+    <language>en</language>
   </extension>
 </addon>
+
diff --git a/plugin.video.cinemassacre/changelog.txt 
b/plugin.video.cinemassacre/changelog.txt
index 7354dd0..847e336 100644
--- a/plugin.video.cinemassacre/changelog.txt
+++ b/plugin.video.cinemassacre/changelog.txt
@@ -1,3 +1,8 @@
+0.1.0 - Updated With WebSite Changes
+0.0.9 - Added Screenwave Media Support
+0.0.8 - Handle shorten URLs with springboard videos
+0.0.7 - Reenabled support for videos from gametrailers.com
+0.0.6 - Fixed bug with springboard video playback
 0.0.5 - Remove unneeded categories
         moved showEpisode to a seperate file
 0.0.4 - Using youtube and blip.tv plugins for playback
diff --git a/plugin.video.cinemassacre/default.py 
b/plugin.video.cinemassacre/default.py
index f22e103..042c65a 100644
--- a/plugin.video.cinemassacre/default.py
+++ b/plugin.video.cinemassacre/default.py
@@ -1,137 +1,233 @@
-import xbmcplugin
-import xbmcgui
-import xbmcaddon
-import sys
-import urllib, urllib2
-import re
-import showEpisode
+import xbmcplugin, xbmcgui, xbmcaddon
+import urllib, urllib2, re
+import showEpisode, sys, os#, random
+try: import StorageServer
+except: import storageserverdummy as StorageServer
+import CommonFunctions as common
+import thisCommonFunctions as common2
 
+cache = StorageServer.StorageServer("cinemassacre", 24)
+#cache.dbg = True
+#common.dbg = True
 addon = xbmcaddon.Addon(id='plugin.video.cinemassacre')
 
 thisPlugin = int(sys.argv[1])
 
 baseLink = "http://cinemassacre.com/";
 
-hideMenuItem = []
-hideMenuItem.append("412") # Gallery
-hideMenuItem.append("486") # Fan Stuff
-hideMenuItem.append("402") # Full list of AVGN Videos
-hideMenuItem.append("225") # Game Collection
+defaultsXML = os.path.join(addon.getAddonInfo('path'), 
'resources',"defaults.xml")
+dontShowTheseUrls = []
+defaultFolderIcons = {"default":os.path.join(addon.getAddonInfo('path'), 
"icon.png"),"list":[]}
 
-_regex_extractMenu = re.compile("<ul id=\"navlist\">(.*?)<ul 
id=\"navpages\">", re.DOTALL);
+def retFileAsString(fileName):
+    file = common.openFile(fileName, "r")
+    tmpContents = file.read()
+    file.close()
+    return tmpContents
+    
+def getDefaultIcons():
+    xmlContents = retFileAsString(defaultsXML)
+    iconList =  common2.parseDOM(xmlContents, "icons")
+    iconUrlList =  common2.parseDOM(iconList, "icon", ret="url")
+    iconImgList =  common2.parseDOM(iconList, "icon", ret="image")
+    
+    retList = []
+    for i in range(0,len(iconUrlList)):
+        retList.append({"url": iconUrlList[i], "image": 
os.path.join(addon.getAddonInfo('path'), 'resources', 'images', 
iconImgList[i])})
+    return retList
 
-_regex_extractMenuItem = re.compile("<li class=\"cat-item 
cat-item-([0-9]{1,4})\"><a 
href=\"(http://cinemassacre.com/category/[a-z0-9\-]*/)\" 
title=\"(.*?)\">(.*?)</a>", re.DOTALL);
-_regex_extractMenuItemSub = re.compile("<li class=\"cat-item 
cat-item-([0-9]{1,4})\"><a 
href=\"(http://cinemassacre.com/category/[a-z0-9\-]*/[a-z0-9\-]*/)\" 
title=\"(.*?)\">(.*?)</a>", re.DOTALL);
-_regex_extractMenuItemSubSub = re.compile("<li class=\"cat-item 
cat-item-([0-9]{1,4})\"><a 
href=\"(http://cinemassacre.com/category/[a-z0-9\-]*/[a-z0-9\-]*/[a-z0-9\-]*/)\"
 title=\"(.*?)\">(.*?)</a>", re.DOTALL);
+def getNotShownUrls():
+    xmlContents = retFileAsString(defaultsXML)
+    exclList =  common2.parseDOM(xmlContents, "excludeUrls")
+    urlList =  common2.parseDOM(exclList, "url")
+    
+    retList = []
+    for url in urlList:
+        retList.append(url)
+    return retList
 
-_regex_extractShow = re.compile("<!-- content -->(.*?)<!-- /content -->", 
re.DOTALL)
-_regex_extractRecent = re.compile("<!-- videos -->(.*?)<!-- /videos -->", 
re.DOTALL);
+def excludeUrl(url):
+    for notUrl in dontShowTheseUrls:
+      if notUrl in url:
+        return True
+    return False
 
-_regex_extractEpisode = re.compile("<!-- video -->(.*?)<!-- /video -->", 
re.DOTALL)
-_regex_extractEpisodeLink = re.compile("<h3><a href=\"(.*?)\">(.*?)</a></h3>", 
re.DOTALL)
-_regex_extractEpisodeImg = re.compile("<img src=\"(.*?)\" alt=\"(.*?)\" />", 
re.DOTALL)
-_regex_extractEpisodeImg2 = re.compile("<img width=\"[0-9]*\" 
height=\"[0-9]*\" src=\"(.*?)\" class=\".*?\" alt=\"(.*?)\" title=\".*?\" />", 
re.DOTALL)
+def checkDefaultIcon(url):
+    possibleIcon = ""
+    for defaultIcon in defaultFolderIcons["list"]:
+        if (defaultIcon["url"] in url) and (len(defaultIcon["image"]) > 
len(possibleIcon)):
+            possibleIcon = defaultIcon["image"]
+    if len(possibleIcon) == 0:
+        possibleIcon = defaultFolderIcons["default"]
+    return possibleIcon
+    
+def addEpisodeListToDirectory(epList):
+    print "Adding Video List: %s" % epList
+    for episode in epList:
+        if not excludeUrl(episode['url']):
+            addDirectoryItem(remove_html_special_chars(episode['title']), 
{"action" : "episode", "link": episode['url']}, episode['thumb'], False)
+    xbmcplugin.endOfDirectory(thisPlugin)        
+    
+def extractEpisodeImg(episode):
+    linkImage = common2.parseDOM(episode, "div", attrs={"class": 
"video-tnail"})
+    linkImage = common2.parseDOM(linkImage, "img", ret="src")
+    linkImageTmp = re.compile('src=([^&]*)', re.DOTALL).findall(linkImage[0])
+    if len(linkImageTmp)>0:
+        if linkImageTmp[0][:1] != "/":
+            linkImageTmp[0] = "/" + linkImageTmp[0]
+        linkImage = baseLink+linkImageTmp[0]
+    else:
+        if (len(linkImage[0]) > 0) and (baseLink in linkImage[0]):
+            linkImage = linkImage[0]
+        else:
+            linkImage = ""
+    return linkImage
 
+def pageInCache(episodeList,link):
+    storedList = cache.get(link)
+    try:
+        storedList = eval(storedList)
+    except:
+        storedList = []
+    if (len(storedList) >= len(episodeList)):
+        for i in range(0,len(episodeList)):
+            if episodeList[i] != storedList[i]:
+                return []
+        print "Using Stored Cache Page"
+        return storedList
+    return []
+    
 def mainPage():
     global thisPlugin
+    addDirectoryItem(addon.getLocalizedString(30000), {"action" : "recent", 
"link": ""}, defaultFolderIcons["default"])  
+    subMenu(baseLink)
 
-    addDirectoryItem(addon.getLocalizedString(30000), {"action" : "recent", 
"link": ""})  
-    subMenu(level1=0, level2=0)
-
-def subMenu(level1=0, level2=0):
+def subMenu(link,row='[]'):
     global thisPlugin
-    page = load_page(baseLink)
-    mainMenu = extractMenu(page)
+    link = urllib.unquote(link)
+    page = load_page(link)
+    mainMenu = extractMenu(page,urllib.unquote(row))
     
-    if level1 == 0:
-        menu = mainMenu
-    elif level2 == 0:
-        menu = mainMenu[int(level1)]['children']
-    else:
-        menu = mainMenu[int(level1)]['children'][int(level2)]['children']
+    if not len(mainMenu):
+        return showPage(link) # If link has no sub categories then display 
video list
     
-    counter = 0
-    for menuItem in menu:
+    if len(link) != len(baseLink) and (link != '#'):
+      addDirectoryItem(addon.getLocalizedString(30001), {"action" : "show", 
"link": link}, defaultFolderIcons["default"]) # All Videos Link
+    
+    for menuItem in mainMenu:
         menu_name = remove_html_special_chars(menuItem['name']);
-        
         menu_link = menuItem['link'];
-        if len(menuItem['children']) and level1 == 0:
-            addDirectoryItem(menu_name, {"action" : "submenu", "link": 
counter})  
-        elif len(menuItem['children']):
-            addDirectoryItem(menu_name, {"action" : "subsubmenu", "link": 
level1 + ";" + str(counter)})  
-        else:        
-            addDirectoryItem(menu_name, {"action" : "show", "link": menu_link})
-        counter = counter + 1
+        if excludeUrl(menu_link):
+           continue
+        menu_icon = checkDefaultIcon(menu_link)
+        addDirectoryItem(menu_name, {"action" : "submenu", "link": menu_link, 
"row": menuItem['row']}, menu_icon)
+        
     xbmcplugin.endOfDirectory(thisPlugin)
 
 def recentPage():
     global thisPlugin
     page = load_page(baseLink)
-    show = _regex_extractRecent.search(page)    
-    extractEpisodes(show)
-    
-def extractMenu(page):
-    menu = _regex_extractMenu.search(page).group(1);
-    menuList = []
-    
-    parent = -1;
-    parentHidden = True
-    parent2Hidden = True
-    for line in menu.split("\n"):
-        menuItem = _regex_extractMenuItem.search(line)
-        if menuItem is not None:
-            if not menuItem.group(1) in hideMenuItem:
-                parentHidden = False
-                parent = parent + 1
-                parent2 = -1
-                menuList.append({"name" : menuItem.group(4), "link" : 
menuItem.group(2), "children" : []})
-            else:
-                parentHidden = True
-        elif not parentHidden:
-            menuItemSub = _regex_extractMenuItemSub.search(line)
-            if menuItemSub is not None:
-                if not menuItemSub.group(1) in hideMenuItem:
-                    parent2Hidden = False
-                    parent2 = parent2 + 1
-                    menuList[parent]['children'].append({"name" : 
menuItemSub.group(4), "link" : menuItemSub.group(2), "children" : []});
-                else:
-                    parent2Hidden = True
-            elif not parent2Hidden:
-                menuItemSubSub = _regex_extractMenuItemSubSub.search(line)
-                if menuItemSubSub is not None:
-                    if not menuItemSubSub.group(1) in hideMenuItem:
-                        
menuList[parent]['children'][parent2]['children'].append({"name" : 
menuItemSubSub.group(4), "link" : menuItemSubSub.group(2), "children" : []});
-    return menuList
+    show = common2.parseDOM(page, "div", attrs={"class": "footercontainer3"})
+    show = common2.parseDOM(show, "div", attrs={"class": "footeritem"})
+    show = common2.parseDOM(show, "li")
+    linkList = []
+    for item in show:
+        title = common2.parseDOM(item, "a")[0]
+        link = common2.parseDOM(item, "a", ret="href")[0]
+        linkList.append({"title":title, "url":link, "thumb":""})
+    addEpisodeListToDirectory(linkList)
     
+def extractMenu(page,row='[]'):
+    navList = common2.parseDOM(page, "div", attrs={"id": "navArea"})
+    navList = common2.parseDOM(navList[0], "ul", attrs={"id": 
"menu-main-menu"})
+    navList = common2.parseDOM(navList[0], "li")
+    row2 = eval(row)
+    tempCont = navList
+    for i in row2:
+        tempCont = common2.parseDOM(tempCont[i], "li")
+
+    retList = []
+    for i in range(0,len(tempCont)):
+        tmpRow = eval(row)
+        tmpRow.append(i)
+        testNav = re.compile('^<a 
href="([^\"\']*?)">([^<]*?)</a>').findall(tempCont[i])
+        try:
+            retList.append({"name": testNav[0][1],"link": testNav[0][0], 
"row":repr(tmpRow)})
+        except: print "extractMenu: list index out of range"
+    return retList
+
 def showPage(link):
     global thisPlugin
-    page = load_page(urllib.unquote(link))
-    show = _regex_extractShow.search(page)
-    extractEpisodes(show)
+    link = urllib.unquote(link)
+    page = load_page(link)
+    # Some pages has the newest video in a "Featured Video" section
+    show = common2.parseDOM(page, "div", attrs={"id": "featuredImg"})
+    try:
+        fTitle = common2.parseDOM(show, "span", attrs={"id": 
"archiveCaption"})[0]
+        fTitle = common2.parseDOM(fTitle, "a")[0]
+        fLink = common2.parseDOM(show, "a", ret="href")[0]
+        fImg = common2.parseDOM(show, "img", ret="src")[0]
+    except: print "No featured video found"
+
+    show = common2.parseDOM(page, "div", attrs={"id": "postlist"})
+    episodeList = extractEpisodes(show)
+    episodeList.insert(0, {"title":fTitle, "url":fLink, "thumb":fImg})
+    #cache.delete(link)
+    
+    ##Check first page against cache
+    cachedPage = pageInCache(episodeList,link) # Returns empty list if cache 
differs
+    if (len(cachedPage)>0):
+        episodeList = cachedPage
+        show = None
+    
+    if (show != None):
+        curPage = int(re.compile('var count = (\d+?);').findall(page)[0])
+        pageTotal = int(re.compile('var total = (\d+?);').findall(page)[0])
+        pageCat = re.compile('var cat = (\d+?);').findall(page)[0]
+        nextPageUrl = baseLink + "wp-admin/admin-ajax.php"
+               
+        while (curPage <= pageTotal):
+            pageData = "action=infinite_scroll&page_no="+ str(curPage) + 
'&cat=' + pageCat + '&loop_file=loop'
+            page = load_page(nextPageUrl,pageData)
+            linkList = extractEpisodes(page)
+            episodeList = episodeList + linkList
+            curPage += 1
+
+    cache.set(link, repr(episodeList)) #update cache
+    addEpisodeListToDirectory(episodeList)
 
 def extractEpisodes(show):
-    episodes = list(_regex_extractEpisode.finditer(show.group(1)))
+    episodes = common2.parseDOM(show, "div", attrs={"class": "archiveitem"})
+    linkList = []
     for episode in episodes:
-        episode_html = episode.group(1)
-        episod_title = _regex_extractEpisodeLink.search(episode_html).group(2)
-        episod_title = remove_html_special_chars(episod_title)
-        episode_link = _regex_extractEpisodeLink.search(episode_html).group(1)
-        episode_img = _regex_extractEpisodeImg.search(episode_html)
-        if episode_img is None:
-            episode_img = _regex_extractEpisodeImg2.search(episode_html)
-        episode_img = episode_img.group(1)
-        addDirectoryItem(episod_title, {"action" : "episode", "link": 
episode_link}, episode_img, False)
-    xbmcplugin.endOfDirectory(thisPlugin)
-
+        episode = episode.encode('ascii', 'ignore')
+        episode_link = common2.parseDOM(episode, "a", ret="href")[0]
+        if excludeUrl(episode_link):
+            continue
+        episode_title = common2.parseDOM(episode, "a")[0]
+        episode_title = 
re.compile('<div>([^<]*?)</div>').findall(episode_title)[0]
+        try:
+            episode_img = common2.parseDOM(episode, "img", ret="src")[0]
+        except:
+            episode_img = ""
+        linkList.append({"title":episode_title, "url":episode_link, 
"thumb":episode_img})
+    return linkList
 
 def playEpisode(link):
     link = urllib.unquote(link)
     page = load_page(link)
     showEpisode.showEpisode(page)
 
-def load_page(url):
-    print url
-    req = urllib2.Request(url)
+def load_page(url, data=None):
+    print "Getting page: " + url
+    if len(url)<5:
+        url = baseLink
+    if data!=None:
+      req = urllib2.Request(url,data)
+      req.add_header('Content-Type', 'application/x-www-form-urlencoded')
+    else:
+      req = urllib2.Request(url)
+    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:14.0) 
Gecko/20100101 Firefox/14.0.1')
     response = urllib2.urlopen(req)
     link = response.read()
     response.close()
@@ -141,15 +237,13 @@ def addDirectoryItem(name, parameters={}, pic="", 
folder=True):
     li = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", 
thumbnailImage=pic)
     if not folder:
         li.setProperty('IsPlayable', 'true')
-    url = sys.argv[0] + '?' + urllib.urlencode(parameters)
+    url = sys.argv[0] + '?' + urllib.urlencode(parameters)# + "&randTok=" + 
str(random.randint(1000, 10000))
     return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, 
listitem=li, isFolder=folder)
 
 def remove_html_special_chars(inputStr):
-    inputStr = inputStr.replace("&#8211;", "-")
-    inputStr = inputStr.replace("&#8217;", "'")#\x92
-    inputStr = inputStr.replace("&#039;", chr(39))# '
-    inputStr = inputStr.replace("&#038;", chr(38))# &
-    return inputStr
+    inputStr = common.replaceHTMLCodes(inputStr)
+    inputStr=inputStr.strip()
+    return common.makeAscii(inputStr)
     
 def get_params():
     param = []
@@ -168,19 +262,22 @@ def get_params():
                 param[splitparams[0]] = splitparams[1]
     
     return param
-    
+
+dontShowTheseUrls = getNotShownUrls()
+defaultFolderIcons["list"] = getDefaultIcons()
+
 if not sys.argv[2]:
     mainPage()
 else:
     params = get_params()
     if params['action'] == "show":
+        print "Video List"
         showPage(params['link'])
     elif params['action'] == "submenu":
-        subMenu(params['link'])
-    elif params['action'] == "subsubmenu":
-        levels = urllib.unquote(params['link']).split(";")
-        subMenu(levels[0], levels[1])
+        print "Menu"
+        subMenu(params['link'],params['row'])
     elif params['action'] == "recent":
+        print "Recent list"
         recentPage()
     elif params['action'] == "episode":
         print "Episode"
diff --git a/plugin.video.cinemassacre/icon.png 
b/plugin.video.cinemassacre/icon.png
index 175e52c..36eda72 100644
Binary files a/plugin.video.cinemassacre/icon.png and 
b/plugin.video.cinemassacre/icon.png differ
diff --git a/plugin.video.cinemassacre/resources/language/English/strings.xml 
b/plugin.video.cinemassacre/resources/language/English/strings.xml
index 173d88c..8752777 100644
--- a/plugin.video.cinemassacre/resources/language/English/strings.xml
+++ b/plugin.video.cinemassacre/resources/language/English/strings.xml
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
        <string id="30000">Recent videos</string>
-</strings>
\ No newline at end of file
+        <string id="30001">All videos</string>
+</strings>
diff --git a/plugin.video.cinemassacre/showEpisode.py 
b/plugin.video.cinemassacre/showEpisode.py
index ae5f65d..6000f1c 100644
--- a/plugin.video.cinemassacre/showEpisode.py
+++ b/plugin.video.cinemassacre/showEpisode.py
@@ -8,20 +8,26 @@ try:
     import urlresolver
 except:
     print "No urlresolver"
-
+import thisCommonFunctions
+common = thisCommonFunctions
 thisPlugin = int(sys.argv[1])
 
 def showEpisode(episode_page):
-    
+    episode_page2 = common.parseDOM(episode_page, "div", attrs={"id": 
"video-content"})
+    if len(episode_page2):
+      episode_page = episode_page2[0]
+      
     providers = (
         {"function":showEpisodeBip, 
"regex":"(http://blip.tv/play/.*?)(.html|\")"},
         {"function":showEpisodeYoutube, 
"regex":"http://www.youtube.com/(embed|v)/(.*?)(\"|\?|\ |&)"},
         {"function":showEpisodeDorkly, 
"regex":"http://www.dorkly.com/(e/|moogaloop/noobtube.swf\?clip_id=)([0-9]*)"},
         {"function":showEpisodeSpringboard, 
"regex":"\.springboardplatform\.com/mediaplayer/springboard/video/(.*?)/(.*?)/(.*?)/"},
         {"function":showEpisodeSpringboard, 
"regex":"\\$sb\\(\"(.*?)\",{\"sbFeed\":{\"partnerId\":(.*?),\"type\":\"video\",\"contentId\":(.*?),\"cname\":\"(.*?)\"},\"style\":{\"width\":.*?,\"height\":.*?}}\\);"},
-        {"function":showEpisodeDaylimotion, 
"regex":"(http://www.dailymotion.com/video/.*?)_"},          
-        {"function":showEpisodeGametrailers, "regex":"<a 
href=\"(http://www.gametrailers.com/video/angry-video-screwattack/(.*))\" 
target=\"_blank\">"},
-        {"function":showEpisodeSpike, "regex":"<a 
href=\"(http://www.spike.com/.*?)\""},               
+        {"function":showEpisodeDaylimotion, 
"regex":"(http://www.dailymotion.com/video/.*?)_"},
+        {"function":showEpisodeGametrailers, "regex":"<a 
href=\"(http://www.gametrailers.com/videos/(.*).*)\" target=\"_blank\">"},
+        {"function":showEpisodeSpringboadAfterResolve, "regex":"<script 
src=\"http://www.springboardplatform.com/js/overlay\";></script><iframe 
id=\"(.*?)\" src=\"(.*?)\""},
+        {"function":showEpisodeSpike, "regex":"<a 
href=\"(http://www.spike.com/.*?)\""},
+        {"function":showEpisodeScreenwave, 
"regex":"((?:[^\"\']*)screenwavemedia.com/(?:[^\/]*)/embed.php(?:[^\"\']*))"},
     )
     
     for provider in providers:
@@ -29,10 +35,54 @@ def showEpisode(episode_page):
         videoItem = regex.search(episode_page)
         if videoItem is not None:
             return provider['function'](videoItem)
+            
+def showEpisodeScreenwave(videoItem):
+    tmpContent = showEpisodeLoadPage(videoItem.group(1))
+  
+    streamerVal = re.compile('streamer(?:[\'|\"]*):(?:[\s|\'|\"]*)([^\']*)', 
re.DOTALL).findall(tmpContent)
+    flashplayerVal = 
re.compile('flashplayer(?:[\'|\"]*):(?:[\s|\'|\"]*)([^\']*)', 
re.DOTALL).findall(tmpContent)
+    levelsVal = re.compile('levels(?:[\'|\"]*): \[(.*)\],', 
re.DOTALL).findall(tmpContent)
+    files = ""
+    if len(levelsVal)>0:
+        filesVal = re.compile('file(?:[\'|\"]*):(?:[\s|\'|\"]*)([^\'|\"]*)', 
re.DOTALL).findall(levelsVal[0])
+        for i in range(0,len(filesVal)):
+            if "high" in filesVal[i]:
+                files = filesVal[i]
+                break
+      
+    if len(streamerVal)>0 and len(flashplayerVal)>0 and len(files)>0:
+        rtmpurl = streamerVal[0]
+        swfVfy = flashplayerVal[0]
+
+        fileExt = re.compile('\.([^.]+)$', re.DOTALL).findall(files)
+        if len(fileExt)>0:
+            files = fileExt[0] + ":" + files
+          
+        if rtmpurl[-1:] != "/":
+            rtmpurl = rtmpurl + "/"
+        rtmpurl = rtmpurl + files
+
+        segmentUrl = rtmpurl + " playpath=" + files + " pageurl=" + 
videoItem.group(1) + " swfVfy=" + swfVfy
+
+        listitem = xbmcgui.ListItem(path=segmentUrl)
+        return xbmcplugin.setResolvedUrl(thisPlugin, True, listitem)
+    
+def showEpisodeSpringboadAfterResolve(videoItem):
+    _regex_extractVideoParameters = 
re.compile("http://cms\.springboard.*\.com/(.*?)/(.*?)/video/(.*?)/.*?/(.*?)")
+
+    # Handle shortened URLs
+    req = urllib2.Request(videoItem.group(2))
+    response = urllib2.urlopen(req)
+    fullURL = response.geturl()
+
+    videoItem = _regex_extractVideoParameters.search(fullURL)
+    showEpisodeSpringboard(videoItem)
+    return False
 
 def showEpisodeBip(videoItem):
     _regex_extractVideoFeedURL = re.compile("file=(.*?)&", re.DOTALL);
     _regex_extractVideoFeedURL2 = re.compile("file=(.*)", re.DOTALL);
+    _regex_extractVideoFeedURL3 = re.compile("data-episode-id=\"(.+?)\"", 
re.DOTALL);
 
     videoLink = videoItem.group(1)
     
@@ -44,6 +94,8 @@ def showEpisodeBip(videoItem):
     feedURL = _regex_extractVideoFeedURL.search(fullURL)
     if feedURL is None:
         feedURL = _regex_extractVideoFeedURL2.search(fullURL)
+        if feedURL is None:
+            feedURL = _regex_extractVideoFeedURL3.search(response.read())
     feedURL = urllib.unquote(feedURL.group(1))
     
     blipId = feedURL[feedURL.rfind("/") + 1:]
@@ -74,7 +126,7 @@ def showEpisodeDorkly(videoItem):
     return False
     
 def showEpisodeSpringboard(videoItem):
-    _regex_extractVideoSpringboardStream = re.compile("<media:content 
duration=\"[0-9]*?\" medium=\"video\" bitrate=\"[0-9]*?\" fileSize=\"[0-9]*?\" 
url=\"(.*?)\" type=\".*?\" />");
+    _regex_extractVideoSpringboardStream = 
re.compile("<media:content.*?url=\"(.*?)\".*?/>");
     
     siteId = videoItem.group(2)
     contentId = videoItem.group(3)
@@ -88,6 +140,7 @@ def showEpisodeSpringboard(videoItem):
     feedItem = _regex_extractVideoSpringboardStream.search(feed);
     stream_url = feedItem.group(1)
     item = xbmcgui.ListItem(path=stream_url)
+
     xbmcplugin.setResolvedUrl(thisPlugin, True, item)
     return False
 
@@ -99,20 +152,41 @@ def showEpisodeDaylimotion(videoItem):
     return False
 
 def showEpisodeGametrailers(videoItem):
-    _regex_extractVideoGametrailersXML = re.compile("<media:content 
type=\"text/xml\" medium=\"video\" isDefault=\"true\" duration=\"[0-9]{1,4}\" 
url=\"(.*?)\"/>")
-    _regex_extractVideoGametrailersStreamURL = re.compile("<src>(.*?)</src>")
+    _regex_extractVideoGametrailerId = re.compile("<meta property=\"og:video\" 
content=\"(http://media.mtvnservices.com/fb/mgid:arc:video:gametrailers.com:(.*?)\.swf)\"
 />");
+    _regex_extractVideoGametrailerStreamURL = re.compile("<rendition 
bitrate=\"(.*?)\".*?<src>(.*?)</src>.*?</rendition>",re.DOTALL)
 
-    url = videoItem.group(1)
-    videoId = videoItem.group(2)
-    urlXml = 
"http://www.gametrailers.com/neo/?page=xml.mediaplayer.Mrss&mgid=mgid%3Amoses%3Avideo%3Agametrailers.com%3A";
 + videoId + "&keyvalues={keyvalues}"
-    xml1 = showEpisodeLoadPage(urlXml)
-    urlXml = _regex_extractVideoGametrailersXML.search(xml1).group(1)
-    urlXml = urlXml.replace("&amp;", "&")
-    xml2 = showEpisodeLoadPage(urlXml)
-    stream_url = _regex_extractVideoGametrailersStreamURL.search(xml2).group(1)
-    item = xbmcgui.ListItem(path=stream_url)
-    xbmcplugin.setResolvedUrl(thisPlugin, True, item)
-    return False
+    videoUrl = videoItem.group(1)
+    videoPage = showEpisodeLoadPage(videoUrl)
+    swfUrl = _regex_extractVideoGametrailerId.search(videoPage).group(1)
+
+    #GET the 301 redirect URL
+    req = urllib2.Request(swfUrl)
+    response = urllib2.urlopen(req)
+    swfUrl = response.geturl()
+    videoId = _regex_extractVideoGametrailerId.search(videoPage).group(2)
+
+    feedUrl = 
"http://udat.mtvnservices.com/service1/dispatch.htm?feed=mediagen_arc_feed&account=gametrailers.com&mgid=mgid%3Aarc%3Acontent%3Agametrailers.com%3A"+videoId+"&site=gametrailers.com&segment=0&mgidOfMrssFeed=mgid%3Aarc%3Acontent%3Agametrailers.com%3A"+videoId
+
+    videoFeed = showEpisodeLoadPage(feedUrl)
+    videoStreamUrls = 
_regex_extractVideoGametrailerStreamURL.finditer(videoFeed)
+
+    curStream = None
+    curBitrate = 0
+    for stream in videoStreamUrls:
+        streamUrl = stream.group(2)
+        streamBitrate = int(stream.group(1))
+        if streamBitrate>curBitrate:
+            curStream = streamUrl.replace(" ","%20")
+            curBitrate = streamBitrate
+
+    swfUrl = swfUrl.replace("&geo=DE","&geo=US")
+    swfUrl = swfUrl.replace("geo%3dDE%26","geo%3dUS%26")
+
+    stream_url = curStream + " swfUrl="+swfUrl+" swfVfy=1"
+    if curStream is not None:
+        item = xbmcgui.ListItem(path=stream_url)
+        xbmcplugin.setResolvedUrl(thisPlugin, True, item)
+        return False
 
 def showEpisodeSpike(videoItem):
     _regex_extraxtVideoSpikeId = re.compile("<meta property=\"og:video\" 
content=\"(http://media.mtvnservices.com/mgid:arc:video:spike.com:(.*?))\" />");
@@ -152,6 +226,7 @@ def showEpisodeSpike(videoItem):
 def showEpisodeLoadPage(url):
     print url
     req = urllib2.Request(url)
+    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:14.0) 
Gecko/20100101 Firefox/14.0.1')
     response = urllib2.urlopen(req)
     link = response.read()
     response.close()

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

Summary of changes:
 plugin.video.cinemassacre/addon.xml                |    9 +-
 plugin.video.cinemassacre/changelog.txt            |    5 +
 plugin.video.cinemassacre/default.py               |  313 +++++++++++++-------
 plugin.video.cinemassacre/icon.png                 |  Bin 48208 -> 56865 bytes
 plugin.video.cinemassacre/resources/defaults.xml   |   30 ++
 .../resources/images/avgn.png                      |  Bin 0 -> 109765 bytes
 .../resources/images/boardJ.png                    |  Bin 0 -> 31907 bytes
 .../resources/images/ykwbs.png                     |  Bin 0 -> 111199 bytes
 .../resources/language/English/strings.xml         |    3 +-
 plugin.video.cinemassacre/showEpisode.py           |  113 ++++++--
 plugin.video.cinemassacre/thisCommonFunctions.py   |   77 +++++
 11 files changed, 418 insertions(+), 132 deletions(-)
 create mode 100644 plugin.video.cinemassacre/resources/defaults.xml
 create mode 100644 plugin.video.cinemassacre/resources/images/avgn.png
 create mode 100644 plugin.video.cinemassacre/resources/images/boardJ.png
 create mode 100644 plugin.video.cinemassacre/resources/images/ykwbs.png
 create mode 100644 plugin.video.cinemassacre/thisCommonFunctions.py


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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to