The branch, frodo has been updated
via 8c3aeda985b36598a44a29bb404cf95ed2719495 (commit)
via fa0a391eb459fbf14b4088d945cc6fef30f6023e (commit)
from 6939dae4e8ada846aaf2ddf23a27c8014a1a67e6 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=8c3aeda985b36598a44a29bb404cf95ed2719495
commit 8c3aeda985b36598a44a29bb404cf95ed2719495
Author: beenje <[email protected]>
Date: Sat Nov 24 22:55:53 2012 +0100
[plugin.video.svtplay] updated to version 3.1.0
diff --git a/plugin.video.svtplay/addon.xml b/plugin.video.svtplay/addon.xml
index 68a7202..c0856c1 100644
--- a/plugin.video.svtplay/addon.xml
+++ b/plugin.video.svtplay/addon.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.svtplay"
name="SVT Play"
- version="3.0.0"
+ version="3.1.0"
provider-name="nilzen">
<requires>
<import addon="script.module.parsedom" version="1.2.0"/>
- <import addon="xbmc.python" version="2.0"/>
+ <import addon="xbmc.python" version="2.1"/>
</requires>
<extension point="xbmc.python.pluginsource" library="default.py">
<provides>video</provides>
diff --git a/plugin.video.svtplay/changelog.txt
b/plugin.video.svtplay/changelog.txt
index a56e0c2..c8e4362 100644
--- a/plugin.video.svtplay/changelog.txt
+++ b/plugin.video.svtplay/changelog.txt
@@ -1,3 +1,11 @@
+Version 3.0.1
+-------------
+- Added search, fixed urls etc (by linqcan)
+
+Version 3.0.0
+-------------
+- Rewrite for Frodo
+
Version 2.0.4
-------------
- Updated SWF-player URL (by dahlSTROM)
diff --git a/plugin.video.svtplay/default.py b/plugin.video.svtplay/default.py
index f433324..0975220 100644
--- a/plugin.video.svtplay/default.py
+++ b/plugin.video.svtplay/default.py
@@ -20,7 +20,10 @@ MODE_CATEGORIES = "categories"
MODE_CATEGORY = "ti"
MODE_LETTER = "letter"
MODE_RECOMMENDED = "rp"
-MODE_PSL = "psl"
+MODE_SEARCH = "search"
+MODE_SEARCH_TITLES = "search_titles"
+MODE_SEARCH_EPISODES = "search_episodes"
+MODE_SEARCH_CLIPS = "search_clips"
BASE_URL = "http://www.svtplay.se"
@@ -29,7 +32,7 @@ URL_CATEGORIES = "/kategorier"
URL_TO_LATEST = "?tab=episodes&sida=1"
URL_TO_LATEST_NEWS = "?tab=news&sida=1"
URL_TO_RECOMMENDED = "?tab=recommended&sida=1"
-URL_TO_PSL = "/psl"
+URL_TO_SEARCH = "/sok?q="
VIDEO_PATH_RE = "/(klipp|video|live)/\d+"
VIDEO_PATH_SUFFIX = "?type=embed"
@@ -65,7 +68,8 @@ def viewStart():
addDirectoryItem(localize(30002), { "mode": MODE_LIVE })
addDirectoryItem(localize(30003), { "mode": MODE_LATEST, "page": 1 })
addDirectoryItem(localize(30004), { "mode": MODE_LATEST_NEWS, "page": 1 })
- addDirectoryItem(localize(30006), { "mode": MODE_PSL, "page": 1 })
+ addDirectoryItem(localize(30006), { "mode": MODE_SEARCH })
+
def viewAtoO():
html = getPage(BASE_URL + URL_A_TO_O)
@@ -102,7 +106,7 @@ def viewLive():
if match:
- url = match.group() + VIDEO_PATH_SUFFIX
+ url = urllib.quote(match.group() + VIDEO_PATH_SUFFIX)
addDirectoryItem(common.replaceHTMLCodes(text), { "mode":
MODE_VIDEO, "url": url }, None, False, True)
@@ -183,8 +187,93 @@ def viewCategory(url,page,index):
def viewProgram(url,page,index):
createDirectory(url,page,index,MODE_PROGRAM,MODE_VIDEO)
-def viewPSL(page,index):
- createDirectory(URL_TO_PSL,page,index,MODE_PSL,MODE_VIDEO)
+def viewSearch():
+
+ keyword = common.getUserInput(localize(30102))
+ keyword = urllib.quote(keyword)
+ common.log("Search string: " + keyword)
+
+ if keyword == "" or not keyword:
+ viewStart()
+ return
+
+ keyword = re.sub(r" ","+",keyword)
+
+ url = URL_TO_SEARCH + keyword
+ html = getPage(BASE_URL + url)
+ foundTab = False
+ url = urllib.quote(url)
+
+ # Try fetching the "titles" tab. If it exists; create link to result
directory
+ try:
+ common.parseDOM(html, "div", attrs = { "data-tabname": "titles" })[0]
+ foundTab = True
+ except:
+ # Do nothing
+ common.log("No titles found")
+ else:
+ addDirectoryItem(localize(30104), {
+ "mode": MODE_SEARCH_TITLES,
+ "url": url,
+ "page": 1,
+ "index": 0 })
+
+ # Try fetching the "episodes" tab. If it exists; create link to result
directory
+ try:
+ common.parseDOM(html, "div", attrs = { "data-tabname": "episodes" })[0]
+ foundTab = True
+ except:
+ # Do nothing
+ common.log("No episodes found")
+ else:
+ addDirectoryItem(localize(30105), {
+ "mode": MODE_SEARCH_EPISODES,
+ "url": url,
+ "page": 1,
+ "index": 0 })
+
+ # Try fetching the "clips" tab. If it exists; create link to result
directory
+ try:
+ common.parseDOM(html, "div", attrs = { "data-tabname": "clips" })[0]
+ foundTab = True
+ except:
+ # Do nothing
+ common.log("No clips found")
+ else:
+ addDirectoryItem(localize(30106), {
+ "mode": MODE_SEARCH_CLIPS,
+ "url": url,
+ "page": 1,
+ "index": 0 })
+
+ if not foundTab:
+ # Raise dialog with a "No results found" message
+ common.log("No search result")
+ dialog = xbmcgui.Dialog()
+ dialog.ok("SVT Play",localize(30103))
+ viewSearch()
+ return
+
+def viewSearchResults(url,mode,page,index):
+ """
+ Creates a directory for the search results from
+ the tab specified by the mode parameter.
+ """
+ common.log("url: " + url + " mode: " + mode)
+ dirtype = None
+
+ if MODE_SEARCH_TITLES == mode:
+ dirtype = MODE_PROGRAM
+ elif MODE_SEARCH_EPISODES == mode:
+ dirtype = MODE_VIDEO
+ elif MODE_SEARCH_CLIPS == mode:
+ dirtype = MODE_VIDEO
+ else:
+ common.log("Undefined mode")
+ viewStart()
+ return
+
+ createDirectory(url,page,index,mode,dirtype)
def createDirectory(url,page,index,callertype,dirtype):
"""
@@ -197,19 +286,19 @@ def createDirectory(url,page,index,callertype,dirtype):
url = "/" + url
tabname = "episodes"
- if callertype == MODE_RECOMMENDED:
+ if MODE_RECOMMENDED == callertype:
tabname = "recommended"
- elif callertype == MODE_LATEST_NEWS:
+ elif MODE_LATEST_NEWS == callertype:
tabname = "news"
- elif callertype == MODE_PSL:
+ elif MODE_SEARCH_CLIPS == callertype:
tabname = "clips"
- elif callertype == MODE_CATEGORY:
+ elif MODE_CATEGORY == callertype or MODE_SEARCH_TITLES == callertype:
tabname = "titles"
(foundUrl,ajaxurl,lastpage) = parseAjaxUrlAndLastPage(url,tabname)
if not foundUrl:
- populateDirNoPaging(url,MODE_VIDEO)
+ populateDirNoPaging(url,dirtype,tabname)
return
fetchitems = True
@@ -242,14 +331,16 @@ def parseAjaxUrlAndLastPage(url,tabname):
Fetches the Ajax URL and the the last page number
from a program page.
"""
+ common.log("url: " + url + ", tabname: " + tabname)
classexp = "[^\"']*playShowMoreButton[^\"']*"
dataname = "sida"
html = getPage(BASE_URL + url)
+
container = common.parseDOM(html,
"div",
- attrs = { "class": "[^\"']*playBoxBody[^\"']*",
"data-tabname": tabname })[0]
+ attrs = { "class":
"[^\"']*[playBoxBody|playBoxAltBody][^\"']*", "data-tabname": tabname })[0]
try:
- ajaxurl = common.parseDOM(container,
+ ajaxurl = common.parseDOM(container,
"a",
attrs = { "class": classexp, "data-name":
dataname },
ret = "data-baseurl")[0]
@@ -272,6 +363,8 @@ def populateDir(ajaxurl,mode,page,index):
all items on a page were used to populate the previous
directory.
"""
+ common.log("ajaxurl: " + ajaxurl + ", mode: " + mode + ", page: " + page +
", index: " + str(index))
+
global CURR_DIR_ITEMS
articles = getArticles(ajaxurl,page)
@@ -283,70 +376,73 @@ def populateDir(ajaxurl,mode,page,index):
if CURR_DIR_ITEMS >= MAX_DIR_ITEMS:
CURR_DIR_ITEMS = 0
return (False,index)
-
- text = common.parseDOM(article, "h5")[0]
- href = common.parseDOM(article, "a",
- attrs = { "class": "[^\"']*playLink[^\"']*" },
- ret = "href")[0]
- thumbnail = common.parseDOM(article,
- "img",
- attrs = { "class": "playGridThumbnail" },
- ret = "src")[0]
- thumbnail = thumbnail.replace("/medium/", "/l bnail" }, k[^\"']*" }, +
", index: " + str(index)) name": tabname
})[0] b5ÿ pb5ÿ uê5¹+
7¹+ W¹+ øRº+ pb5ÿ uº+ `b5ÿ 0b5ÿ k 6¹+ 6
è è! è! b5ÿ pb5ÿ x´Rº+ `b5ÿ â5¹+ 6¹+ b5ÿ `â5¹+ ?b5ÿ À¯¶º+ uê5¹+ ¶º+ ؤ¶º+ ¨©¶º+
7¹+ x´Rº+ `b5ÿ 0b5ÿ k 6¹+ à! à! b5ÿ pb5ÿ H~2º+ @b5ÿ â5¹+ 6¹+ b5ÿ `â5¹+ ?b5ÿ 0b5ÿ (b5ÿ 8W¹+ p pb5ÿ uê5¹+
7¹+ @b5ÿ b5ÿ k 6¹+ G H I J K M N O P b5ÿ pb5ÿ H5
º+ àb5ÿ â5¹+ 6¹+ b5ÿ 0¯¶º+ uê5¹+ ÀRº+ iæ¹+ ¶º+ ؤ¶º+ ¨©¶º+
7¹+ H5 º+ àb5ÿ b5ÿ k 6¹+ 85
º+ àb5ÿ Pb5ÿ k 6¹+ (5
º+ àb5ÿ b5ÿ k 6¹+ 5
º+ àb5ÿ °b5ÿ k 6¹+
¨®¶º+ uê5¹+ ¨©¶º+ 0b5ÿ ¸æ¹+ eé5¹+ ؤ¶º+ Pb5ÿ y¸æ¹+ eé5¹+ ¶º+ b5ÿ Z¸æ¹+ eé5¹+ Ødæ¹+ ÀRº+ iæ¹+ ¶º+ ØÄRº+ ؤ¶º+ ¨©¶º+
7¹+ 8W¹+ -²¹+ pb5ÿ pûå¹+ 0b5ÿ b5ÿ k 6¹+ 5 6 7 8 : <