The branch, eden has been updated
via c88ae41315578cefef447d3da2a5b774738bc7d3 (commit)
via bb4a7701311d0b1f401e3bc0939f17d6e8c239e0 (commit)
from bd5b21f07dad3e59b6e7a16847129aedd749f358 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=c88ae41315578cefef447d3da2a5b774738bc7d3
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=bb4a7701311d0b1f401e3bc0939f17d6e8c239e0
commit bb4a7701311d0b1f401e3bc0939f17d6e8c239e0
Author: Martijn Kaijser <[email protected]>
Date: Mon May 28 15:04:30 2012 +0200
[plugin.video.ted.talks] updated to 3.1.2
diff --git a/plugin.video.ted.talks/addon.xml b/plugin.video.ted.talks/addon.xml
index 67fcc08..9bb3168 100644
--- a/plugin.video.ted.talks/addon.xml
+++ b/plugin.video.ted.talks/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.ted.talks" name="TED Talks" version="3.1.1"
provider-name="rwparris2, moreginger">
+<addon id="plugin.video.ted.talks" name="TED Talks" version="3.1.2"
provider-name="rwparris2, moreginger">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
diff --git a/plugin.video.ted.talks/changelog.txt
b/plugin.video.ted.talks/changelog.txt
index 48aaee0..d98098a 100644
--- a/plugin.video.ted.talks/changelog.txt
+++ b/plugin.video.ted.talks/changelog.txt
@@ -1,3 +1,6 @@
+[B]Version 3.1.2[/B]
+Fix themes (issue#22)
+
[B]Version 3.1.1[/B]
Support subtitles with language subcodes, such as pt-br (issue#10)
diff --git a/plugin.video.ted.talks/resources/lib/model/speakers_scraper.py
b/plugin.video.ted.talks/resources/lib/model/speakers_scraper.py
index 74eee65..cf0b667 100644
--- a/plugin.video.ted.talks/resources/lib/model/speakers_scraper.py
+++ b/plugin.video.ted.talks/resources/lib/model/speakers_scraper.py
@@ -14,9 +14,7 @@ class Speakers:
First yields the speaker count, or 0 if unknown.
After that yields tuples of title, link, img.
'''
- found_titles = set()
page_index = 1
- found_on_last_page = 0
html = self.get_HTML(URLSPEAKERS % (page_index, char))
speaker_count = 0
@@ -31,6 +29,10 @@ class Speakers:
yield speaker_count
+ # Have to know when to stop paging, see condition for loop exit below.
+ found_titles = set()
+ found_on_last_page = 0
+
while True:
containers = SoupStrainer(name='a',
attrs={'href':re.compile('/speakers/.+\.html')})
found_on_this_page = 0
@@ -44,6 +46,9 @@ class Speakers:
img = speaker.img['src']
yield title, URLTED + link, img
+ # Results on last page == results on (last page + 1), _not_ 0 as
you might hope.
+ # The second clause allows us to skip looking at last page + 1 if
the last page contains
+ # fewer results than that before it; which is usually but not
always the case.
if found_on_this_page and found_on_this_page >= found_on_last_page:
page_index += 1
found_on_last_page = found_on_this_page
diff --git
a/plugin.video.ted.talks/resources/lib/model/speakers_scraper_test.py
b/plugin.video.ted.talks/resources/lib/model/speakers_scraper_test.py
index 2cdffb9..37077ff 100644
--- a/plugin.video.ted.talks/resources/lib/model/speakers_scraper_test.py
+++ b/plugin.video.ted.talks/resources/lib/model/speakers_scraper_test.py
@@ -10,9 +10,9 @@ class TestSpeakersScraper(unittest.TestCase):
def test_get_speakers(self):
speakers_generator = Speakers(get_HTML).get_speakers_for_letter('E')
+ # First value returned is number of speakers, for progress.
self.assertTrue(itertools.islice(speakers_generator, 1).next() > 0)
e_speakers = list(speakers_generator)
- print e_speakers
self.assertTrue(len(e_speakers) > 0)
sample_speaker = [s for s in e_speakers if s[0] == 'Kenichi Ebina'][0]
self.assertEqual('http://www.ted.com/speakers/kenichi_ebina.html',
sample_speaker[1])
diff --git a/plugin.video.ted.talks/resources/lib/model/url_constants.py
b/plugin.video.ted.talks/resources/lib/model/url_constants.py
index 9aa98fb..07c7757 100644
--- a/plugin.video.ted.talks/resources/lib/model/url_constants.py
+++ b/plugin.video.ted.talks/resources/lib/model/url_constants.py
@@ -3,3 +3,4 @@ URLPROFILES = URLTED + '/profiles'
URLFAVORITES = URLPROFILES + '/favorites/id/'
URLADDREMFAV = URLPROFILES + '/%sfavorites'
URLSPEAKERS = URLTED +
'/speakers?orderedby=TALKPOSTED&page=%s&alphabylastname=%s'
+URLTHEMES = 'http://www.ted.com/themes/atoz/page/'
diff --git a/plugin.video.ted.talks/resources/lib/ted_talks.py
b/plugin.video.ted.talks/resources/lib/ted_talks.py
index 5b11487..5fce68e 100644
--- a/plugin.video.ted.talks/resources/lib/ted_talks.py
+++ b/plugin.video.ted.talks/resources/lib/ted_talks.py
@@ -9,6 +9,7 @@ from model.user import User
from model.rss_scraper import NewTalksRss
from model.favorites_scraper import Favorites
from model.speakers_scraper import Speakers
+from model.themes_scraper import Themes
import menu_util
import os
import time
@@ -134,16 +135,14 @@ class UI:
self.endofdirectory()
def themes(self):
- themes = self.ted_talks.Themes(self.get_HTML, None)
- #add themes to the list
- for title, link, img in themes.getThemes():
+ themes = Themes(self.get_HTML)
+ for title, link, img in themes.get_themes():
self.addItem(title, 'themeVids', link, img, isFolder=True)
- #end the list
self.endofdirectory()
def themeVids(self, url):
- themes = self.ted_talks.Themes(self.get_HTML, url)
- for title, link, img in themes.getTalks():
+ themes = Themes(self.get_HTML)
+ for title, link, img in themes.get_talks(url):
self.addItem(title, 'playVideo', link, img, isFolder=False)
self.endofdirectory()
diff --git a/plugin.video.ted.talks/resources/lib/ted_talks_scraper.py
b/plugin.video.ted.talks/resources/lib/ted_talks_scraper.py
index 7e016ff..e48cc4e 100644
--- a/plugin.video.ted.talks/resources/lib/ted_talks_scraper.py
+++ b/plugin.video.ted.talks/resources/lib/ted_talks_scraper.py
@@ -1,11 +1,10 @@
import re
-from model.util import cleanHTML, resizeImage
+from model.util import resizeImage
from BeautifulSoup import SoupStrainer, MinimalSoup as BeautifulSoup
from model.url_constants import URLTED
import model.subtitles_scraper as subtitles_scraper
#MAIN URLS
-URLTHEMES = 'http://www.ted.com/themes/atoz/page/'
URLSPEAKERS = 'http://www.ted.com/speakers/atoz/page/'
URLSEARCH = 'http://www.ted.com/search?q=%s/page/'
@@ -83,45 +82,3 @@ class TedTalks:
return title, url, subs, {'Director':speaker, 'Genre':'TED',
'Plot':plot, 'PlotOutline':plot}
-
- class Themes:
-
- def __init__(self, get_HTML, url):
- if url == None:
- url = URLTHEMES
- self.get_HTML = get_HTML
- self.html = self.get_HTML(url)
- # a-z themes don't yet have navItems, so the check can be skipped
for now.
- # self.navItems = TedTalks().getNavItems(html)
-
- def getThemes(self):
- themeContainers = SoupStrainer(name='a',
attrs={'href':re.compile('/themes/\S.+?.html')})
- seen_titles = set()
- for theme in BeautifulSoup(self.html,
parseOnlyThese=themeContainers):
- if theme.img:
- title = theme['title']
- if title not in seen_titles:
- seen_titles.add(title)
- link = URLTED + theme['href']
- thumb = theme.img['src']
- yield title, link, thumb
-
- def getTalks(self):
- # themes loaded with a json call. Why are they not more consistant?
- from simplejson import loads
- # search HTML for the link to tedtalk's "api". It is easier to
use regex here than BS.
- jsonUrl = URLTED + re.findall('DataSource\("(.+?)"', self.html)[0]
- # make a dict from the json formatted string from above url
- talksMarkup = loads(self.get_HTML(jsonUrl))
- # parse through said dict for all the metadata
- for markup in talksMarkup['resultSet']['result']:
- talk = BeautifulSoup(markup['markup'])
- link = URLTED + talk.dt.a['href']
- title = cleanHTML(talk.dt.a['title'])
- pic = resizeImage(talk.find('img',
attrs={'src':re.compile('.+?\.jpg')})['src'])
- yield title, link, pic
-
-
- class Search:
- pass
- #TODO: SEARCH
-----------------------------------------------------------------------
Summary of changes:
.../LICENSE.txt | 6 +-
.../addon.xml | 41 +-
plugin.audio.sky.fm/changelog.txt | 9 +
.../default.py | 773 +++++++++++---------
.../gpl.txt | 0
.../httpcomm.py | 234 ++++---
plugin.audio.sky.fm/icon.png | Bin 0 -> 65546 bytes
.../resources/language/English/strings.xml | 142 ++--
.../resources/settings.xml | 76 +-
plugin.video.ted.talks/addon.xml | 2 +-
plugin.video.ted.talks/changelog.txt | 3 +
.../resources/lib/model/speakers_scraper.py | 9 +-
.../resources/lib/model/speakers_scraper_test.py | 2 +-
.../resources/lib/model/themes_scraper.py | 57 ++
.../resources/lib/model/themes_scraper_test.py | 22 +
.../resources/lib/model/url_constants.py | 1 +
plugin.video.ted.talks/resources/lib/ted_talks.py | 11 +-
.../resources/lib/ted_talks_scraper.py | 45 +--
18 files changed, 790 insertions(+), 643 deletions(-)
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/LICENSE.txt (69%)
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/addon.xml (55%)
create mode 100644 plugin.audio.sky.fm/changelog.txt
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/default.py (59%)
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/gpl.txt (100%)
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/httpcomm.py (69%)
create mode 100644 plugin.audio.sky.fm/icon.png
copy {plugin.audio.di.fm =>
plugin.audio.sky.fm}/resources/language/English/strings.xml (75%)
copy {plugin.audio.di.fm => plugin.audio.sky.fm}/resources/settings.xml (87%)
create mode 100644 plugin.video.ted.talks/resources/lib/model/themes_scraper.py
create mode 100644
plugin.video.ted.talks/resources/lib/model/themes_scraper_test.py
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons